Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753257AbdHRNmu (ORCPT ); Fri, 18 Aug 2017 09:42:50 -0400 Received: from mail-dm3nam03on0076.outbound.protection.outlook.com ([104.47.41.76]:43319 "EHLO NAM03-DM3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751107AbdHRNmr (ORCPT ); Fri, 18 Aug 2017 09:42:47 -0400 Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Jan.Glauber@cavium.com; Date: Fri, 18 Aug 2017 15:42:31 +0200 From: Jan Glauber To: Alex Williamson Cc: Bjorn Helgaas , linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, david.daney@cavium.com, Jon Masters , Robert Richter , linux-arm-kernel@lists.infradead.org, kvm@vger.kernel.org Subject: Re: [PATCH v2 3/3] vfio/pci: Don't probe devices that can't be reset Message-ID: <20170818134231.GA3464@hc> References: <1502957663-5527-1-git-send-email-jglauber@cavium.com> <1502957663-5527-4-git-send-email-jglauber@cavium.com> <20170817070017.1e9c9456@w520.home> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170817070017.1e9c9456@w520.home> User-Agent: Mutt/1.5.21 (2010-09-15) X-Originating-IP: [88.67.130.225] X-ClientProxiedBy: DB6PR1001CA0032.EURPRD10.PROD.OUTLOOK.COM (10.168.69.146) To BN3PR07MB2579.namprd07.prod.outlook.com (10.167.5.7) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: bcf32fdc-bb1f-4a76-6b5f-08d4e63f00d4 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(22001)(300000502095)(300135100095)(2017030254152)(300000503095)(300135400095)(201703131423075)(201703031133081)(201702281549075)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095);SRVR:BN3PR07MB2579; X-Microsoft-Exchange-Diagnostics: 1;BN3PR07MB2579;3:i4hyuXKY94DWeyHN3iia/cSwT44YyfYM2hCyQd0bwfEBYJm+SmYL2v0GmFJal74OLB9vvsBggNecD4fNQwlb4yMWAuGTR0md0N9VM6db05HJ4DpLiwa5d40xry+ImHouYVDkrZ5jqCrlP/XvSnvA+4r8u+FarZVd3BosKziAufkwDyiRPlLz6t52TR8BnLYjFU6mGFF5SXvelJigAiGAB0hcMPBLNNK55xbrMPL7GaKY/4XawU2DwYoUIrHB5Z93;25:agh+13Pt0HSiwygLD2qLPOe7pIOtl1QF+sR9u4nyPelWY9CkusfElw/1K8G7UHsg1k26S1mRUimeKdQEereHV6igae5otp+XehARs2Fyby63t4zMEZbgChIvHJAX3VjZQf25wzjYG/WW9ueRaXOo8QxyvkJm3qA7AgErdI2nwOPhx81doTzbKYEj3py1sEsCwDIK+S1zNjcR481EUmVPO+Pi6XGMaL86cNzWtSriIIBL1X3W8cB2soEp1a3GZrrGSfnCN5ya2t83dm78PiWLEI3B7bGZ2IUZhHBVIkaddZLqrCplT7s4FIQyZfgTX2Y7HLIuxrK/Ct7ADaxJQdAbfg==;31:xqOdqvuhKE0+Epnm/QkvsoF3nQlJwM7dtATGySx0skarsNiMmUcvcw75xWxl9rjXappAgu9iSZ6Ssz0+VlJ4l1ZVTEEk3HUwN3KA99qHYYMG+BVkBnbywtLvdXTMQgx0bBEiwRTKlk51eBSBf3RiMa400QEzqO46BdlgOFdZqllnf/6RmzfEPkJO8BU9X5n9xudhjJWUTPFGzTAaou3G8qRJmvrtk2SorPEvt6OtIZM= X-MS-TrafficTypeDiagnostic: BN3PR07MB2579: X-Microsoft-Exchange-Diagnostics: 1;BN3PR07MB2579;20:WqEAzHziTOu6a2EC+60VSTPA//x8eR2U4m049kwO/B8rjazfi7O7xdU1okaAI8FVbRDX5/9fJsctxlI1ndbSnyAZ/RgUw7BTNEZtl+AF0IR61I6dOXBUG02IVbAbYgVb5TlxjQoWHOr4b/zrIqM43zDf0+0TAZbpZNhNzi8uuMYEZTU0Adeb36PQeSFbwgKRQ/pXk2rNEpzkHPe++K6EwZm96LVxQjX4PDUaZtayN3wH6JIVYhtTTS38lVIjImXyEEYmikjFQQJvBUU1l4AXma4gR4XXJzTDE9bdliosxNToWHIjt7d+D2GX4kqzqYeUQIlbQxHfxW1X3frWEkFXOwPjFwIfH8fC0ZBaXc8l0NkGiHF8RSl7NknuiyeZ467acO5HjG8AgA+lrWWmR/Vwz/j70BMmxa29MXL8sB5u5dA4k6SGzSQDPqkd11hpEAy0O13JJivBVqDqOYSsrn17LpnlkMK60VKduW9vn9QDSM6zK3NRmBShC+90eKRdr34riI0VrqSlkWcz2d6+UogtVX7qtaxcmtUMTEyOF8wXpjUMoT0K9iCCycW+L5dzwLSXBG+lQJkdblpFkOXzzum/3MAUIiMkQwK7g8fcIj0x62M=;4:iEUTKzvnS7593lcxn90udOz2PCF8f8E1RcHDWOgSp4jq2OMl0VakjORvDpJkvgllrVinVVnnwReE1u+pp8osFLJ/HZ25oZWLww30lFJysA4UciHEzmGtb5ICZF55+SyulIoE8OggEzb/JuHqnoIYeKFpLjqOrTEf03p9e49wiv/BgtngAGeLA2Cdxs1NjGeiLAS9yAgyZkL4FoPE61moWDzz1z9wwFfH0I0EfXtUySpi+fHwmbcSuO9Csbd97Fcy X-Exchange-Antispam-Report-Test: UriScan:; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(601004)(2401047)(8121501046)(5005006)(3002001)(93006095)(100000703101)(100105400095)(10201501046)(6041248)(20161123555025)(20161123564025)(20161123558100)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123562025)(20161123560025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095);SRVR:BN3PR07MB2579;BCL:0;PCL:0;RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095);SRVR:BN3PR07MB2579; X-Forefront-PRVS: 040359335D X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(7370300001)(4630300001)(979002)(6009001)(189002)(24454002)(199003)(6666003)(478600001)(110136004)(66066001)(47776003)(68736007)(53936002)(5660300001)(7736002)(3846002)(50466002)(6116002)(83506001)(1076002)(23726003)(305945005)(7350300001)(50986999)(189998001)(81166006)(8676002)(81156014)(101416001)(76176999)(54356999)(97736004)(42186005)(33656002)(72206003)(6246003)(4326008)(2950100002)(25786009)(42882006)(6916009)(6496005)(229853002)(55016002)(33716001)(2906002)(106356001)(54906002)(4001350100001)(9686003)(105586002)(18370500001)(969003)(989001)(999001)(1009001)(1019001);DIR:OUT;SFP:1101;SCL:1;SRVR:BN3PR07MB2579;H:hc;FPR:;SPF:None;PTR:InfoNoRecords;MX:1;A:1;LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;BN3PR07MB2579;23:oF0Xq8YcdzEBuLSxMR1rwD988022ACIP0M7DgUYEb?= =?us-ascii?Q?j5Kk7cfevm3MO4gWUTK1l/6s+OXvvuOvz5fEr2trzepe0cQoXcQ5RPMsJVzP?= =?us-ascii?Q?nIyS6METZyqrvJwfM1PJEHQ6ramVYthvXG3cnE4mJWSyjrdRrwyByyZP9fQO?= =?us-ascii?Q?6MwxFesJ5OadzUTqO8QoYo7M+aFIcnC4msIZ7wuYoVWkCArDkoo0y/YbMofF?= =?us-ascii?Q?Ny3qTOjiK6pPK5WfUxxhIwq/ce/20VnXzTMERW8MERTJsUzMB3Hz6D/NsRcV?= =?us-ascii?Q?ywjgpx67LQClY9xFFNyVMTsOvwOdVycgo2exiiZ7ld0nfFmc+2zqBDptpgvP?= =?us-ascii?Q?mHOAIkoQ/PvkRUXs2zrBrwZcMnTgpVxpnx9NPLQRImFYVrv8V7CvGhJxQkIV?= =?us-ascii?Q?Jet34Ca3O9ly09Oh1Hq0ciCJp1aUHMDRnGPkQ5XCqELJbUALaX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bG4sPFcefbId5aHFFKOCKZJcJ2ZZXk?= =?us-ascii?Q?Fh4Iw=3D=3D?= X-Microsoft-Exchange-Diagnostics: 1;BN3PR07MB2579;6:hpMkrbpwOICN1ZEU5zcnZSQN8msztHXEBgWOle+bMgcOZNy6r4TK3s4YMvtD0NMnKMyKjD19ZnRkyMjiZiD50oM2Env3ccyAXr7D5NHcmNUUCYcbjY3k6jBZeMOV0PafWdHxkQliBpV2K8beiUma26oa8nuaBZtT/Og8M/DLn3/0Flu/sbtA8NjgRF3tLO+Y6JQT8ThTvJLT+3QEsNvxK0y25nPFiP5andSANa8zSnMXML3UmeIXLCLFGkW6E3DSGLCjNHuzPtv8Vv9LGPSMH0MQttmK0MLenKrXuOwJaR28T9+hF8lBdhwWZPi45N4B0ZrJDHOREDiJwxAAvU7Z9Q==;5:PquiGo0mZFWJPG/yUjmmeI7Xo/FYxpCiGcPSl2IapEilPU1hmoP+F0S0+/khUmOxLl5fXLaZWf6d6nMLAGVYVwy/lPbu/fPQsr6iySrq52BzljEAmWDtmiawx71V4g9BmVp26lOkyoJYaXxGaRadmA==;24:FSgq8zD93iZaf+tEIbo/qTZMXP6GjpVyRUOu4tvfZfi7ik45F0OTa3xItXKHHbSj6vLxaVjxQB1O5H2hQIKQ8Fc1U4xiEW8l4gCIWHvdHEk=;7:6+AJHxmIk17RSmS6A6sDVWn08T2QEokhCeZrEN/vIPKWNSx0nRTjezd5GdUg+Err+A8crebly2yKHCaokb9V9UJUjTq1Q+Yuwi4s1tV9BVgOGJQsxhY45loKQyjvUXO61WOtkxt+bnEKDcmw1M9g+NuFDFrcS5FcQtlF9pBldq8uBrCPkzj6VnZNBKePo9ZYhmBayx0LEFTHwKFWlfJCF4U3FnkjRexkf95akb0j+sg= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Aug 2017 13:42:41.8556 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN3PR07MB2579 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1826 Lines: 54 On Thu, Aug 17, 2017 at 07:00:17AM -0600, Alex Williamson wrote: > On Thu, 17 Aug 2017 10:14:23 +0200 > Jan Glauber wrote: > > > If a PCI device supports neither function-level reset, nor slot > > or bus reset then refuse to probe it. A line is printed to inform > > the user. > > But that's not what this does, this requires that the device is on a > reset-able bus. This is a massive regression. With this we could no > longer assign devices on the root complex or any device which doesn't > return from bus reset and currently makes use of the NO_BUS_RESET flag > and works happily otherwise. Full NAK. Thanks, Looks like I missed the slot reset check. So how about this: if (pci_probe_reset_slot(pdev->slot) && pci_probe_reset_bus(pdev->bus)) { dev_warn(...); return -ENODEV; } Or am I still missing something here? thanks, Jan > Alex > > > Without this change starting qemu with a vfio-pci device can lead to > > a kernel panic on some Cavium cn8xxx systems, depending on the used > > device. > > > > Signed-off-by: Jan Glauber > > --- > > drivers/vfio/pci/vfio_pci.c | 6 ++++++ > > 1 file changed, 6 insertions(+) > > > > diff --git a/drivers/vfio/pci/vfio_pci.c b/drivers/vfio/pci/vfio_pci.c > > index 063c1ce..029ba13 100644 > > --- a/drivers/vfio/pci/vfio_pci.c > > +++ b/drivers/vfio/pci/vfio_pci.c > > @@ -1196,6 +1196,12 @@ static int vfio_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) > > if (pdev->hdr_type != PCI_HEADER_TYPE_NORMAL) > > return -EINVAL; > > > > + ret = pci_probe_reset_bus(pdev->bus); > > + if (ret) { > > + dev_warn(&pdev->dev, "Refusing to probe because reset is not possible.\n"); > > + return ret; > > + } > > + > > group = vfio_iommu_group_get(&pdev->dev); > > if (!group) > > return -EINVAL;