From: jgunthorpe@obsidianresearch.com (Jason Gunthorpe)
Subject: [PATCH v5 0/4] New Microsemi PCI Switch Management Driver
Date: Wed, 1 Mar 2017 17:50:47 -0700 [thread overview]
Message-ID: <20170302005047.GA14301@obsidianresearch.com> (raw)
In-Reply-To: <7d6b3b59-5cec-d73f-b65c-4d685ccc70f8@deltatee.com>
On Wed, Mar 01, 2017@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
next prev parent reply other threads:[~2017-03-02 0:50 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-26 6:53 [PATCH v5 0/4] New Microsemi PCI Switch Management Driver Logan Gunthorpe
2017-02-26 6:53 ` [PATCH v5 1/4] MicroSemi Switchtec management interface driver Logan Gunthorpe
2017-02-26 6:53 ` [PATCH v5 2/4] switchtec: Add user interface documentation Logan Gunthorpe
2017-02-26 6:53 ` [PATCH v5 3/4] switchtec: Add sysfs attributes to the Switchtec driver Logan Gunthorpe
2017-02-26 6:53 ` [PATCH v5 4/4] switchtec: Add IOCTLs " Logan Gunthorpe
2017-02-28 15:09 ` [PATCH v5 0/4] New Microsemi PCI Switch Management Driver Bjorn Helgaas
2017-02-28 17:11 ` Logan Gunthorpe
2017-02-28 17:20 ` Greg Kroah-Hartman
2017-03-02 0:32 ` Bjorn Helgaas
2017-03-02 0:39 ` Logan Gunthorpe
2017-03-01 21:41 ` Bjorn Helgaas
2017-03-01 22:24 ` Logan Gunthorpe
2017-03-01 22:49 ` Logan Gunthorpe
2017-03-01 23:58 ` Jason Gunthorpe
2017-03-02 0:23 ` Logan Gunthorpe
2017-03-02 0:29 ` Logan Gunthorpe
2017-03-02 0:50 ` Jason Gunthorpe [this message]
2017-03-01 22:26 ` Keith Busch
2017-03-01 22:37 ` Logan Gunthorpe
2017-03-01 22:59 ` Keith Busch
2017-03-01 22:53 ` Logan Gunthorpe
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170302005047.GA14301@obsidianresearch.com \
--to=jgunthorpe@obsidianresearch.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox