Re: [RESEND][PATCH] PCI: Reassign page-aligned memory resources to device for pci passthrough.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Nov 12, 2008 at 01:02:58PM -0800, Jesse Barnes wrote:
> On Wednesday, November 12, 2008 12:12 pm Greg KH wrote:
> > On Wed, Nov 12, 2008 at 11:51:04AM -0800, Jesse Barnes wrote:
> > > On Tuesday, November 11, 2008 9:37 pm Yuji Shimada wrote:
> > > > As I have not received a reply to my mail of November 6, 2008, I am
> > > > resending it herewith.
> > > >
> > > > This patch adds the function that reassigns page-aligned memory
> > > > resources to device, to linux.
> > > >
> > > > I created this patch for xen's dom0 linux. It have already been
> > > > included in xen's dom0 linux. It is useful when we assign I/O device
> > > > to HVM domain using pci passthrough, because page-aligned memory
> > > > resource is required for pci passthrough. It is also useful for
> > > > KVM. So I submit it to linux-pci ML.
> > >
> > > Ok, so the fundamental requirement here is to assign PCI devices to
> > > guests, right?  That means PCI resources be aligned to a page boundary
> > > and take up at least a page so that no other resources will fall into the
> > > same page, right?
> > >
> > > So you add a quirk to unassign the resources of the device(s) in question
> > > and let the core reassign them according to your new constraints.  So
> > > far, so good.
> > >
> > > Like Matthew said, reassigning at runtime should be possible, but can be
> > > a little trickier since your configuration has to disallow driver binding
> > > (or unbind everything) until after you've done your reassignments.  For
> > > v11n setups that doesn't seem wholly unreasonable, but probably isn't as
> > > convenient as simply doing it at startup time.
> > >
> > > Anyway, comments on your patch below.
> > >
> > > > To reassign page-aligned memory resources to device, please add boot
> > > > parameter of linux as follows.
> > > >
> > > > 	reassigndev=00:1d.7,01:00.0
> > > >
> > > > 	reassigndev=	Specifies device to reassign page-aligned
> > > > 			memory resources.  PCI-PCI bridge can be
> > > > 			specified, if resource windows need to be
> > > > 			expanded.
> > >
> > > I'd call this pagealignbars= or something instead, since you're not just
> > > reassigning things (that happens anyway for conflicting resources and for
> > > quirked devices), you're making sure that resources really are page
> > > aligned. It should probably also be part of the pci= parameter; besides
> > > your code for parsing out PCI device specifiers might be handy in the
> > > future (I was surprised my quick look didn't find some other boot option
> > > that already did it).
> >
> > As I said before, for a different patch recently, you can't use pci
> > device ids as a kernel command line option as they are not stable and
> > the user/distro never knows them ahead of time.
> >
> > Please do this dynamically while the kernel is running instead, if you
> > really have to do this.
> 
> In the face of system configuration changes and kernel changes that's true.  
> But for a specific configuration it's generally stable, and people definitely 
> rely on that today.

They do?  In what way?

It isn't stable at all.  I have 2 laptops here that randomly decide to
reassign the pci bus ids depending on the phase of the moon.  Caused
havoc with a xorg driver that was trying to "assume" that it always knew
what the pci bus id ordering was going to be.

This is in a laptop model that is shipping today.  The BIOS people
rightly said that there was nothing in the PCI spec that prevented this
from happening, and that Windows didn't have a problem with it at all.

For other users, lots of laptops reassign pci devices when booting if
the laptop is plugged into a docking station or not.

I've also seen pci hotplug systems that like to renumber them
semi-randomly every other boot depending on how long different PCI
"nodes" take to powerup in the system.

So if anyone is relying on this in any way right now, that's wrong.

thanks,

greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-pci" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux