Bug 247433

Summary: pcscd up to 80% of CPI
Product: [Fedora] Fedora Reporter: Giuseppe Paterno <gpaterno>
Component: pcsc-liteAssignee: Bob Relyea <rrelyea>
Status: CLOSED DUPLICATE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: medium    
Version: 7CC: ludovic.rousseau
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2007-10-10 15:22:44 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
strace of pcscd showing the usb scan none

Description Giuseppe Paterno 2007-07-09 10:25:01 UTC
Description of problem:
PCSCD is taking 80%-99% of CPU without any reason or messages.
The only message I got in /var/log/messages is:
pcscd: prothandler.c:109:PHSetProtocol() Protocol T=0 requested but unsupported
by the card

Smart Card reader is GEMPC card PCMCIA using ccid driver. File reader.conf is
--------------------------------------------------------------------------
# /etc/reader.conf.d/gempc.conf
# Gemplus reader with serial communication
#  - n is the serial port to use n in [0..3]
#  - reader is the reader name. It is needed for multi-slot readers.
#    Possible reader values are: GemPCPinPad, GemCorePOSPro, GemCoreSIMPro,
#    GemPCTwin (default value)
# example: /dev/ttyS0:GemPCPinPad
FRIENDLYNAME      "GemPCTwin serial"
DEVICENAME        /dev/ttyS2
LIBPATH           /usr/lib/pcsc/drivers/serial/libccidtwin.so.1.2.1
CHANNELID         2
--------------------------------------------------------------------------

The smartcard is an OpenPGP.
pcsc-lite is 1.3.3-1.fc7
ccid is 1.2.1-1fc7

smartcard is working fine.
System is working fine.

vmstat as follows:
procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu------
 r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa st
 3  0    176  10892  42636 337032    0    0   114    94  866  915 42 11 44  2  0
 2  0    176   8796  42656 339172    0    0     0  2236 1307  394 65 35  0  0  0
 4  0    176  28240  42668 319580    0    0     0     0 1284  376 65 36  0  0  0
 3  0    176  26376  42668 321552    0    0     6     0 1277  388 63 37  0  0  0
 6  0    176  25776  42680 322132    0    0    12  2918 1322  371 62 38  0  0  0
 3  1    176  25388  42680 322604    0    0    18     0 1259  366 61 39  0  0  0

Comment 1 Bob Relyea 2007-07-09 16:20:31 UTC
Do you have any other reader drivers installed, and if so what versions?

Comment 2 Giuseppe Paterno 2007-07-10 07:24:16 UTC
No, CCID is the only activated reader in readers.conf
There's openct installed as rpm, but is commented out.
Note that if I remove the pcmcia reader to use the UMTS card, pcsc will stay
80-95% of cpu. Of course I stop it when using UTMS, because it's useless.



Comment 3 Ludovic Rousseau 2007-07-20 10:10:16 UTC
The real question is what is the output of the command:
$ file /usr/lib/pcsc/drivers/

Comment 4 Giuseppe Paterno 2007-10-10 10:14:49 UTC
This is the output:

~$  find /usr/lib/pcsc/drivers/
/usr/lib/pcsc/drivers/
/usr/lib/pcsc/drivers/openct-ifd.bundle
/usr/lib/pcsc/drivers/openct-ifd.bundle/Contents
/usr/lib/pcsc/drivers/openct-ifd.bundle/Contents/Info.plist
/usr/lib/pcsc/drivers/openct-ifd.bundle/Contents/PkgInfo
/usr/lib/pcsc/drivers/openct-ifd.bundle/Contents/Linux
/usr/lib/pcsc/drivers/openct-ifd.bundle/Contents/Linux/openct-ifd.so
/usr/lib/pcsc/drivers/serial
/usr/lib/pcsc/drivers/serial/libccidtwin.so.1.2.1
/usr/lib/pcsc/drivers/ifd-egate.bundle
/usr/lib/pcsc/drivers/ifd-egate.bundle/Contents
/usr/lib/pcsc/drivers/ifd-egate.bundle/Contents/Info.plist
/usr/lib/pcsc/drivers/ifd-egate.bundle/Contents/Linux
/usr/lib/pcsc/drivers/ifd-egate.bundle/Contents/Linux/libifd_egate.so
/usr/lib/pcsc/drivers/ifd-ccid.bundle
/usr/lib/pcsc/drivers/ifd-ccid.bundle/Contents
/usr/lib/pcsc/drivers/ifd-ccid.bundle/Contents/Info.plist
/usr/lib/pcsc/drivers/ifd-ccid.bundle/Contents/Linux
/usr/lib/pcsc/drivers/ifd-ccid.bundle/Contents/Linux/libccid.so.1.2.1

The real problem is that pcscd keep scanning the usb bus in an infinitive loop.
An interim (workaround) solution would be a "sleep" between the scan of the usb
bus. Maybe the long term solution would be based on udev (but i'm not a developer).

Comment 5 Giuseppe Paterno 2007-10-10 11:31:14 UTC
Created attachment 222331 [details]
strace of pcscd showing the usb scan

This is the strace of pcscd showing that the usb scanning is in infinitive
loop.
this take me 100% of cpu, and in my laptop fans are ON all the times and my
(poor) battery is lasting no more than 30mins.

Comment 6 Ludovic Rousseau 2007-10-10 11:53:27 UTC
You are using 3 drivers for USB readers:
- openct-ifd
- ifd-egate
- ifd-ccid

I suggest to move all three *.bundle directories to somewhere else and then move them back one at a time 
and restart pcscd after each addition of a driver to see if CPU load is high.

It looks like a known bug in the ifd-egate and/or openct-ifd driver. See also bugs 229263 and 232983

Comment 7 Giuseppe Paterno 2007-10-10 15:22:44 UTC
Hi Ludovic, you're great. 
Removing openct worked fine and now the CPU has reasonable level.
Maybe we can mark this bug as dups of the above bug #229263


*** This bug has been marked as a duplicate of 229263 ***

Comment 8 Ludovic Rousseau 2007-10-10 20:32:56 UTC
(In reply to comment #7)
> Hi Ludovic, you're great. 

Yes, I know.

I have no objection if Red Hat wants to hire me :-)
Just use my private e-mail.