public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Alex Chiang <achiang@hp.com>
To: Trent Piepho <xyzzy@speakeasy.org>
Cc: "Darrick J. Wong" <djwong@us.ibm.com>,
	linux-kernel <linux-kernel@vger.kernel.org>,
	Jesse Barnes <jbarnes@virtuousgeek.org>,
	linux-pci <linux-pci@vger.kernel.org>
Subject: Re: [PATCH] fakephp: Allocate PCI resources before adding the device
Date: Wed, 26 Nov 2008 15:55:35 -0700	[thread overview]
Message-ID: <20081126225535.GA27936@ldl.fc.hp.com> (raw)
In-Reply-To: <Pine.LNX.4.58.0811261349120.24816@shell4.speakeasy.net>

* Trent Piepho <xyzzy@speakeasy.org>:
> On Wed, 26 Nov 2008, Darrick J. Wong wrote:
> > On Wed, Nov 26, 2008 at 01:56:45AM -0800, Trent Piepho wrote:
> > > Ok, that makes sense.  The device I'm using fakephp for doesn't have a
> > > kernel driver so I wouldn't have noticed that.
> > >
> > > Have you tested this with a device that isn't present at boot?  I found
> > > that I needed to a call to pci_enable_device() after assigning resources,
> > > otherwise the BARs wouldn't be enabled.  This only happened if the device
> > > wasn't present at boot time.
> >
> > Yes, I was actually using this driver to <cough> turn the ioatdma
> > controller on after turning it off in the BIOS.
> 
> Maybe it's different on powerpc then?  My pseudo-hotplugable device is also
> the only thing connected to the PCI-E host bus controller.  At boot the
> controller is empty and so I think some code to enable its BARs gets
> skipped.  But without the pci_enable_device(), I get this:
> 
> 01:00.0 Signal processing controller: Freescale Semiconductor Inc Aurora Nexus Trace Interface
>         Flags: fast devsel, IRQ 255
>         Memory at 40000000 (64-bit, prefetchable) [disabled] [size=4K]
>         Capabilities: [40] Power Management version 3
>         Capabilities: [48] Message Signalled Interrupts: Mask+ 64bit+ Queue=0/0 Enable-
>         Capabilities: [60] Express Endpoint IRQ 0
>         Capabilities: [100] Device Serial Number 00-00-00-00-00-00-00-00
> 
> > > might not be feasible.  It also looks a previous patch by Alex Chiang
> > > completely changed the sysfs interface for fakephp.  I thought sysfs
> > > interfaces were supposed to be stable?!  Also looks like it made fakephp
> >
> > I doubt that, sysfs interfaces change all the time.  I think only the
> > syscall interface has any sort of stability guarantee.
> 
> The ones meant to be used from userspace usually don't.  At least that
> doesn't seem to be what Linus is saying here http://lwn.net/Articles/172986/
> 
> I've written software that uses an established interface, which has been
> the same for years, and I see someone went and broke it, no warning.  That
> hardly seems reasonable.

Which commit are you talking about?

5fe6cc60680d29740b85278e17a002fa27b7e642
PCI: prevent duplicate slot names

fe99740cac117f208707488c03f3789cf4904957
PCI: construct one fakephp slot per PCI slot

Sorry for your frustration. Both patchsets went through multiple
revisions, and had plenty of input from the various PCI
developers. At the time, no one seemed to think that the proposed
changes were unreasonable.

> > > useless.  How are you supposed to figure out which "fake-n" directory is
> > > the right one to disable the device you want?
> >
> > cat /sys/bus/pci/slots/fake*/address
> 
> Ahh, my kernel doesn't have an address attribute in the slot directories.

That is bizarre. You are saying that you're getting slot entries
without address files?

Can you send the output of 'ls /sys/bus/pci/slots' and also:

$ for i in /sys/bus/pci/slots ; do ls $i ; done

What kernel are you on?

> Still, this is much more inefficient than the previous way.  It also has a
> race condition.  After scanning each fake* device to find the one with the
> correct address there is a window before the power attribute is written.
> The fake* device might change in that time and one could write to the wrong
> power attribute.

There is no way for fakephp to hot-add devices. The only use case
is to hot-remove devices.

Once fakephp is loaded, the fake* entry created in sysfs will not
change.

Maybe you're talking about something else. Some more context for
what you're trying to do, please?

/ac


  reply	other threads:[~2008-11-26 22:55 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-25 21:24 [PATCH] fakephp: Allocate PCI resources before adding the device Darrick J. Wong
2008-11-25 21:43 ` Greg KH
2008-11-26  4:46 ` Trent Piepho
2008-11-26  7:48   ` Darrick J. Wong
2008-11-26  9:56     ` Trent Piepho
2008-11-26 18:18       ` Darrick J. Wong
2008-11-26 22:23         ` Trent Piepho
2008-11-26 22:55           ` Alex Chiang [this message]
2008-11-27  1:44             ` Trent Piepho
2008-11-27  2:42               ` Matthew Wilcox
2008-11-28 10:11                 ` Trent Piepho
2008-11-28 18:57                   ` Matthew Wilcox
2008-11-28 21:21                     ` Trent Piepho
2008-11-28 21:30                       ` Matthew Wilcox
2008-12-01  1:10                         ` Problems with fakephp Trent Piepho
2008-12-16 20:28                           ` fixup PCI device booleans in sysfs Jesse Barnes
2008-11-28 23:18               ` [PATCH] fakephp: Allocate PCI resources before adding the device Alex Chiang
2008-12-01 13:00                 ` Problems with fakephp Trent Piepho
2008-12-02  3:16                   ` Alex Chiang
2008-12-03  4:07                     ` Trent Piepho
2008-12-03  4:38                       ` Alex Chiang
2008-12-03 17:22                         ` Rolf Eike Beer
2008-12-03 17:43                           ` Alex Chiang
2008-12-03 17:55                             ` Rolf Eike Beer
2008-12-03 18:22                               ` Alex Chiang
2008-12-08 21:09                                 ` Rolf Eike Beer
2008-12-01 13:36                 ` Trent Piepho
2008-12-01 14:08                   ` [PATCH] PCI: Method for removing PCI devices Trent Piepho
2008-12-01 14:40                     ` Greg KH
2008-12-01 14:08                   ` [PATCH] PCI: Legacy fakephp driver Trent Piepho
2008-11-27  1:52             ` [PATCH] fakephp: Allocate PCI resources before adding the device Darrick J. Wong
2008-11-28  9:51               ` Trent Piepho
2008-11-28 18:42                 ` Rolf Eike Beer
2008-11-28 21:06                   ` Trent Piepho
2008-12-01 17:08                     ` Rolf Eike Beer
2008-12-16 19:33                       ` Jesse Barnes
2008-12-16 20:56                         ` [PATCH] fakephp: Allocate PCI resources before adding the?device Darrick J. Wong
2008-12-21  2:23                           ` Trent Piepho

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=20081126225535.GA27936@ldl.fc.hp.com \
    --to=achiang@hp.com \
    --cc=djwong@us.ibm.com \
    --cc=jbarnes@virtuousgeek.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=xyzzy@speakeasy.org \
    /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