linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Hari Vyas <hari.vyas@broadcom.com>
To: Lukas Wunner <lukas@wunner.de>
Cc: Bjorn Helgaas <bhelgaas@google.com>,
	benh@kernel.crashing.org, linux-pci@vger.kernel.org,
	Ray Jui <ray.jui@broadcom.com>
Subject: Re: [PATCH v2 1/3] PCI: Data corruption happening due to race condition
Date: Mon, 2 Jul 2018 19:50:39 +0530	[thread overview]
Message-ID: <CAM5rFu9yysO2vX0JrjVExURjLuRPR_WVuPRG5C6MfP177H5UOA@mail.gmail.com> (raw)
In-Reply-To: <20180701140634.GA22322@wunner.de>

On Sun, Jul 1, 2018 at 7:36 PM, Lukas Wunner <lukas@wunner.de> wrote:
> On Fri, Jun 29, 2018 at 03:57:39PM +0530, Hari Vyas wrote:
>> Fix moves device addition is_added bit to separate private flag
>> variable and use different atomic functions to set, clear and
>> retrieve device addition state. As is_added shares different
>> memory location so race condition is avoided.
>
> As 0-day has already discovered, you need to squash all 3 patches
> together to avoid breaking the build.
>
>
Agreed. I will squash and raise a new patch
>> +static inline int pci_dev_set_added(struct pci_dev *dev, void *unused)
>> +{
>> +     set_bit(PCI_DEV_ADDED, &dev->priv_flags);
>> +     return 0;
>> +}
>> +
>> +static inline int pci_dev_clear_added(struct pci_dev *dev, void *unused)
>> +{
>> +     clear_bit(PCI_DEV_ADDED, &dev->priv_flags);
>> +     return 0;
>> +}
>
> You don't need the "unused" parameter here and you can return void.
> pci_dev_set_disconnected() has the parameter because the function is
> passed in to pci_walk_bus() in a few places, but you're not doing that
> AFAICS.
>
> What you *could* do however is collapse pci_dev_set_added() and
> pci_dev_clear_added() into a single function, pass in a bool "added",
> then use assign_bit() to set or clear it.  It would save 6 LoC.
>
Agreed.  Just for symmetry I did that one. Will incorporate change.
> Thanks,
>
> Lukas

  reply	other threads:[~2018-07-02 14:20 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-29 10:27 [PATCH v2 0/3] PCI: Data corruption happening due to race condition Hari Vyas
2018-06-29 10:27 ` [PATCH v2 1/3] " Hari Vyas
2018-06-29 14:38   ` kbuild test robot
2018-06-29 18:22   ` kbuild test robot
2018-07-01 14:06   ` Lukas Wunner
2018-07-02 14:20     ` Hari Vyas [this message]
2018-06-29 10:27 ` [PATCH v2 2/3] PCI: use new pci function to get device addition state Hari Vyas
2018-06-29 10:27 ` [PATCH v2 3/3] PCI: Hotplug: " Hari Vyas

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=CAM5rFu9yysO2vX0JrjVExURjLuRPR_WVuPRG5C6MfP177H5UOA@mail.gmail.com \
    --to=hari.vyas@broadcom.com \
    --cc=benh@kernel.crashing.org \
    --cc=bhelgaas@google.com \
    --cc=linux-pci@vger.kernel.org \
    --cc=lukas@wunner.de \
    --cc=ray.jui@broadcom.com \
    /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).