linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Jiang, Dave" <dave.jiang@intel.com>
To: Jiang Liu <jiang.liu@linux.intel.com>
Cc: "Williams, Dan J" <dan.j.williams@intel.com>,
	"Koul, Vinod" <vinod.koul@intel.com>,
	Jarkko Nikula <jarkko.nikula@linux.intel.com>,
	"David Woodhouse" <dwmw2@infradead.org>,
	"Luck, Tony" <tony.luck@intel.com>,
	"x86@kernel.org" <x86@kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"dmaengine@vger.kernel.org" <dmaengine@vger.kernel.org>
Subject: Re: [RFC Patch V1] ioatdma: Ignore IOAT devices under hotplug-capable PCI host bridge
Date: Mon, 29 Jun 2015 02:26:38 +0000	[thread overview]
Message-ID: <5F215805-02D7-4E23-8FDC-33522BD6247B@intel.com> (raw)
In-Reply-To: <5590A9F3.6070408@linux.intel.com>


> On Jun 28, 2015, at 7:14 PM, Jiang Liu <jiang.liu@linux.intel.com> wrote:
> 
> Hi Dave,
>    Gentle Ping:) Any suggestion about this patch?
> Thanks!
> Gerry

I'm fine with it if Dan has no objections. 

>> 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.
>> 
>> 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;
>> 

      reply	other threads:[~2015-06-29  2:26 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-02  6:36 [RFC Patch V1] ioatdma: Ignore IOAT devices under hotplug-capable PCI host bridge Jiang Liu
2015-06-02  6:37 ` Jiang Liu
2015-06-08 10:42   ` Vinod Koul
2015-06-08 11:44     ` Jiang Liu
2015-06-08 15:48       ` Vinod Koul
2015-06-08 16:03         ` Jiang Liu
2015-06-08 16:23         ` Dan Williams
2015-06-29  2:14 ` Jiang Liu
2015-06-29  2:26   ` Jiang, Dave [this message]

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=5F215805-02D7-4E23-8FDC-33522BD6247B@intel.com \
    --to=dave.jiang@intel.com \
    --cc=dan.j.williams@intel.com \
    --cc=dmaengine@vger.kernel.org \
    --cc=dwmw2@infradead.org \
    --cc=jarkko.nikula@linux.intel.com \
    --cc=jiang.liu@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tony.luck@intel.com \
    --cc=vinod.koul@intel.com \
    --cc=x86@kernel.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;
as well as URLs for NNTP newsgroup(s).