From owner-freebsd-usb@freebsd.org Thu Jan 3 12:19:40 2019 Return-Path: Delivered-To: freebsd-usb@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B90111427866 for ; Thu, 3 Jan 2019 12:19:40 +0000 (UTC) (envelope-from hps@selasky.org) Received: from mail.turbocat.net (turbocat.net [88.99.82.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CE141726D2 for ; Thu, 3 Jan 2019 12:19:39 +0000 (UTC) (envelope-from hps@selasky.org) Received: from hps2016.home.selasky.org (unknown [176.74.212.121]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id 90E1D26022D; Thu, 3 Jan 2019 13:19:37 +0100 (CET) Subject: Re: r342378: usbconfig takes 3-5 minutes to read the bus To: freebsd-usb@freebsd.org, Ludovic Rousseau References: <3ac801b2-899a-ee09-1398-ecab6ec7130a@selasky.org> <20190102104853.GA2622@c720-r342378> <4bf80067-8e3a-572f-c1b5-ae83b1c40c22@selasky.org> <20190102154701.GA13702@c720-r342378> <2f013cf9-b073-04fd-9932-079f86fa24b1@selasky.org> <20190103060431.GA2711@c720-r342378> <5950d771-ffa9-9325-b102-295fd092052e@selasky.org> <20190103094850.GA2595@c720-r342378> <076e01a2-51e7-b140-28c9-1c58d034327b@selasky.org> <20190103113512.GA2547@c720-r342378> From: Hans Petter Selasky Message-ID: <34dfc02b-b252-9f38-a905-31a713012c6a@selasky.org> Date: Thu, 3 Jan 2019 13:17:18 +0100 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:60.0) Gecko/20100101 Thunderbird/60.4.0 MIME-Version: 1.0 In-Reply-To: <20190103113512.GA2547@c720-r342378> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: CE141726D2 X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org; spf=pass (mx1.freebsd.org: domain of hps@selasky.org designates 88.99.82.50 as permitted sender) smtp.mailfrom=hps@selasky.org X-Spamd-Result: default: False [-6.60 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+a:mail.turbocat.net]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; TAGGED_RCPT(0.00)[freebsd]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[selasky.org]; TO_MATCH_ENVRCPT_SOME(0.00)[]; MX_GOOD(-0.01)[cached: mail.turbocat.net]; RCPT_COUNT_TWO(0.00)[2]; NEURAL_HAM_SHORT(-0.95)[-0.953,0]; IP_SCORE(-3.34)[ip: (-9.52), ipnet: 88.99.0.0/16(-4.74), asn: 24940(-2.42), country: DE(-0.01)]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:24940, ipnet:88.99.0.0/16, country:DE]; MID_RHS_MATCH_FROM(0.00)[]; RCVD_TLS_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2] X-BeenThere: freebsd-usb@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FreeBSD support for USB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Jan 2019 12:19:40 -0000 On 1/3/19 12:35 PM, Matthias Apitz wrote: > but is doing so 3000++ times: > > $ dmesg | grep 'PID 544' | wc -l > 3441 > > This proc is started by devd(8) with that devd(8) hook: > Hi, Basically pcscd is congesting the enumeration SX lock, preventing usbconfig from running because it tries to open the same USB device over and over again. I'm not sure why, but it can have something to do with how you start pcscd. Can you try to use the example rules given by the pcscd packet message? attach 100 { device-name "ugen[0-9]+"; action "/usr/local/sbin/pcscd -H"; }; detach 100 { device-name "ugen[0-9]+"; action "/usr/local/sbin/pcscd -H"; }; Maybe there is a bug in pcsd that it tries to open the same USB device over and over again if there is an libusb error? Maybe it should sleep a bit before trying to re-enumerate devices? I'm CC'ing Ludovic Rousseau, in case he has any comments. --HPS