[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v2] xen-pciback: Consider INTx disabled when MSI/MSI-X is enabled


  • To: Marek Marczykowski-Górecki <marmarek@xxxxxxxxxxxxxxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Fri, 18 Nov 2022 13:27:49 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=62WL9D3+1ncBlxOPaYn3Ys0suKxJNg14U5FxAy8SQk4=; b=cOpiCXp/ciRRXch0y0aU/Vnr4hoL6qa0wzdL0a7XBJWbeeB9shxJ5wI+uYlSvmdTxJPfjV73yMGlKYdFt+ARkEUGgXutX6vJtENlIBZgI978zPgNzNFLvuxy+dFrCuT2YCiFegqQ+uh2tuwsH+BP11msETtEFH30EPNPEwVLIRmbJ5uu1Tu6bNKG/Ffzo0txj8durcEr5ks5oBozJfBrPTJFSWfFBh/9+2TEqC7fALOjx90YOy29bRXlss3+J4fDsQEpaDIiMbt11mopxdqUeh9mZD3au2zVvoR3vNziylNjlmubP3UJho4T4Yk9ZzwidAQdyrDPEvUNNlBLu/SKxg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BggZgnZScM4svskQ0+XMGCex6DkTUgle3sz9b2BMVmfe4YyuK9wIubFsaRArhQdYT6jq5ZOn9S72SmL1LLsEkddBmYPvHgmtspsDY8Thnv0sRG7F9dvdGepTZlO2zP8Suq8aFucQa6kjasfrHSxAR/A0nYUiDI0ydgyFx/fyH8r3wZGX+/mugUleId0HIDXa1IiP33+KsYYZsxOZg3o67XQflK4UZxL4RJ7SXrmIrda4z6JNzFmfTu5defHPxbSuzMFjBqFSpsJBtwGiN5Ho46vgWHqL/j8/wXB/UYPz8hrpfFmjpRKq5fIY/EuOcaThnUUdLp+kIqQoW+tSNXIGoA==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Juergen Gross <jgross@xxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Oleksandr Tyshchenko <oleksandr_tyshchenko@xxxxxxxx>, "moderated list:XEN HYPERVISOR INTERFACE" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, linux-kernel@xxxxxxxxxxxxxxx
  • Delivery-date: Fri, 18 Nov 2022 12:27:55 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 18.11.2022 13:06, Marek Marczykowski-Górecki wrote:
> On Fri, Nov 18, 2022 at 08:36:14AM +0100, Jan Beulich wrote:
>> On 18.11.2022 03:35, Marek Marczykowski-Górecki wrote:
>>> Linux enables MSI-X before disabling INTx, but keeps MSI-X masked until
>>> the table is filled. Then it disables INTx just before clearing MASKALL
>>> bit. Currently this approach is rejected by xen-pciback.
>>> According to the PCIe spec, device cannot use INTx when MSI/MSI-X is
>>> enabled.
>>
>> Similarly the spec doesn't allow using MSI and MSI-X at the same time.
>> Before your change xen_pcibk_get_interrupt_type() is consistent for all
>> three forms of interrupt delivery; imo it also wants to be consistent
>> after your change. This effectively would mean setting only one bit at
>> a time (or using an enum right away), but then the question is what
>> order you do the checks in. IOW I think the change to the function is
>> wrong.
> 
> IIUC the difference is that enabling MSI or MSI-X implicitly disables
> INTx, while enabling both MSI and MSI-X is UB. This means that MSI
> active and PCI_COMMAND_INTX_DISABLE bit not set means "only MSI is
> active" - which the function now properly reports.

Hmm, yes, this is perhaps a good way to look at it.

> Both MSI and MSI-X active at the same time means a bug somewhere else
> and the current code allows only to disable one of them in such case. I
> could replace this with BUG_ON, or simply assume such bug doesn't exist
> and ignore this case, if you prefer.

BUG_ON() would imply this state cannot be reached no matter what is
requested from outside of the kernel. I'm not sure that's true here,
so keeping that aspect unchanged is probably fine (and with the above
I then take back my "wrong" from the earlier reply.

Jan



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.