mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: Andre Hedrick <andre@linux-ide.org>, <martin@dalecki.de>,
	Vojtech Pavlik <vojtech@suse.cz>,
	William Lee Irwin III <wli@holomorphy.com>,
	<linux-kernel@vger.kernel.org>
Subject: PCI config locking (WAS Re: [RFC/CFT] cmd640 irqlocking fixes)2
Date: Thu, 25 Jul 2002 16:18:10 +0200	[thread overview]
Message-ID: <20020725141811.29565@192.168.4.1> (raw)
In-Reply-To: <20020725133918.37@192.168.4.1>

>Martin this patch should do the job. It uses the correct pci_config_lock
>>and it also adds the 2.4 probe safety checks for deciding which pci
>>modes to use.
>
>Hrm... pci_config_lock is specific to arch/i386 it seems (and is even
>a static in 2.4.19rc3). That is no good as this isn't the only
>driver to do config access from interrupts, so at least PPC is
>broken in this regard.
>
>Wouldn't it make sense to generalize it and implement it on all archs ?
>
>(That is move extern declaration of it to linux/pci.h, definition to
>drivers/pci/pci.c, and so on...)
>
>I'd rather have a per-host lock, but on the other hand, the host bus
>mecanism is still quite arch-specific, thus making difficult to use
>a per-host lock in drivers, at least in 2.4

Ok, fixing my own crap...

So there seem to be a problem with your patch: pci_config_lock appears
to be an x86-only thing that lives deep inside arch/i386/xxx/pci-pc.c
(xxx beeing kernel or pci)

On the other hand, there is already such a lock provided by
drivers/pci/access.c (pci_lock). You should probably fix your patch
to use that one. (and eventually get rid of the pci_config_lock
in x86, provided I didn't miss something else). But does anybody
but x86 uses CMD640 ? :)

Now, after more thinking and discussions, it seems we may actually
want 2 different things:

 - Protecting the pci config ops themselves as they are usually
indirect access, and thus potentially race. This is also what the
current pci_lock does and is somewhat duplicated by the pci_config_lock
used on x86. That could eventually be moved to a per-host lock

 - Protecting a device, that is preventing (usually from a driver)
any config access during some time, either for doing what you are
doing in the cmd640 patch, but also for _batching_ a set of config
space accesses that have to be atomic together on this device.

The later would probably be better done with a per-device lock. What
I don't like that much here is that normal access will result in 2
spinlocks beeing taken, though config space accesses are usually
rare and slow compared to other IOs, so it may not be that a problem.

That would require the pci config ops to be split into normal
pci_config_xxx that does take the per-device lock, and _pci_config_xxx
that doesn't, so a driver can manually take that lock, batch accesses
and release it.

What do you think ?

Ben.



  reply	other threads:[~2002-07-25 14:13 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-07-24 22:58 [RFC/CFT] cmd640 irqlocking fixes William Lee Irwin III
2002-07-24 23:16 ` William Lee Irwin III
2002-07-25  1:05 ` Alan Cox
2002-07-25  7:54   ` Vojtech Pavlik
2002-07-25  8:28     ` Marcin Dalecki
2002-07-25  8:55       ` Vojtech Pavlik
2002-07-25  8:56         ` Marcin Dalecki
2002-07-25 10:24           ` Alan Cox
2002-07-25 10:37             ` Marcin Dalecki
2002-07-25 10:51             ` Andre Hedrick
2002-07-25 12:52               ` Alan Cox
2002-07-25 12:05                 ` Andre Hedrick
2002-07-25 13:08                 ` Alan Cox
2002-07-25 11:53                   ` Marcin Dalecki
2002-07-25 12:30                   ` Andre Hedrick
2002-07-25 14:33                     ` Alan Cox
2002-07-25 13:39                   ` Benjamin Herrenschmidt
2002-07-25 14:18                     ` Benjamin Herrenschmidt [this message]
2002-07-25 15:45                       ` PCI config locking (WAS Re: [RFC/CFT] cmd640 irqlocking fixes)2 Alan Cox
2002-07-25 14:40                         ` benh
2002-07-25 16:10                           ` Alan Cox
2002-07-25 23:04                           ` Alan Cox
2002-07-25 14:48                         ` Dave Jones
2002-07-25 15:44                           ` Thunder from the hill
2002-07-29  7:13                           ` David S. Miller
2002-07-26  0:41                       ` Marcin Dalecki
2002-07-26  0:15         ` [RFC/CFT] cmd640 irqlocking fixes Albert D. Cahalan
2002-07-25 10:22     ` Alan Cox
2002-07-25  8:01 ` Marcin Dalecki

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=20020725141811.29565@192.168.4.1 \
    --to=benh@kernel.crashing.org \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=andre@linux-ide.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=martin@dalecki.de \
    --cc=vojtech@suse.cz \
    --cc=wli@holomorphy.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

all inboxes | Powered by JetHome®