Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753509AbdHWIHH (ORCPT ); Wed, 23 Aug 2017 04:07:07 -0400 Received: from mail-co1nam03on0069.outbound.protection.outlook.com ([104.47.40.69]:7616 "EHLO NAM03-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753386AbdHWIHB (ORCPT ); Wed, 23 Aug 2017 04:07:01 -0400 Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Jan.Glauber@cavium.com; Date: Wed, 23 Aug 2017 10:06:45 +0200 From: Jan Glauber To: Alex Williamson Cc: David Daney , 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: <20170823080645.GB3526@hc> References: <1502957663-5527-1-git-send-email-jglauber@cavium.com> <1502957663-5527-4-git-send-email-jglauber@cavium.com> <20170817070017.1e9c9456@w520.home> <20170818134231.GA3464@hc> <20170818081251.2bbffe56@w520.home> <20170818215553.3396d509@ul30vt.home> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170818215553.3396d509@ul30vt.home> User-Agent: Mutt/1.5.21 (2010-09-15) X-Originating-IP: [46.223.156.27] X-ClientProxiedBy: AM5PR0701CA0069.eurprd07.prod.outlook.com (10.169.145.159) To CY1PR07MB2585.namprd07.prod.outlook.com (10.167.16.135) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a384061f-916e-4172-0510-08d4e9fded3e 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)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BCgun/7f6L/rhddZT56Y+BXacdEfOGfv029oCLu5K+H+P36j1dWA4p2fp58PLMts1KDIHXfokI4O/L+j/fo41f3ZhTahKCcLNg0MpyEP2fqrU2ZsQGrXLa3dkLQLyZVn3yHh88HMQBydBH5Jnedk2d71MT0ZKDKKWznIUtOA0P/1gDoQ6kSaIsaXg5Nojj+qrSFfVqxECrSrQzL0tILIbuJH1H6M4bz6IWxadsR7Aj+jLWhKBvbtVHY8HA4IxCVEnqJYyuGQw2wIKyk6bS4XEqg3EqHR7HdkAXK1mJmV+innxM8IdI3X+4bSlpf2j81KQhxi9eu0XdzZ3KoxgFqwGy+wfb2sIzAg6pSinpGr2u7bjFB4lvAY4kfeY7AJfa9JbTpKpC2qlTx/2DlD7OjJ9Lb689awNQXJk0yTjR1V6rtiXde2ydBeFn6IdLHdtFnII4ZrfM2egj8RYxHd5q+SQ6KrU76LpBVnWHYLHyEMBFZOEn39fZuVpdnD0dgqlFpypZoFH9NUU=;4:uNqD7S3binSvPAH1xEG+j4v1dUUHsSKRkwKIKOHOTZNqB7LwWGwgmLntpyPPOZIFh0XCuu7EJ1h1U8kEXm8pyfZjAV/R7HmL2NIkAFRRV/yUccbXuRRrysF+zMPLVgt8rgTY2d+iQb021PvS1+TpvTgAFySH/S2idES2y51f5PuNy9moWx02nXfUwYMr/jZ3W3yve1pKJTSVltEH7jh0Bv3M8JlQH2i08FroKPkT5RFo192wAlzu+koOfJ0OaBR0 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)(5005006)(8121501046)(93006095)(3002001)(100000703101)(100105400095)(10201501046)(6041248)(20161123555025)(20161123562025)(20161123558100)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123560025)(20161123564025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095);SRVR:CY1PR07MB2585;BCL:0;PCL:0;RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095);SRVR:CY1PR07MB2585; X-Forefront-PRVS: 040866B734 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(4630300001)(7370300001)(6009001)(377454003)(24454002)(189002)(199003)(6246003)(81166006)(6496005)(23726003)(6116002)(50986999)(106356001)(55016002)(76176999)(54356999)(9686003)(101416001)(105586002)(54906002)(42186005)(1076002)(33716001)(25786009)(33656002)(4326008)(53546010)(53936002)(6916009)(3846002)(4001350100001)(42882006)(229853002)(189998001)(47776003)(93886005)(66066001)(7350300001)(6666003)(97736004)(72206003)(68736007)(81156014)(478600001)(8676002)(110136004)(50466002)(83506001)(305945005)(2950100002)(7736002)(2906002)(5660300001)(18370500001);DIR:OUT;SFP:1101;SCL:1;SRVR:CY1PR07MB2585;H:hc;FPR:;SPF:None;PTR:InfoNoRecords;MX:1;A:1;LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;CY1PR07MB2585;23:CFZwS59NtiJpt+KvHZ2L4Pzl7g7h10C5Sy/gkTteV?= =?us-ascii?Q?Fare6OFggJ9XrAhitLpaYaWgifsmJMN8myzVCWkMxuiyTOSaZNHPC/f0n7jN?= =?us-ascii?Q?Y9omdMUN+IOWJmbS4kHcU5O81GMULBo+ENHAddyGvCOreYtEyWbxyRFmIze+?= =?us-ascii?Q?o41u3+/Az439TDsH3ZURu8gvpW/t8ZFgnnB/WcX7u7yaVEWWPJ52o2y15D0m?= =?us-ascii?Q?H3diKO59diQBL42XRArZD0pgYjTBiDSNS3zCzcTmoY1SQxxM8EoaSjgjifMt?= =?us-ascii?Q?k6fz4rwtnX5E8qfiDPSIIyLEkuiT7ZV8MhFQq8KeigW9Ims8c3ME+vPvRk55?= =?us-ascii?Q?DV5HRGMK1SMxHE1GS+1JnlvXEAU3TWze3eAdtlRRNfYA41xd9fh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00+EWp5fF2TOJ8IVhmy10q+pjobbgDzOO/udDebQvVMyY9m?= =?us-ascii?Q?EVO8nARC7QKaD1relfPMo4=3D?= X-Microsoft-Exchange-Diagnostics: 1;CY1PR07MB2585;6:kNKPZTQezbFCq7UVqvLgtVmLdVphCr/LatiwnHModgGbFZl5QAACkziw1j7rb+x2cjPY4gwYFIL9lC/R60xMMK2tqhH2/MiSjC6gdTMD4rn3/uRDF/NcFpWbUXXL/h4jvERI2H7LSsX/nsvBN/BPQFsxQGJiKSc8YwEJbL0zscveCD7egsbajpmxt7VXOG5GRIQi4MAwd5Jy7tsoF7XLbj0MALj8d0pFCL3brGpIXjo8zLvJlL0YPLrclDRO2sTxTfPFKnD8qGi/CSc0wRiCwiKx8zCNMfvtfKzFJtinE6lyLT0YbHXtwMJ7lC8qqdJMfFFCibk8DaGTnGxwgCcQ8A==;5:uQOlrnr6ZM11iasrR9BehIgpRHXFP1qTEQcvx5iFyuZ+TOVCDdqRMsGKvwofOgaSt84/sn64b+1p2cjgI8OMIpQOTwhGI/mbyBCWk8EmeelGgnosqpOnyO6PeA19pIperKo3S/NuGmLcE+70u6B9+Q==;24:kgGEHy33NKqPhBVCc5Q4tZ64i7VICV7rJsjew1ttNFg1qZuhcI5HubULjTTXAzAjfpGK7GFtEl2VV2NrJN5OkSrIrQzwZuPWTRjluvIhPKM=;7:7FKGLe/jKCBOejM5O6b7U53hvUE3kBiPX56778z5X83WQ5ug/57CeRXSj/KtcM67Fh1sl6r2fJopMs3Nzk8zheFTbEKubdMI60x4Ax8vlLG9QNl2wiqBhaAU+tJfo+PA2bm7mFAE94Hr8xCDn9rL7Dlf9Pl9zifRfs261bKy5AV54RU1ubKSE1IYDoZhaO5DfKoW2Xqq1uuFg1s/Qxl3O/nAnRc6JFN+qL1fFt+9oaw= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Aug 2017 08:06:56.2344 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR07MB2585 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3758 Lines: 79 On Fri, Aug 18, 2017 at 09:55:53PM -0600, Alex Williamson wrote: > On Fri, 18 Aug 2017 08:57:09 -0700 > David Daney wrote: > > > On 08/18/2017 07:12 AM, Alex Williamson wrote: [...] > > You previously rejected the idea to silently ignore bus reset requests > > on buses that do not support it. > > > > So this leaves us with two options: > > > > 1) Do nothing, and crash the kernel on systems with bad combinations of > > PCIe target devices and cn88xx when vfio_pci is used. > > > > 2) Do something else. > > > > We are trying to figure out what that something else should be. The > > general concept we are working on is that if vfio_pci wants to reset a > > device, *and* bus reset is the only option available, *and* cn88xx, then > > make vfio_pci fail. > > But that's not what these attempts do, they say if we can't do a bus or > slot reset, fail the device probe. The comment is trying to suggest > they do something else, am I misinterpreting the actual code change? > There are plenty of devices out there that don't care if bus reset > doesn't work, they support FLR or PM reset or device specific reset or > just deal without a reset. We can't suddenly say this new thing is a > requirement and sorry if you were happily using device assignment > before, but there's a slim chance you're on this platform that falls > over if we attempt to do a secondary bus reset. Thanks for explaining this, I agree that we should not fail the device probe as we only need to prevent the reset from happening. So let's just drop this patch. > > What is your opinion of doing that (assuming it is properly implemented)? > > It seems like these attempts are trying to completely turn off vfio-pci > on cn88xx, do you just want it unsupported on these platforms? Should > we blacklist anything where dev->bus->self is this root port? > Otherwise, what's wrong with returning an error if a bus reset fails, > because we should *never* silently ignore the request and pretend that > it worked, perhaps even dev_warn()'ing that the platform doesn't > support bus resets? Thanks, The ioctl's that trigger the slot/bus reset are already checking if reset is possible. With David's patches pci_probe_reset_bus() already fails. But we also need to make pci_probe_reset_slot() fail on cn88xx to avoid the same issue for the slot reset: [ 178.815041] [] pci_generic_config_read+0x5c/0xf0 [ 178.821221] [] thunder_pem_config_read+0x90/0x228 [ 178.827487] [] pci_bus_read_config_dword+0x84/0xb8 [ 178.833841] [] pci_read_config_dword+0x5c/0x70 [ 178.839848] [] pci_find_next_ext_capability.part.7+0x44/0xc8 [ 178.847075] [] pci_find_ext_capability+0x48/0x58 [ 178.853256] [] pci_restore_vc_state+0x44/0xa0 [ 178.859175] [] pci_restore_state.part.26+0x3c/0x240 [ 178.865614] [] pci_dev_restore+0x58/0x60 [ 178.871098] [] pci_slot_restore+0x60/0x78 [ 178.876669] [] pci_try_reset_slot+0xcc/0x140 [ 178.882512] [] vfio_pci_ioctl+0xb30/0xb88 [vfio_pci] [ 178.889050] [] vfio_device_fops_unl_ioctl+0x44/0x70 [vfio] [ 178.896100] [] do_vfs_ioctl+0xb0/0x748 [ 178.901411] [] SyS_ioctl+0x94/0xa8 [ 178.906375] [] __sys_trace_return+0x0/0x4 [ 178.911947] Code: 7100069f 540003c0 71000a9f 54000240 (b9400001) [ 178.918108] ---[ end trace 07143dcba854194e ]--- [ 178.922784] Kernel panic - not syncing: Fatal exception So far I don't see how this can be done in a clean way, there is no quirk available for the slot. --Jan