All of lore.kernel.org
 help / color / mirror / Atom feed
From: Benjamin Herrenschmidt <benh@au1.ibm.com>
To: Gavin Shan <gwshan@linux.vnet.ibm.com>
Cc: Bjorn Helgaas <helgaas@kernel.org>,
	bhelgaas@google.com, linux-pci@vger.kernel.org,
	clsoto@us.ibm.com, linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCH] PCI: Add parameter @mmio_force_on to pci_update_resource()
Date: Wed, 28 Sep 2016 10:06:44 +1000	[thread overview]
Message-ID: <1475021204.2857.302.camel@au1.ibm.com> (raw)
In-Reply-To: <20160927233749.GA19797@gwshan>

On Wed, 2016-09-28 at 09:37 +1000, Gavin Shan wrote:
> 
> Yeah, it's safe to update it with memory decoding on. As the function call
> flow I listed in the changelog (as below), nobody should access the IOV BAR
> when pci_update_resource() is called. However, the PF's memory BARs might
> be accessed that time and it's not safe to disable PF's memory decoding.

The problem isn't so much whether anybody accesses the IOV BAR while
it's updated but whether the IOV BAR will decode at all.

IE. The BAR is updated in two steps, 32-bit each. That means that there
is a window where it contains a "bogus" value.

If that bogus value conflicts with another BAR (another BAR of the  PF
or another PF of the same device for example) then there is a risk of
something bad happening if the driver accesses that conflicting
resource during that window.

On the other hand, if the IOV BAR doesn't decode at all while the
update is done, which I think is the case as I believe SR-IOV isn't
enabled during the update (please verify), then we are safe.

Cheers,
Ben.

  reply	other threads:[~2016-09-28  0:06 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-18 23:53 [PATCH] PCI: Add parameter @mmio_force_on to pci_update_resource() Gavin Shan
2016-09-26 23:43 ` Gavin Shan
2016-09-27 19:20 ` Bjorn Helgaas
2016-09-27 21:45   ` Benjamin Herrenschmidt
2016-09-27 23:37     ` Gavin Shan
2016-09-28  0:06       ` Benjamin Herrenschmidt [this message]
2016-09-28  1:14         ` Gavin Shan
2016-09-29 23:45           ` Gavin Shan

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=1475021204.2857.302.camel@au1.ibm.com \
    --to=benh@au1.ibm.com \
    --cc=bhelgaas@google.com \
    --cc=clsoto@us.ibm.com \
    --cc=gwshan@linux.vnet.ibm.com \
    --cc=helgaas@kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.