From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932983AbcASS3c (ORCPT ); Tue, 19 Jan 2016 13:29:32 -0500 Received: from AUSXIPPS310.us.dell.com ([143.166.148.211]:57249 "EHLO ausxipps310.us.dell.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932371AbcASS3R convert rfc822-to-8bit (ORCPT ); Tue, 19 Jan 2016 13:29:17 -0500 DomainKey-Signature: s=smtpout; d=dell.com; c=nofws; q=dns; h=X-LoopCount0:X-IronPort-AV:From:To:CC:Date:Subject: Thread-Topic:Thread-Index:Message-ID:References: In-Reply-To:Accept-Language:Content-Language: X-MS-Has-Attach:X-MS-TNEF-Correlator:acceptlanguage: Content-Type:Content-Transfer-Encoding:MIME-Version; b=NErBsXGVX6np9E3YudheXOAAjTDjgOCh/dzfC48ax6NSIDJRD92Ls6YN 0NzSFYCcfNZM/dl27Db7zJwrcHTpBGExYjkFNCHR+nr+i3dy66yfyCszS nhGTuY++q1NSnX78Tk+NbiKnMu9P2wszT8ymGyE4zufoBz07/mPpG7Agt U=; X-LoopCount0: from 10.170.28.39 X-IronPort-AV: E=Sophos;i="5.22,318,1449554400"; d="scan'208";a="273694701" From: To: , CC: , , , , , , , Date: Tue, 19 Jan 2016 09:22:31 -0600 Subject: RE: [PATCH RFC] pci: Blacklist vpd access for buggy devices Thread-Topic: [PATCH RFC] pci: Blacklist vpd access for buggy devices Thread-Index: AdFMwvVOUG8OKNb9TbuT1p7i624AeAGCkFJ2 Message-ID: <8B8F62BE6EB1824D91A8BF961FDC40B9179D157772@AUSX7MCPS305.AMER.DELL.COM> References: <20160109010545.GA31085@localhost> <1452546789-62938-1-git-send-email-babu.moger@oracle.com>,<56943184.3060303@oracle.com> In-Reply-To: <56943184.3060303@oracle.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: acceptlanguage: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Babu Moger [babu.moger@oracle.com] Sent: Monday, January 11, 2016 4:49 PM To: bhelgaas@google.com Cc: linux-pci@vger.kernel.org; linux-kernel@vger.kernel.org; alexander.duyck@gmail.com; hare@suse.de; mkubecek@suse.com; shane.seymour@hpe.com; myron.stowe@gmail.com; VenkatKumar.Duvvuru@avago.com; Hargrave, Jordan Subject: Re: [PATCH RFC] pci: Blacklist vpd access for buggy devices Sorry. Missed Jordan. On 1/11/2016 3:13 PM, Babu Moger wrote: > Reading or Writing of PCI VPD data causes system panic. > We saw this problem by running "lspci -vvv" in the beginning. > However this can be easily reproduced by running > cat /sys/bus/devices/XX../vpd > > VPD length has been set as 32768 by default. Accessing vpd > will trigger read/write of 32k. This causes problem as we > could read data beyond the VPD end tag. Behaviour is un- > predictable when this happens. I see some other adapter doing > similar quirks(commit bffadffd43d4 ("PCI: fix VPD limit quirk > for Broadcom 5708S")) > > I see there is an attempt to fix this right way. > https://patchwork.ozlabs.org/patch/534843/ or > https://lkml.org/lkml/2015/10/23/97 > > Tried to fix it this way, but problem is I dont see the proper > start/end TAGs(at least for this adapter) at all. The data is > mostly junk or zeros. This patch fixes the issue by setting the > vpd length to 0x80. > > Also look at the threds > > https://lkml.org/lkml/2015/11/10/557 > https://lkml.org/lkml/2015/12/29/315 > > Signed-off-by: Babu Moger > --- > > NOTE: > Jordan, Are you sure all the devices in PCI_VENDOR_ID_ATHEROS and > PCI_VENDOR_ID_ATTANSIC have this problem. You have used PCI_ANY_ID. > I felt it is too broad. Can you please check. > I don't actually have that hardware, it was a bugfix for biosdevname for RedHat. We were getting 'BUG: soft lockup - CPU#0 stuck for 23s!' when attempting to read the vpd area. Certainly 0x1969:0x1026 experienced this. 09:00.0 Ethernet controller: Atheros Communications AR8121/AR8113/AR8114 Gigabit or Fast Ethernet (rev b0) Subsystem: Atheros Communications AR8121/AR8113/AR8114 Gigabit or Fast Ethernet Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx+ Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- SERR- drivers/pci/quirks.c | 41 +++++++++++++++++++++++++++++++++++++++++ > 1 files changed, 41 insertions(+), 0 deletions(-) > > diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c > index b03373f..8abcee5 100644 > --- a/drivers/pci/quirks.c > +++ b/drivers/pci/quirks.c > @@ -2123,6 +2123,47 @@ static void quirk_via_cx700_pci_parking_caching(struct pci_dev *dev) > DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_VIA, 0x324e, quirk_via_cx700_pci_parking_caching); > > /* > + * A read/write to sysfs entry ('/sys/bus/pci/devices//vpd') > + * will dump 32k of data. The default length is set as 32768. > + * Reading a full 32k will cause an access beyond the VPD end tag. > + * The system behaviour at that point is mostly unpredictable. > + * Apparently, some vendors have not implemented this VPD headers properly. > + * Adding a generic function disable vpd data for these buggy adapters > + * Add the DECLARE_PCI_FIXUP_FINAL line below with the specific with > + * vendor and device of interest to use this quirk. > + */ > +static void quirk_blacklist_vpd(struct pci_dev *dev) > +{ > + if (dev->vpd) { > + dev->vpd->len = 0; > + dev_warn(&dev->dev, "PCI vpd access has been disabled due to firmware bug\n"); > + } > +} > + > +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_LSI_LOGIC, 0x0060, > + quirk_blacklist_vpd); > +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_LSI_LOGIC, 0x007c, > + quirk_blacklist_vpd); > +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_LSI_LOGIC, 0x0413, > + quirk_blacklist_vpd); > +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_LSI_LOGIC, 0x0078, > + quirk_blacklist_vpd); > +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_LSI_LOGIC, 0x0079, > + quirk_blacklist_vpd); > +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_LSI_LOGIC, 0x0073, > + quirk_blacklist_vpd); > +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_LSI_LOGIC, 0x0071, > + quirk_blacklist_vpd); > +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_LSI_LOGIC, 0x005b, > + quirk_blacklist_vpd); > +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_LSI_LOGIC, 0x002f, > + quirk_blacklist_vpd); > +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_LSI_LOGIC, 0x005d, > + quirk_blacklist_vpd); > +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_LSI_LOGIC, 0x005f, > + quirk_blacklist_vpd); > + > +/* > * For Broadcom 5706, 5708, 5709 rev. A nics, any read beyond the > * VPD end tag will hang the device. This problem was initially > * observed when a vpd entry was created in sysfs >