Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1160392 > unrolled thread

Re: [RFC Patch V1] ioatdma: Ignore IOAT devices under hotplug-capable PCI host bridge

Started byVinod Koul <vinod.koul@intel.com>
First post2015-06-08 12:50 +0200
Last post2015-06-08 13:50 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [RFC Patch V1] ioatdma: Ignore IOAT devices under  hotplug-capable PCI host bridge Vinod Koul <vinod.koul@intel.com> - 2015-06-08 12:50 +0200
    Re: [RFC Patch V1] ioatdma: Ignore IOAT devices under hotplug-capable  PCI host bridge Jiang Liu <jiang.liu@linux.intel.com> - 2015-06-08 13:50 +0200

#1160392 — Re: [RFC Patch V1] ioatdma: Ignore IOAT devices under hotplug-capable PCI host bridge

FromVinod Koul <vinod.koul@intel.com>
Date2015-06-08 12:50 +0200
SubjectRe: [RFC Patch V1] ioatdma: Ignore IOAT devices under hotplug-capable PCI host bridge
Message-ID<pz2MV-4vP-3@gated-at.bofh.it>
On Tue, Jun 02, 2015 at 02:37:31PM +0800, Jiang Liu wrote:
> Ccing Rafael, it's ACPI hotplug related.
> 
> On 2015/6/2 14:36, Jiang Liu wrote:
> > The dmaengine core assumes that async DMA devices will only be removed
> > when they not used anymore, or it assumes dma_async_device_unregister()
> > will only be called by dma driver exit routines. But this assumption is
> > not true for the IOAT driver, which calls dma_async_device_unregister()
> > from ioat_remove(). So current IOAT driver doesn't support device
> > hot-removal because it may cause system crash to hot-remove an inuse
> > IOAT device.
> > 
> > To support CPU socket hot-removal, all PCI devices, including IOAT
> > devices embedded in the socket, will be hot-removed. The idea solution
> > is to enhance the dmaengine core and IOAT driver to support hot-removal,
> > but that's too hard.
> > 
> > This patch implements a hack to disable IOAT devices under hotplug-capable
> > CPU socket so it won't break socket hot-removal.
> > 
So below looks okay though I wonder how hard would it be to fix hot unplug ?

-- 
~Vinod

> > Signed-off-by: Jiang Liu <jiang.liu@linux.intel.com>
> > ---
> >  drivers/dma/ioat/pci.c |   34 ++++++++++++++++++++++++++++++++++
> >  1 file changed, 34 insertions(+)
> > 
> > diff --git a/drivers/dma/ioat/pci.c b/drivers/dma/ioat/pci.c
> > index 76f0dc688a19..3b8c9b03f4b3 100644
> > --- a/drivers/dma/ioat/pci.c
> > +++ b/drivers/dma/ioat/pci.c
> > @@ -27,6 +27,7 @@
> >  #include <linux/interrupt.h>
> >  #include <linux/dca.h>
> >  #include <linux/slab.h>
> > +#include <linux/acpi.h>
> >  #include "dma.h"
> >  #include "dma_v2.h"
> >  #include "registers.h"
> > @@ -148,6 +149,34 @@ alloc_ioatdma(struct pci_dev *pdev, void __iomem *iobase)
> >  	return d;
> >  }
> >  
> > +/*
> > + * The dmaengine core assumes that async DMA devices will only be removed
> > + * when they not used anymore, or it assumes dma_async_device_unregister()
> > + * will only be called by dma driver exit routines. But this assumption is
> > + * not true for the IOAT driver, which calls dma_async_device_unregister()
> > + * from ioat_remove(). So current IOAT driver doesn't support device
> > + * hot-removal because it may cause system crash to hot-remove inuse IOAT
> > + * devices.
> > + *
> > + * This is a hack to disable IOAT devices under ejectable PCI host bridge
> > + * so it won't break PCI host bridge hot-removal.
> > + */
> > +static bool ioat_pci_has_ejectable_acpi_ancestor(struct pci_dev *pdev)
> > +{
> > +#ifdef CONFIG_ACPI
> > +	struct pci_bus *bus = pdev->bus;
> > +	struct acpi_device *adev;
> > +
> > +	while (bus->parent)
> > +		bus = bus->parent;
> > +	for (adev = ACPI_COMPANION(bus->bridge); adev; adev = adev->parent)
> > +		if (adev->flags.ejectable)
> > +			return true;
> > +#endif
> > +
> > +	return false;
> > +}
> > +
> >  static int ioat_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
> >  {
> >  	void __iomem * const *iomap;
> > @@ -155,6 +184,11 @@ static int ioat_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
> >  	struct ioatdma_device *device;
> >  	int err;
> >  
> > +	if (ioat_pci_has_ejectable_acpi_ancestor(pdev)) {
> > +		dev_dbg(&pdev->dev, "ignore ejectable IOAT device.\n");
> > +		return -ENODEV;
> > +	}
> > +
> >  	err = pcim_enable_device(pdev);
> >  	if (err)
> >  		return err;
> > 

-- 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1160418 — Re: [RFC Patch V1] ioatdma: Ignore IOAT devices under hotplug-capable PCI host bridge

FromJiang Liu <jiang.liu@linux.intel.com>
Date2015-06-08 13:50 +0200
SubjectRe: [RFC Patch V1] ioatdma: Ignore IOAT devices under hotplug-capable PCI host bridge
Message-ID<pz3IZ-5SA-1@gated-at.bofh.it>
In reply to#1160392
On 2015/6/8 18:42, Vinod Koul wrote:
> On Tue, Jun 02, 2015 at 02:37:31PM +0800, Jiang Liu wrote:
>> Ccing Rafael, it's ACPI hotplug related.
>>
>> On 2015/6/2 14:36, Jiang Liu wrote:
>>> The dmaengine core assumes that async DMA devices will only be removed
>>> when they not used anymore, or it assumes dma_async_device_unregister()
>>> will only be called by dma driver exit routines. But this assumption is
>>> not true for the IOAT driver, which calls dma_async_device_unregister()
>>> from ioat_remove(). So current IOAT driver doesn't support device
>>> hot-removal because it may cause system crash to hot-remove an inuse
>>> IOAT device.
>>>
>>> To support CPU socket hot-removal, all PCI devices, including IOAT
>>> devices embedded in the socket, will be hot-removed. The idea solution
>>> is to enhance the dmaengine core and IOAT driver to support hot-removal,
>>> but that's too hard.
>>>
>>> This patch implements a hack to disable IOAT devices under hotplug-capable
>>> CPU socket so it won't break socket hot-removal.
>>>
> So below looks okay though I wonder how hard would it be to fix hot unplug ?
Hi Vinod,
	Thanks for review. About three years ago I worked out a
patch set to enhance the dmaengine core and ioat device driver to
support hot-removal. But it has been rejected due to concerns about
performance penalty caused by usage tracking.
	To support hot-removal, we need to track dma channel usage
and a way to reclaim dma channels when hot-removing. This may cause
sensible performance penalty. Recently I have tried again but still
haven't find a way to support hot-removal. So eventually I suggest
to disable IOAT device on hot-plug capable systems.
Thanks!
Gerry
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web