Received: by 2002:a25:ca44:0:0:0:0:0 with SMTP id a65csp2293162ybg; Thu, 30 Jul 2020 16:06:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy4G7j8ECcFOsuR5nvKlrJxyvfho8wHJ/2u2kBZCKDcrQNv87uFY0CUBsHIOOSafPPhs72O X-Received: by 2002:a17:906:a284:: with SMTP id i4mr1432511ejz.490.1596150409940; Thu, 30 Jul 2020 16:06:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596150409; cv=none; d=google.com; s=arc-20160816; b=Y7ofwNNFZyEXITHc8lyoN4QghM8x7FzksoKgw/7EN5Wm7OgxZhOMMTKeirZ4dlQtHS xazvGOKwUW0QjQ1xCO7p5qn3t9sE6VZON9jhJlYK+iJN6GLv6ew54qm+bOivFkxD1q7E 1lvBBDsYNDSdUHXKw8Z4O/ZrduptOA5uO+ok55vUGtZRJxhFz7HNEfSwfhmlrEf1Ckc0 /yO3vGAyPwmBmQuaecc1wIO5iuNghg0zinhcOF/49wLB61h+XWZ56b1vQIA+C+muiYk6 h6dOU+JpSxqzROzQaxqFbPSC9dAHyopZXRnNFnh4tCg5svKar1TRpdLsRR+Opz6t7PZ3 jJBg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:message-id:subject:cc:to:from:date:dkim-signature; bh=4yvJI0m2VxJk+3SrjjIgtha+wvslxI96AruABBoU/BM=; b=OlKEABM0Td+4+EBJIsfqqUGPag5yMoBbYEAqKni39JbC4+t8hG46BZpCFwiIDZuEMn uzfOQj+2t3WRhNs/HOV/8vdnO4Ow05aw4Lgcdt/iWXXYRBzdS1ijvFneR2Y2CbuZl2De bZhwUyOkPmqOL+albwR9FpumFcrBrF66+50PyMta0GhPCYWwf9BD5R4japmG3nEZg85T eU2X1xqoU9M1EV6avpfD4L5ON8fwP/pXwcvZthsqWC6FCvfkDmmPgSvCk5NLR9aytvoI 3bq/b7pCQ6rLF8MCykV8YRAw2NCtDKbKn8ObQWrsHIIsal2cr645AMrw2wIZeK5Vt06+ tVjQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=DHbDdVv+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q7si3808637ejc.460.2020.07.30.16.06.28; Thu, 30 Jul 2020 16:06:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=DHbDdVv+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730644AbgG3XGT (ORCPT + 99 others); Thu, 30 Jul 2020 19:06:19 -0400 Received: from mail.kernel.org ([198.145.29.99]:51986 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730237AbgG3XGS (ORCPT ); Thu, 30 Jul 2020 19:06:18 -0400 Received: from localhost (mobile-166-175-186-42.mycingular.net [166.175.186.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 8259520809; Thu, 30 Jul 2020 23:06:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1596150377; bh=XZAB7/fZnfkuIRM5weyfnSOH4dtm24JM37i8kd8fb0g=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=DHbDdVv+1PCE/WJLTW/9fb3yTUFE9kW0cHEGToZto8khqHM/ecQfNJw2QX7JXdaxP HJFyN96WLztU5Pf0s5zoPgR/8mqQtXIW7iLFizB0XFahKVj7uBYMWB218OVfObaZlr LDwfHJ+EOq8X6dfw+7K1sQBNLgbWmBHsqjKQWjAA= Date: Thu, 30 Jul 2020 18:06:15 -0500 From: Bjorn Helgaas To: Mark Tomlinson Cc: "linux-kernel@vger.kernel.org" , "lorenzo.pieralisi@arm.com" , "f.fainelli@gmail.com" , "rjui@broadcom.com" , "robh@kernel.org" , "sbranden@broadcom.com" , "linux-pci@vger.kernel.org" , "bhelgaas@google.com" Subject: Re: [PATCH 2/3] PCI: iproc: Stop using generic config read/write functions Message-ID: <20200730230615.GA2083229@bjorn-Precision-5520> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5ee5e0f76435883d6f5eec9f6483e283e2e652e0.camel@alliedtelesis.co.nz> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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