public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: ebiederm@xmission.com (Eric W. Biederman)
To: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
Cc: Linus Torvalds <torvalds@transmeta.com>,
	davidm@hpl.hp.com, linux-kernel@vger.kernel.org
Subject: Re: PATCH 2.5.x disable BAR when sizing
Date: 22 Dec 2002 12:47:51 -0700	[thread overview]
Message-ID: <m1of7dltso.fsf@frodo.biederman.org> (raw)
In-Reply-To: <20021222213945.A30070@localhost.park.msu.ru>

Ivan Kokshaysky <ink@jurassic.park.msu.ru> writes:

> On Sat, Dec 21, 2002 at 02:44:23PM -0800, Linus Torvalds wrote:
> > And hotplug devices should be disabled at plug-in, so later BAR probing
> > should be pretty harmless too (and, as you point out about bridging, they
> > should be shielded by the hotplug bridge itself).
> 
> Agreed.
> 
> > This is why I repeated my "turn the power off at the whole house" analogy,
> > even if David didn't like it. It's _fine_ to turn the power off if we know
> > things are quiet, it's just that as things stand now, we don't actually
> > know that.
> 
> The analogy is wonderful. I'd like to extend it to mentioned ia64 system:
> any attempt to replace a light bulb that consumes more than 32 Mb^H^HWatts
> without turning the power off will blow up fuses in the whole house.
> 
> >  - (new) phase 1 - scan for and turn off all devices
> >  - phase 2 - go back and check the resources (BAR probing etc)
> >  - phase 3 - allocate unassigned resources.
> 
> I don't think we want to turn off *all* devices in phase 1.
> Probably we need another level of fixups - PCI_FIXUP_EARLY, which
> will be called after phase 1, i.e. before fiddling with BARs.
> 
> However, I'm still not convinced that we should ever change anything.
> 
> On Sun, Dec 22, 2002 at 03:38:04AM -0700, Eric W. Biederman wrote:
> > So the problem we are facing is that we have some activity while BARs
> > are being sized.  Activity can be in the form of IRQs, DMA, IO, and
> > MEM accesses.
> 
> I would suggest another classification: a) bus activity generated by CPU
> and b) bus activity generated by other devices.
> 
> Case 'a' is mostly under our control. The only problem is an interrupt
> arriving during BAR probe, as Paul pointed out. This can be fixed:
> 		pci_read_config_dword(dev, reg, &l);
> +		local_irq_save(flags);
> 		pci_write_config_dword(dev, reg, ~0);
> 		pci_read_config_dword(dev, reg, &sz);
> 		pci_write_config_dword(dev, reg, l);
> +		local_irq_restore(flags);

Not if it is an NMI or an SCI interrupt.  The latter on x86 places
the cpu in System Management Mode, and what the cpu does from that
point forward is out of our control.

Though disabling cpu controlled IRQs help if you are dealing
with any normal IRQs.

> Case 'b', two variants.
> - The target of bus activity is a region located in the low bus
>   addresses (USB case), so there are no conflicts with probed BARs
>   of other devices. But we cannot safely disable devices while BARs
>   are being sized as we don't know for sure what device controls
>   that region.
> - Target region is in the high bus addresses (ia64 case), and conflicts
>   are possible when we do the sizing. Yes, disabling the devices does help
>   to avoid conflicts and it happens to work with *some* configurations.
>   But what if the said region in its turn is defined by BAR? or just
>   controlled by some PCI device and therefore can be disconnected from
>   the bus? Too many if's.
> 
> I think it's obvious now that "disabling the BARs" is not a fix at all,
> it's just a hack for that particular setup.
> BTW, I think it is *not* required by PCI spec - v2.1 says nothing about it,
> in v2.2 it seems to be just an implementation example.
> 
> The real fix is to shut up the device that makes a noise on the bus,
> at least during bus probe.
> I refuse to believe that it cannot be done with that ia64 SAPIC (must be
> a hidden switch somewhere ;-)
> So I'd wait for more tech details regarding that.
> 
> > The goal being to keep the window when uncontrolled pci accesses
> > can blow the system up as small as possible.
> 
> The window will be large enough anyway - the PCI config space accesses are
> very slow on most systems.

The window needs to be small from the PCI bus perspective, not in cpu
clocks.  Write, Read, Write is only something like 9 PCI bus clocks.
If IRQs also traveled over the PCI bus we could be fairly confident of
saturating the PCI bus and not having problems.  Except that the PCI
bus arbiter may not choose the CPU for back to back transactions.

Not that I would like to trust to the small window of opportunity
idea, but closing all of the other holes looks quite difficult.

Eric

  reply	other threads:[~2002-12-22 19:40 UTC|newest]

Thread overview: 78+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-12-19 21:37 PATCH 2.5.x disable BAR when sizing Grant Grundler
2002-12-20  2:54 ` Alan Cox
2002-12-20  2:27   ` David Mosberger
2002-12-20  6:05     ` Linus Torvalds
2002-12-20 19:50   ` Grant Grundler
2002-12-20 20:14     ` Linus Torvalds
2002-12-20 21:22       ` Grant Grundler
2002-12-21 18:34       ` Maciej W. Rozycki
2002-12-20 20:37     ` Richard B. Johnson
2002-12-20 21:29       ` Grant Grundler
2002-12-20  5:57 ` Linus Torvalds
2002-12-20  9:42   ` David Mosberger
2002-12-20 12:53     ` Ivan Kokshaysky
2002-12-20 17:05     ` Linus Torvalds
2002-12-20 18:26       ` David Mosberger
2002-12-20 19:28         ` Linus Torvalds
2002-12-21 22:06         ` Eric W. Biederman
2002-12-21 22:44           ` Linus Torvalds
2002-12-22  7:15             ` Paul Mackerras
2002-12-22 15:03               ` Benjamin Herrenschmidt
2002-12-22 19:21                 ` Ivan Kokshaysky
2002-12-23  0:29                   ` Paul Mackerras
2002-12-23 15:26                     ` Ivan Kokshaysky
2003-01-05 12:37                     ` [patch 2.5] PCI: allow alternative methods for probing the BARs Ivan Kokshaysky
2003-01-06  0:29                       ` Anton Blanchard
2003-01-06  4:14                       ` Linus Torvalds
2003-01-06  5:22                         ` Eric W. Biederman
2003-01-06 10:31                         ` Benjamin Herrenschmidt
2003-01-06 11:32                           ` Andrew Walrond
2003-01-06 22:01                             ` Grant Grundler
2003-01-06 19:45                           ` Grant Grundler
2003-01-07 17:05                             ` Ivan Kokshaysky
2003-01-07 17:46                               ` Linus Torvalds
2003-01-07 20:17                               ` Grant Grundler
2003-01-08 14:47                                 ` Ivan Kokshaysky
2003-01-08 22:34                                   ` Grant Grundler
2003-01-06 15:33                         ` Ivan Kokshaysky
2003-01-06 21:52                           ` Grant Grundler
2003-01-06 23:19                             ` Linus Torvalds
2003-01-07  0:13                               ` Grant Grundler
2003-01-07 12:33                                 ` Alan Cox
2003-01-07 17:27                                   ` Ivan Kokshaysky
2003-01-07 18:46                                     ` Alan Cox
2003-01-07 17:44                                   ` Linus Torvalds
2003-01-08 16:55                                     ` Ivan Kokshaysky
2003-01-09 17:46                                     ` [patch 2.5] 2-pass PCI probing, generic part Ivan Kokshaysky
2003-01-09 17:52                                       ` Benjamin Herrenschmidt
2003-01-09 22:09                                         ` Ivan Kokshaysky
2003-01-09 22:16                                           ` Linus Torvalds
2003-01-09 22:26                                             ` Benjamin Herrenschmidt
2003-01-10  3:49                                               ` Alan Cox
2003-01-09 23:19                                             ` Ivan Kokshaysky
2003-01-09 23:35                                               ` Linus Torvalds
2003-01-10  1:09                                                 ` Grant Grundler
2003-01-10  7:56                                                   ` Eric W. Biederman
2003-01-10 19:00                                                     ` Grant Grundler
2003-01-10 21:42                                                       ` Ivan Kokshaysky
2003-01-10 23:07                                                         ` Grant Grundler
2003-01-11 19:39                                                         ` Scott Murray
2003-01-12  7:19                                                           ` Greg KH
2003-01-13  6:28                                                             ` Scott Murray
2003-01-10 13:35                                                 ` Ivan Kokshaysky
2003-01-14 16:39                                                   ` Ivan Kokshaysky
2003-01-09 18:36                                       ` David Mosberger
2003-01-09 19:52                                       ` Grant Grundler
2003-01-09 22:40                                         ` Ivan Kokshaysky
2003-01-09 17:48                                     ` [patch 2.5] 2-pass PCI probing, hotplug changes Ivan Kokshaysky
2003-01-09 17:51                                     ` [patch 2.5] 2-pass PCI probing, i386 USB quirk Ivan Kokshaysky
2003-01-07 17:12                                 ` [patch 2.5] PCI: allow alternative methods for probing the BARs Ivan Kokshaysky
2003-01-07 17:06                             ` Ivan Kokshaysky
2002-12-22 19:51               ` PATCH 2.5.x disable BAR when sizing Linus Torvalds
2002-12-22 19:57                 ` Eric W. Biederman
2002-12-22 10:38             ` Eric W. Biederman
2002-12-22 18:39               ` Ivan Kokshaysky
2002-12-22 19:47                 ` Eric W. Biederman [this message]
2002-12-22 21:05                   ` Ivan Kokshaysky
2002-12-20 18:50       ` Ivan Kokshaysky
2002-12-20 19:11         ` Linus Torvalds

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=m1of7dltso.fsf@frodo.biederman.org \
    --to=ebiederm@xmission.com \
    --cc=davidm@hpl.hp.com \
    --cc=ink@jurassic.park.msu.ru \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@transmeta.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