[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <7d6b3b59-5cec-d73f-b65c-4d685ccc70f8@deltatee.com>
Date: Wed, 1 Mar 2017 17:23:38 -0700
From: Logan Gunthorpe <logang@...tatee.com>
To: Jason Gunthorpe <jgunthorpe@...idianresearch.com>
Cc: Bjorn Helgaas <helgaas@...nel.org>,
Keith Busch <keith.busch@...el.com>,
Myron Stowe <myron.stowe@...il.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Bjorn Helgaas <bhelgaas@...gle.com>,
Geert Uytterhoeven <geert+renesas@...der.be>,
Jonathan Corbet <corbet@....net>,
"David S. Miller" <davem@...emloft.net>,
Andrew Morton <akpm@...ux-foundation.org>,
Emil Velikov <emil.l.velikov@...il.com>,
Mauro Carvalho Chehab <mchehab@...nel.org>,
Guenter Roeck <linux@...ck-us.net>,
Jarkko Sakkinen <jarkko.sakkinen@...ux.intel.com>,
Linus Walleij <linus.walleij@...aro.org>,
Ryusuke Konishi <konishi.ryusuke@....ntt.co.jp>,
Stefan Berger <stefanb@...ux.vnet.ibm.com>,
Wei Zhang <wzhang@...com>,
Kurt Schwemmer <kurt.schwemmer@...rosemi.com>,
Stephen Bates <stephen.bates@...rosemi.com>,
linux-pci@...r.kernel.org, linux-doc@...r.kernel.org,
linux-nvme@...ts.infradead.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v5 0/4] New Microsemi PCI Switch Management Driver
On 01/03/17 04:58 PM, Jason Gunthorpe wrote:
> On Wed, Mar 01, 2017 at 03:49:04PM -0700, Logan Gunthorpe wrote:
>
>> Seems to me like an elegant solution would be to implement a 'cdev_kill'
>> function which could kill all the processes using a cdev. Thus, during
>> an unbind, a driver could call it and be sure that there are no users
>> left and it can safely allow the devres unwind to continue. Then no
>> difficult and racy 'alive' flags would be necessary and it would be much
>> easier on drivers.
>
> That could help, but this would mean cdev would have to insert a shim
> to grab locks around the various file ops.
Hmm, I was hoping something more along the lines of actually killing the
processes instead of just shimming away fops.
> AFAIK TPM is correct and has been robustly tested now. We have a 'vtpm'
> driver that agressively uses hot-unplug.
Ah, thanks for the explanation of how that works. I didn't notice the
semaphore usage.
Switchtec is a bit more tricky because a) there's no upper level driver
to handle things and b) userspace may be inside a wait_for_completion
(via read or poll) that needs to be completed. If a so called
'cdev_kill' could actually just kill these processes it would be a bit
easier.
Currently, in the Switchtec code, there's a timeout if the interrupt
doesn't fire (which occurs if the pci device has been torn down) and the
code will check an alive bit (under mutex protection) and error out if
it's not alive.
Because of how poll works, I don't see how I can just hold a semaphore
inside every fops call like the tpm code does.
Logan
Powered by blists - more mailing lists