From: Bjorn Helgaas <helgaas@kernel.org>
To: Mark Tomlinson <Mark.Tomlinson@alliedtelesis.co.nz>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"lorenzo.pieralisi@arm.com" <lorenzo.pieralisi@arm.com>,
"f.fainelli@gmail.com" <f.fainelli@gmail.com>,
"rjui@broadcom.com" <rjui@broadcom.com>,
"robh@kernel.org" <robh@kernel.org>,
"sbranden@broadcom.com" <sbranden@broadcom.com>,
"linux-pci@vger.kernel.org" <linux-pci@vger.kernel.org>,
"bhelgaas@google.com" <bhelgaas@google.com>
Subject: Re: [PATCH 2/3] PCI: iproc: Stop using generic config read/write functions
Date: Thu, 30 Jul 2020 18:06:15 -0500 [thread overview]
Message-ID: <20200730230615.GA2083229@bjorn-Precision-5520> (raw)
In-Reply-To: <5ee5e0f76435883d6f5eec9f6483e283e2e652e0.camel@alliedtelesis.co.nz>
On Thu, Jul 30, 2020 at 10:58:03PM +0000, Mark Tomlinson wrote:
> On Thu, 2020-07-30 at 11:09 -0500, Bjorn Helgaas wrote:
> > I think it would be better to have a warning once per device, so if
> > XYZ device has a problem and we look at the dmesg log, we would find a
> > single message for device XYZ as a hint. Would that reduce the
> > nuisance level enough?
>
> We would be OK with that.
>
> > So I think I did it wrong in fb2659230120 ("PCI: Warn on possible RW1C
> > corruption for sub-32 bit config writes"). Ratelimiting is the wrong
> > concept because what we want is a single warning per device, not a
> > limit on the similar messages for *all* devices, maybe something like
> > this:
> >
> > diff --git a/drivers/pci/access.c b/drivers/pci/access.c
> > index 79c4a2ef269a..e5f956b7e3b7 100644
> > --- a/drivers/pci/access.c
> > +++ b/drivers/pci/access.c
> > @@ -160,9 +160,12 @@ int pci_generic_config_write32(struct pci_bus *bus, unsigned int devfn,
> > * write happen to have any RW1C (write-one-to-clear) bits set, we
> > * just inadvertently cleared something we shouldn't have.
> > */
> > - dev_warn_ratelimited(&bus->dev, "%d-byte config write to %04x:%02x:%02x.%d offset %#x may corrupt adjacent RW1C bits\n",
> > + if (!(bus->unsafe_warn & (1 << devfn))) {
> > + dev_warn(&bus->dev, "%d-byte config write to %04x:%02x:%02x.%d offset %#x may corrupt adjacent RW1C bits\n",
> > size, pci_domain_nr(bus), bus->number,
> > PCI_SLOT(devfn), PCI_FUNC(devfn), where);
> > + bus->unsafe_warn |= 1 << devfn;
> > + }
>
> As I understand it, devfn is an 8-bit value with five bits of device
> and three bits of function. So (1 << devfn) is not going to fit in an
> 8-bit mask. Am I missing something here? (I do admit that my PCI
> knowledge is not great).
You're not missing anything, I just screwed up. What I was really
*hoping* to do was just put a bit in the pci_dev, but of course, these
functions don't have a pci_dev. 256 bits in the bus seems like a
little overkill though. Maybe we just give up on the exact device and
warn only once per *bus* instead of once per device.
Bjorn
next prev parent reply other threads:[~2020-07-30 23:06 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-30 3:37 [PATCH 1/3] PCI: iproc: Add bus number parameter to read/write functions Mark Tomlinson
2020-07-30 3:37 ` [PATCH 2/3] PCI: iproc: Stop using generic config " Mark Tomlinson
2020-07-30 16:09 ` Bjorn Helgaas
2020-07-30 16:36 ` Ray Jui
2020-07-30 16:45 ` Bjorn Helgaas
2020-07-30 22:58 ` Mark Tomlinson
2020-07-30 23:06 ` Bjorn Helgaas [this message]
2020-07-30 3:37 ` [PATCH 3/3] PCI: iproc: Set affinity mask on MSI interrupts Mark Tomlinson
2020-07-30 16:45 ` Ray Jui
2020-07-30 17:07 ` Scott Branden
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=20200730230615.GA2083229@bjorn-Precision-5520 \
--to=helgaas@kernel.org \
--cc=Mark.Tomlinson@alliedtelesis.co.nz \
--cc=bhelgaas@google.com \
--cc=f.fainelli@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=lorenzo.pieralisi@arm.com \
--cc=rjui@broadcom.com \
--cc=robh@kernel.org \
--cc=sbranden@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