linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: [PATCH v2 0/3] PCI: Rework config space locking, add INTx masking services
       [not found] <cover.1320396359.git.jan.kiszka@siemens.com>
@ 2011-12-01 12:04 ` Jan Kiszka
  2011-12-01 15:06   ` Jesse Barnes
       [not found] ` <693bbd2bcf55f839d6dc4b7b002dd1827214bf1f.1320396359.git.jan.kiszka@siemens.com>
  1 sibling, 1 reply; 3+ messages in thread
From: Jan Kiszka @ 2011-12-01 12:04 UTC (permalink / raw)
  To: Jesse Barnes
  Cc: linux-pci, linux-kernel, Hans J. Koch, Greg Kroah-Hartman,
	Michael S. Tsirkin, kvm

On 2011-11-04 09:45, Jan Kiszka wrote:
> [ Rebase of v1 over yesterday's linux-next ]
> 
> This series tries to heal the currently broken locking scheme around PCI
> config space accesses.
> 
> We have an interface lock out access via sysfs, but that service wrongly
> assumes it is only called by one instance at a time for some device. So
> two loops doing
> 
> echo 1 > /sys/bus/pci/devices/<some-device>/reset
> 
> in parallel will trigger a kernel BUG at the moment.
> 
> Besides synchronizing with user space, we also need to manage config
> space access of generic PCI drivers. They need to mask legacy interrupt
> lines while the specific driver runs in user space or a guest OS.
> 
> The approach taken here is provide mutex-like locking for general
> access - which still requires a special mechanism due to requirements of
> the IBM Power RAID SCSI driver. Furthermore, INTx masking is now
> available via the PCI core and synchronized via the internal pci_lock.
> 
> Jan Kiszka (3):
>   pci: Rework config space blocking services
>   pci: Introduce INTx check & mask API
>   uio: Convert uio_generic_pci to new intx masking API
> 
>  drivers/pci/access.c          |   76 +++++++++++++++++----------
>  drivers/pci/iov.c             |   12 ++--
>  drivers/pci/pci.c             |  114 ++++++++++++++++++++++++++++++++++++++++-
>  drivers/pci/pci.h             |    2 +
>  drivers/scsi/ipr.c            |   67 +++++++++++++++++++++---
>  drivers/scsi/ipr.h            |    1 +
>  drivers/uio/uio_pci_generic.c |   76 ++-------------------------
>  include/linux/pci.h           |   17 ++++--
>  8 files changed, 248 insertions(+), 117 deletions(-)
> 

I just received yet another request regarding the KVM feature that
depends on this. What's the status of these patches? Were they merged
into some staging tree already (didn't find any traces so far)?

Thanks,
Jan

-- 
Siemens AG, Corporate Technology, CT T DE IT 1
Corporate Competence Center Embedded Linux

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2 0/3] PCI: Rework config space locking, add INTx masking services
  2011-12-01 12:04 ` [PATCH v2 0/3] PCI: Rework config space locking, add INTx masking services Jan Kiszka
@ 2011-12-01 15:06   ` Jesse Barnes
  0 siblings, 0 replies; 3+ messages in thread
From: Jesse Barnes @ 2011-12-01 15:06 UTC (permalink / raw)
  To: Jan Kiszka
  Cc: linux-pci, linux-kernel, Hans J. Koch, Greg Kroah-Hartman,
	Michael S. Tsirkin, kvm

On Thu, 01 Dec 2011 13:04:15 +0100
Jan Kiszka <jan.kiszka@siemens.com> wrote:

> On 2011-11-04 09:45, Jan Kiszka wrote:
> > [ Rebase of v1 over yesterday's linux-next ]
> > 
> > This series tries to heal the currently broken locking scheme
> > around PCI config space accesses.
> > 
> > We have an interface lock out access via sysfs, but that service
> > wrongly assumes it is only called by one instance at a time for
> > some device. So two loops doing
> > 
> > echo 1 > /sys/bus/pci/devices/<some-device>/reset
> > 
> > in parallel will trigger a kernel BUG at the moment.
> > 
> > Besides synchronizing with user space, we also need to manage config
> > space access of generic PCI drivers. They need to mask legacy
> > interrupt lines while the specific driver runs in user space or a
> > guest OS.
> > 
> > The approach taken here is provide mutex-like locking for general
> > access - which still requires a special mechanism due to
> > requirements of the IBM Power RAID SCSI driver. Furthermore, INTx
> > masking is now available via the PCI core and synchronized via the
> > internal pci_lock.
> > 
> > Jan Kiszka (3):
> >   pci: Rework config space blocking services
> >   pci: Introduce INTx check & mask API
> >   uio: Convert uio_generic_pci to new intx masking API
> > 
> >  drivers/pci/access.c          |   76 +++++++++++++++++----------
> >  drivers/pci/iov.c             |   12 ++--
> >  drivers/pci/pci.c             |  114
> > ++++++++++++++++++++++++++++++++++++++++-
> > drivers/pci/pci.h             |    2 +
> > drivers/scsi/ipr.c            |   67 +++++++++++++++++++++---
> > drivers/scsi/ipr.h            |    1 +
> > drivers/uio/uio_pci_generic.c |   76 ++-------------------------
> > include/linux/pci.h           |   17 ++++-- 8 files changed, 248
> > insertions(+), 117 deletions(-)
> > 
> 
> I just received yet another request regarding the KVM feature that
> depends on this. What's the status of these patches? Were they merged
> into some staging tree already (didn't find any traces so far)?

Yeah I think it's ok now; I'll give it one more look and pull it into
-next.

Thanks,
Jesse

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2 1/3] pci: Rework config space blocking services
       [not found] ` <693bbd2bcf55f839d6dc4b7b002dd1827214bf1f.1320396359.git.jan.kiszka@siemens.com>
@ 2011-12-05 19:06   ` Jesse Barnes
  0 siblings, 0 replies; 3+ messages in thread
From: Jesse Barnes @ 2011-12-05 19:06 UTC (permalink / raw)
  To: Jan Kiszka
  Cc: linux-pci, linux-kernel, Hans J. Koch, Greg Kroah-Hartman,
	Michael S. Tsirkin, kvm

[-- Attachment #1: Type: text/plain, Size: 1090 bytes --]

On Fri,  4 Nov 2011 09:45:59 +0100
Jan Kiszka <jan.kiszka@siemens.com> wrote:

> pci_block_user_cfg_access was designed for the use case that a single
> context, the IPR driver, temporarily delays user space accesses to the
> config space via sysfs. This assumption became invalid by the time
> pci_dev_reset was added as locking instance. Today, if you run two loops
> in parallel that reset the same device via sysfs, you end up with a
> kernel BUG as pci_block_user_cfg_access detect the broken assumption.
> 
> This reworks the pci_block_user_cfg_access to a sleeping service
> pci_cfg_access_lock and an atomic-compatible variant called
> pci_cfg_access_trylock. The former not only blocks user space access as
> before but also waits if access was already locked. The latter service
> just returns false in this case, allowing the caller to resolve the
> conflict instead of raising a BUG.
> 
> Adaptions of the ipr driver were originally written by Brian King.

Applied this series to linux-next, thanks.

-- 
Jesse Barnes, Intel Open Source Technology Center

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-12-05 19:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <cover.1320396359.git.jan.kiszka@siemens.com>
2011-12-01 12:04 ` [PATCH v2 0/3] PCI: Rework config space locking, add INTx masking services Jan Kiszka
2011-12-01 15:06   ` Jesse Barnes
     [not found] ` <693bbd2bcf55f839d6dc4b7b002dd1827214bf1f.1320396359.git.jan.kiszka@siemens.com>
2011-12-05 19:06   ` [PATCH v2 1/3] pci: Rework config space blocking services Jesse Barnes

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).