From mboxrd@z Thu Jan 1 00:00:00 1970 From: Kenji Kaneshige Date: Mon, 08 Mar 2010 08:24:27 +0000 Subject: Re: How does Linux handle PCI-E Surprise unplug? Message-Id: <4B94B43B.7060202@jp.fujitsu.com> List-Id: References: <8506939B503B404A84BBB12293FC45F606B883BA@emailbng3.jnpr.net> In-Reply-To: <8506939B503B404A84BBB12293FC45F606B883BA@emailbng3.jnpr.net> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: linux-hotplug@vger.kernel.org Rajat Jain wrote: > Hello Greg / All, > > Replying on this thread as I have a small query left regarding this... > >> -----Original Message----- >> From: Greg KH [mailto:greg@kroah.com] >> Sent: Thursday, February 18, 2010 8:23 PM >> To: Rajat Jain >> Cc: linux-hotplug@vger.kernel.org; linux-pci@vger.kernel.org >> Subject: Re: How does Linux handle PCI-E Surprise unplug? >> >> On Thu, Feb 18, 2010 at 11:35:33AM +0530, Rajat Jain wrote: >>> Hi, >>> >>> I'm keen to understand how the Linux kernel handles surprise removal > of >>> a device, from a PCI-e slot that supports "Hot-plug Surprise" > removal >>> (in slot capabilities). >>> >>> Consider that the device in the slot is working normally, with its >>> driver attached to the device, and is doing all sorts of read / > write >>> operations on the device registers that have been mapped into the > PCI >>> memory space. Now when that device is suddenly plugged out (and thus > its >>> registers suddenly disappear from the PCI memory space), the device >>> driver is still unaware as it is doing the register reads / writes > on >>> the device. At this point, IMHO any attempt to access the device >>> registers will result in an exception (BUS error?) as the device is >>> gone. Correct? >> The driver will suddenly start reading all 0xff and will then need to >> abort whatever it was doing. Usually all drivers handle this just > fine >> today, as this is what they needed to do when they were pccard > devices. >> Nothing new here at all. >> > > Does that mean accessing PCI memory mapped registers for a non-existent > device has effects that are localized ONLY to the driver of that device? > In other words, kernel does not notice or does not even become AWARE > that a driver is trying to access non-existent memory mapped registers? > > So trying to access a HW that does not exist is totally legal in that > sense? Is HW NOT supposed to generate an error in this case - as far as > I had read, any access to non existent physical addresses should result > in a bus error ... no? This will cause Unsupported Request Error. But how it is handled depends on platform, I think. Thanks, Kenji Kaneshige