XEN - unbind/bind a PCI device

Tech Writer TechWtr at handspun.com
Tue Sep 25 17:46:17 EDT 2007


Patrick,

Thanks for the suggestions.  It turns out that the echo to another PCI device unbind worked, and an attempt to echo my sound card using the wrong slot number failed.  So, it looks like there's something goofy with this unbind file.  

### Try unbinding another driver:
# ls /sys/bus/pci/drivers/3c59x
0000:00:09.0  bind  module  new_id  unbind
#
# echo -n 0000:00:09.0 > "/sys/bus/pci/drivers/3c59x/unbind"
#
### Try unbinding with the wrong PCI slot number
# echo -n 0000:00:12.0 > "/sys/bus/pci/drivers/ENS1371/unbind"
bash: echo: write error: No such device
#
### Try unbinding the sound card that I want to use
# echo -n 0000:00:0b.0 > "/sys/bus/pci/drivers/ENS1371/unbind"
    (still hangs)


### Is there anything different about these directories?
# ls -la /sys/bus/pci/drivers/ENS1371
total 0
drwxr-xr-x  2 root root    0 Sep 25 05:12 .
drwxr-xr-x 14 root root    0 Sep 24 22:08 ..
--w-------  1 root root 4096 Sep 24 22:10 bind
lrwxrwxrwx  1 root root    0 Sep 24 22:10 module -> ../../../../module/snd_ens1371
--w-------  1 root root 4096 Sep 24 22:10 new_id
--w-------  1 root root    0 Sep 25 05:12 unbind

# ls -la /sys/bus/pci/drivers/3c59x/
total 0
drwxr-xr-x  2 root root    0 Sep 25 05:11 .
drwxr-xr-x 14 root root    0 Sep 24 22:08 ..
--w-------  1 root root 4096 Sep 24 22:10 bind
lrwxrwxrwx  1 root root    0 Sep 24 22:10 module -> ../../../../module/3c59x
--w-------  1 root root 4096 Sep 24 22:10 new_id
--w-------  1 root root    0 Sep 25 05:13 unbind
#






----- Original Message ----- 
From: "Flaherty, Patrick" <pflaherty at wsi.com>
To: "Tech Writer" <TechWtr at handspun.com>; "Thomas Charron" <twaffle at gmail.com>
Cc: <gnhlug-discuss at mail.gnhlug.org>
Sent: Tuesday, September 25, 2007 12:48 PM
Subject: RE: XEN - unbind/bind a PCI device


> Speaking with little Xen experience.
> 
> My first inkling would be that the device is locked by the VM it's
> currently bound to. Did you try rmmoding the sound modules from the VM?
> Does that VM still have access to the device? How about unbinding
> another device (try something like a usb drive I guess?).
> 
> Then I'd see what happens when you give a bogus bus ID in your echo
> statement. Does it hang or give you an error?
> 
> After that I'd get the standard debug output (dmesg, lspci -v, etc.)
> from both the host and the guests, start posting.
> 
> When all of those fail, revert back to old plug and play troubleshooting
> (shaking rattles, flicking light switches, lighting incense, smearing
> cafes blood on the pc in question).
> 
> G'Luck.
> 
>> -----Original Message-----
>> From: gnhlug-discuss-bounces at mail.gnhlug.org 
>> [mailto:gnhlug-discuss-bounces at mail.gnhlug.org] On Behalf Of 
>> Tech Writer
>> Sent: Tuesday, September 25, 2007 12:01 PM
>> To: Thomas Charron
>> Cc: gnhlug-discuss at mail.gnhlug.org
>> Subject: Re: XEN - unbind/bind a PCI device
>> 
>> Using Xen is very cool when it goes smoothly, and very 
>> frustrating when you run into a glitch.  There are a few 
>> "glitches" that I've run into (I've tested it on both RHEL5 
>> and SLES10.)  The most annoying (from SLES) is that when you 
>> point to a "kit" to install your VM from, it often gets 
>> confused when trying to get to the next device (2nd CD.)  The 
>> easiest workaround for this is to just use a local DVD iso image file.
>> 
>> But... I can't figure out why this echo command just hangs... 
>>  Ignoring the fact that I'm doing this for Xen, does anyone 
>> have any ideas why an echo command like this would lock?  The 
>> idea is that the sound card is bound to domain 0 (the 
>> physical machine's kernel) and to unbind it (so the virtual 
>> machine can take it) you need to write the PCI slot number to 
>> the unbind file.  This example is all over the web, so it 
>> must work.  I just can't figure out why it hangs for me.
>> 
>>       echo -n "0000:00:0b.0" > "/sys/bus/pci/drivers/ENS1371/unbind"
>> 
>> Peg
>> 
>> ----- Original Message -----
>> From: "Thomas Charron" <twaffle at gmail.com>
>> To: "Tech Writer" <TechWtr at handspun.com>
>> Cc: <gnhlug-discuss at mail.gnhlug.org>
>> Sent: Tuesday, September 25, 2007 10:51 AM
>> Subject: Re: XEN - unbind/bind a PCI device
>> 
>> 
>> > On 9/25/07, Tech Writer <TechWtr at handspun.com> wrote:
>> >> I'm trying to test some examples in a Xen course.  All has 
>> gone well so 
>> >> far,
>> >> but my very last example is to unbind a PCI device (in 
>> this case, the 
>> >> sound
>> >> card) from its driver, and bind it to the PCI backend so 
>> that it can be 
>> >> used
>> >> by one of the virtual machines.
>> >
>> >  QQ
>> >
>> >  You just made me REALLY want to look at Xen again.  :-D
>> >
>> > -- 
>> > -- Thomas
>> > _______________________________________________
>> > gnhlug-discuss mailing list
>> > gnhlug-discuss at mail.gnhlug.org
>> > http://mail.gnhlug.org/mailman/listinfo/gnhlug-discuss/ 
>> 
>> _______________________________________________
>> gnhlug-discuss mailing list
>> gnhlug-discuss at mail.gnhlug.org
>> http://mail.gnhlug.org/mailman/listinfo/gnhlug-discuss/
>> 
>> 
> 
> _______________________________________________
> gnhlug-discuss mailing list
> gnhlug-discuss at mail.gnhlug.org
> http://mail.gnhlug.org/mailman/listinfo/gnhlug-discuss/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.gnhlug.org/mailman/private/gnhlug-discuss/attachments/20070925/ef5e55af/attachment-0001.html 


More information about the gnhlug-discuss mailing list