Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1590751
| From | Jason Gunthorpe <jgunthorpe@obsidianresearch.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH v5 0/4] New Microsemi PCI Switch Management Driver |
| Date | 2017-03-02 02:00 +0100 |
| Message-ID | <tgng6-2HO-5@gated-at.bofh.it> (permalink) |
| References | (1 earlier) <tgkrT-HO-3@gated-at.bofh.it> <tgkUW-1b6-13@gated-at.bofh.it> <tglnY-1pB-19@gated-at.bofh.it> <tgn6p-2E1-1@gated-at.bofh.it> <tgng6-2HO-7@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Wed, Mar 01, 2017 at 05:23:38PM -0700, Logan Gunthorpe wrote:
> > 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.
That would probably make most cdev users unhappy, it is not what we
want in tpm or infiniband, for instance.
> > AFAIK TPM is correct and has been robustly tested now. We have a 'vtpm'
> > driver that agressively uses hot-unplug.
>
> Switchtec is a bit more tricky because a) there's no upper level driver
> to handle things
Introducing a light split between 'the upper part that owns the cdev'
and 'the lower part that owns the hardware' makes things much easier
to understand in a driver and it becomes clearer where, eg, devm
actions should be linked (ie probably not to the cdev part)
> 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.
For TPM, poll could be something like:
static unsigned int tpm_poll(struct file *filp,
struct poll_table_struct *wait)
{
poll_wait(filp, &chip->poll_wait, wait);
if (tpm_try_get_ops(chip)) {
mask = chip->ops->driver_do_poll(...);
tpm_put_ops(chip);
} else
mask = POLLIN | POLLRDHUP | POLLOUT | POLLERR | POLLHUP;
return mask;
}
And we would trigger chip->poll_wait in the unregister.
wait_for_completion is similar, drop the rwsem while sleeping, add
'ops = NULL' to the sleeping condition test, trigger the wait on
unregister then reacquire the rwsem and test ops on wake.
Jason
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Re: [PATCH v5 0/4] New Microsemi PCI Switch Management Driver Bjorn Helgaas <helgaas@kernel.org> - 2017-03-01 23:00 +0100
Re: [PATCH v5 0/4] New Microsemi PCI Switch Management Driver Logan Gunthorpe <logang@deltatee.com> - 2017-03-01 23:30 +0100
Re: [PATCH v5 0/4] New Microsemi PCI Switch Management Driver Logan Gunthorpe <logang@deltatee.com> - 2017-03-02 00:00 +0100
Re: [PATCH v5 0/4] New Microsemi PCI Switch Management Driver Jason Gunthorpe <jgunthorpe@obsidianresearch.com> - 2017-03-02 01:50 +0100
Re: [PATCH v5 0/4] New Microsemi PCI Switch Management Driver Jason Gunthorpe <jgunthorpe@obsidianresearch.com> - 2017-03-02 02:00 +0100
Re: [PATCH v5 0/4] New Microsemi PCI Switch Management Driver Logan Gunthorpe <logang@deltatee.com> - 2017-03-02 02:20 +0100
Re: [PATCH v5 0/4] New Microsemi PCI Switch Management Driver Logan Gunthorpe <logang@deltatee.com> - 2017-03-02 02:20 +0100
Re: [PATCH v5 0/4] New Microsemi PCI Switch Management Driver Keith Busch <keith.busch@intel.com> - 2017-03-01 23:40 +0100
Re: [PATCH v5 0/4] New Microsemi PCI Switch Management Driver Keith Busch <keith.busch@intel.com> - 2017-03-02 00:00 +0100
Re: [PATCH v5 0/4] New Microsemi PCI Switch Management Driver Logan Gunthorpe <logang@deltatee.com> - 2017-03-02 00:20 +0100
Re: [PATCH v5 0/4] New Microsemi PCI Switch Management Driver Logan Gunthorpe <logang@deltatee.com> - 2017-03-02 00:20 +0100
csiph-web