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

Re: [PATCH] xen: Remove config dependency in XEN_PRIVCMD definition


  • To: Jürgen Groß <jgross@xxxxxxxx>
  • From: "Chen, Jiqian" <Jiqian.Chen@xxxxxxx>
  • Date: Thu, 10 Oct 2024 07:07:06 +0000
  • Accept-language: en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=OUhvMB09tbqA8NK5v8XB9Ge8pIp5aMRmHKaj4oI9vw4=; b=o/xkS9g3vS9JW7SrszhZehjluRRxk8iL5G1c73mXKAzdhMIOGlN3Alnjdf7jgGFLR9wR4IN2cI0tAUaR8GRAgRmCL8vnaBeClpK0eHKWxhiugOuK181u3mdvYssCI5+Vrgu1WUis6AnFC8BnO7am3LWIgMoLLbbIGXI590TJdao6EU/rrhFBxymoHZE768n/zLfir8GlMAvqCQnj6DEfF8IDZdEzrRz08z6gnfCQwDdgccOvNrh/WDCN2WIPy5H7G3KnSYFoVDyEK2sB/pG3XNl1eYDQ9QB/SpkmC+5RrB92cAAGlHuarYK9uxIvB+ZH+B1A0c9UtsWKCQT9+5w8jw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=D0m1s0mz47W8FANaA1SXK/9ePxiWcWRRBRSJG5nOM6YIeH2f3e+dg94unp48APYA/U0FRnqOMEZmxJgOnhW8s8WKmf1pPlR6X1k1kifQoVP5DNcGXmvqzVsYIw0TiA30Y6SXRznoi1GbTbNvfi8KhPuDwRNbyWA9j1RdFqIMzAqAqgXGTceK5LXdc7nfuIZ0YRrIrHo9X5GbU4gIPrha6+GD4Pk6+CcUQpv1SewYqosXywQF0RG8Vbo0ScKvuFpWxDjq9qNzqPYf69smTeHlySnb03vdwIMnl0cOn2z7tihnIMgouVhFJzc0vPts6j4YfCRH37AezSAlWz4aY522Dw==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com;
  • Cc: Stefano Stabellini <sstabellini@xxxxxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, "Chen, Jiqian" <Jiqian.Chen@xxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, "linux-kernel@xxxxxxxxxxxxxxx" <linux-kernel@xxxxxxxxxxxxxxx>, Oleksandr Tyshchenko <oleksandr_tyshchenko@xxxxxxxx>, Marek Marczykowski <marmarek@xxxxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Thu, 10 Oct 2024 07:07:18 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHbGhNYcN0w2cT3Gkyq1+R+KBCtNrJ9/yUAgAEHAICAAHM/AIAAnieA
  • Thread-topic: [PATCH] xen: Remove config dependency in XEN_PRIVCMD definition

On 2024/10/10 13:39, Jürgen Groß wrote:
> On 10.10.24 00:46, Stefano Stabellini wrote:
>> On Wed, 9 Oct 2024, Jan Beulich wrote:
>>> On 09.10.2024 08:20, Jiqian Chen wrote:
>>>> Commit 2fae6bb7be32 ("xen/privcmd: Add new syscall to get gsi from dev")
>>>> adds a weak reverse dependency to the config XEN_PRIVCMD definition, its
>>>> purpose is to pass the combination of compilation that CONFIG_XEN_PRIVCMD=y
>>>> and CONFIG_XEN_PCIDEV_BACKEND=m, because in that combination, xen-pciback
>>>> is compiled as a module but xen-privcmd is built-in, so xen-privcmd can't
>>>> find the implementation of pcistub_get_gsi_from_sbdf.
>>>>
>>>> But that dependency causes xen-privcmd can't be loaded on domU, because
>>>> dependent xen-pciback is always not be loaded successfully on domU.
>>>>
>>>> To solve above problem and cover original commit's requirement, just remove
>>>> that dependency, because the code "IS_REACHABLE(CONFIG_XEN_PCIDEV_BACKEND)"
>>>> of original commit is enough to meet the requirement.
>>>>
>>>> Fixes: 2fae6bb7be32 ("xen/privcmd: Add new syscall to get gsi from dev")
>>>> Signed-off-by: Jiqian Chen <Jiqian.Chen@xxxxxxx>
>>>
>>> This lacks a Reported-by:.
>>>
>>>> --- a/drivers/xen/Kconfig
>>>> +++ b/drivers/xen/Kconfig
>>>> @@ -261,7 +261,6 @@ config XEN_SCSI_BACKEND
>>>>   config XEN_PRIVCMD
>>>>       tristate "Xen hypercall passthrough driver"
>>>>       depends on XEN
>>>> -    imply XEN_PCIDEV_BACKEND
>>>>       default m
>>>>       help
>>>>         The hypercall passthrough driver allows privileged user programs to
>>>
>>> The report wasn't about a build problem, but a runtime one. Removing the
>>> dependency here doesn't change anything in the dependency of xen-privcmd
>>> on xen-pciback, as the use of pcistub_get_gsi_from_sbdf() continues to
>>> exist.
>>>
>>> Consider the case of XEN_PCIDEV_BACKEND=m and XEN_PRIVCMD=m, which
>>> I guess is what Marek is using in his config. Both drivers are available
>>> in such a configuration, yet loading of xen-privcmd then requires to
>>> load xen-pciback first. And that latter load attempt will fail in a DomU.
>>> The two drivers simply may not have any dependency in either direction.
>>
>> The idea is that there should be no hard dependency on
>> pcistub_get_gsi_from_sbdf(). If it is available, the service will be
>> used, otherwise an error will be reported.
>>
>> The problem is that IS_REACHABLE is a compile-time check. What we need
>> is a runtime check instead. Maybe symbol_get or try_module_get ?
> 
> This is a rather clumsy solution IMO.
> 
> I'm seeing the following solutions:
> 
> 1. Don't fail to to load the pciback driver in a DomU, but only disable
>    any functionality.
> 
> 2. Move the drivers/xen/xen-pciback/pci_stub.c functionality in a module
>    of its own, allowing the privcmd driver to be loaded without needing
>    the rest of pciback.
> 
> 3. Add a hook to e.g. drivers/xen/pci.c instead for calling of
>    pcistub_get_gsi_from_sbdf() directly. pciback could register the real
>    call address. If pciback isn't loaded, the hook can return an error.
>    This would remove the explicit dependency of privcmd on pciback.
> 
> I'd prefer the 3rd variant.
Thanks, I will send changes in v2 soon.
And I prefer to add the hook in drivers/xen/acpi.c

> 
> 
> Juergen
> 

-- 
Best regards,
Jiqian Chen.

 


Rackspace

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