All of lore.kernel.org
 help / color / mirror / Atom feed
* Broken pci_block_user_cfg_access interface
@ 2011-08-24 10:43 Jan Kiszka
  2011-08-24 15:02 ` Brian King
  2011-08-29 15:05 ` Michael S. Tsirkin
  0 siblings, 2 replies; 35+ messages in thread
From: Jan Kiszka @ 2011-08-24 10:43 UTC (permalink / raw)
  To: Linux Kernel Mailing List, linux-pci
  Cc: Alex Williamson, Michael S. Tsirkin, Jesse Barnes,
	Matthew Wilcox, Brian King

Hi,

trying to port the generic device interrupt masking pattern of
uio_pci_generic to KVM's device assignment code, I stumbled over some
fundamental problem with the current pci_block/unblock_user_cfg_access
interface: it does not provide any synchronization between blocking
sides. This allows user space to trigger a kernel BUG, just run two

while true; do echo 1 > /sys/bus/pci/devices/<some-device>/reset; done

loops in parallel and watch the kernel oops.

Instead of some funky open-coded locking mechanism, we would rather need
a plain mutex across both the user space access (via sysfs) and the
sections guarded by pci_block/unblock_user_cfg_access so far. But I'm
not sure which of them already allow sleeping, specifically if the IPR
driver would be fine with such a change. Can someone in the CC list
comment on this?

uio_pci_generic would definitely not be able to sleep as it takes the
lock from (potentially hard) IRQ context. This particular use case, RMW
of command/status word, requires a separate mechanism. I'm considering
to introduce a dedicated raw spinlock with IRQ protection for that
words, maybe also a PCI core service to abstract INTx testing and masking.

Any further thoughts on how to resolve this issue?

Thanks,
Jan

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

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

end of thread, other threads:[~2011-09-07 16:20 UTC | newest]

Thread overview: 35+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-08-24 10:43 Broken pci_block_user_cfg_access interface Jan Kiszka
2011-08-24 15:02 ` Brian King
2011-08-25  9:19   ` Jan Kiszka
2011-08-25  9:40     ` Michael S. Tsirkin
2011-08-25 10:34       ` Jan Kiszka
2011-08-25 13:06       ` Brian King
2011-08-25 13:12         ` Brian King
2011-08-25 13:16           ` Jan Kiszka
2011-08-25 13:24             ` Brian King
2011-08-25 18:16               ` Michael S. Tsirkin
2011-08-25 13:02     ` Brian King
2011-08-25 13:06       ` Jan Kiszka
2011-08-25 18:19         ` Michael S. Tsirkin
2011-08-25 18:52           ` Jan Kiszka
2011-08-25 19:07             ` Michael S. Tsirkin
2011-08-25 19:26               ` Jan Kiszka
2011-08-29 15:05 ` Michael S. Tsirkin
2011-08-29 15:42   ` Jan Kiszka
2011-08-29 15:58     ` Michael S. Tsirkin
2011-08-29 16:14       ` Jan Kiszka
2011-08-29 16:23         ` Michael S. Tsirkin
2011-08-29 16:26           ` Jan Kiszka
2011-08-29 18:47     ` Jan Kiszka
2011-08-29 19:18       ` Michael S. Tsirkin
2011-08-30 16:30         ` Brian King
2011-08-30 18:01           ` Michael S. Tsirkin
2011-08-30 19:41             ` Brian King
2011-09-02  7:48         ` [RFC] pci: Rework config space blocking services Jan Kiszka
2011-09-06  7:00           ` Michael S. Tsirkin
2011-09-06  7:18             ` Jan Kiszka
2011-09-06  8:04               ` Michael S. Tsirkin
2011-09-06  8:27                 ` Jan Kiszka
2011-09-06  8:47                   ` Michael S. Tsirkin
2011-09-06  8:48                     ` Jan Kiszka
2011-09-07 13:46           ` Brian King

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.