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

Re: [PATCH v10 13/17] vpci: add initial support for virtual PCI bus topology


  • To: Julien Grall <julien@xxxxxxx>
  • From: Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>
  • Date: Fri, 17 Nov 2023 20:08:58 +0000
  • Accept-language: en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=epam.com; dmarc=pass action=none header.from=epam.com; dkim=pass header.d=epam.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=jTizMzB8uNUQPjKZ5dbv9bxLwtSF0iNK1nkilfrUtfs=; b=R9/tj63+y0DeuxQLkvGYlkpNvFS9TTSJL/H/7liLLqIymvWlELrf6ljDAwBqkdRbjicnbVvzIO6O0KcjEeIfX4hAS9qsS0mQkzn21NzNDRzswaUD7UoAycvZ5CYOULeE5RZQIhgOK+mklqSdSvjqpUZ6FgWQd472ZX+MzzRdo5E7WX7dphTx2fL6FpkddGLIk9Ns65we5Bu5Jp3unEExGl2SkVY6mYTaX6wTOOyFJkDNUapmAXE4FKMJxhl/wKvkq2iC7aQx+w1yXNokCrSXhN/InTboD1sIuqb9wfpSXceTuNuHIfZqzlp/miRmLq1Ok8uY49/pf3zaluknfPIHig==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SMHJUgnRvQNlFSSHruJMZVq0z2k1cVH/MifXnueoEyJXGM3t1BPbG5V38NcEqJ61zUCDpedvxqQxT5sFVg0l2+7BV+NA8kTv5WWmYbs0FKEl+kl3I888ahQQm7NX2jgOdzM49CXFEEyW2+IdoqoR6UenY4dLRzmtBrDEJGbV7OHeVTixbT+OOqQU1SZ/R+JgwPf2DVpGaUqtVHa3vo3WHzjpisqD+MsccGxMh/uWJJH+7T5+JK+PC4KCMNQcSPFSxWjDBYEN3V6FW1kUOZSzS+inQaOLAZiVA3qecZBDTiAwyoYh76qWPyTaODEi0gKAHxTCW39WtDxlz04XK8aWaQ==
  • Cc: Stefano Stabellini <sstabellini@xxxxxxxxxx>, Stewart Hildebrand <stewart.hildebrand@xxxxxxx>, Oleksandr Andrushchenko <Oleksandr_Andrushchenko@xxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, Wei Liu <wl@xxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Fri, 17 Nov 2023 20:09:26 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHZ/Vi+wP3QsyKZ0EartcLXqtnBRLB9UyCAgAB7YgCAAAiUAIAAEHKAgADZXQCAAEyPgIAAGSwA
  • Thread-topic: [PATCH v10 13/17] vpci: add initial support for virtual PCI bus topology

Hi Julien,

Julien Grall <julien@xxxxxxx> writes:

> Hi Volodymyr,
>
> On 17/11/2023 14:09, Volodymyr Babchuk wrote:
>> Hi Stefano,
>> Stefano Stabellini <sstabellini@xxxxxxxxxx> writes:
>> 
>>> On Fri, 17 Nov 2023, Volodymyr Babchuk wrote:
>>>>> I still think, no matter the BDF allocation scheme, that we should try
>>>>> to avoid as much as possible to have two different PCI Root Complex
>>>>> emulators. Ideally we would have only one PCI Root Complex emulated by
>>>>> Xen. Having 2 PCI Root Complexes both of them emulated by Xen would be
>>>>> tolerable but not ideal.
>>>>
>>>> But what is exactly wrong with this setup?
>>>
>>> [...]
>>>
>>>>> The worst case I would like to avoid is to have
>>>>> two PCI Root Complexes, one emulated by Xen and one emulated by QEMU.
>>>>
>>>> This is how our setup works right now.
>>>
>>> If we have:
>>> - a single PCI Root Complex emulated in Xen
>>> - Xen is safety certified
>>> - individual Virtio devices emulated by QEMU with grants for memory
>>>
>>> We can go very far in terms of being able to use Virtio in safety
>>> use-cases. We might even be able to use Virtio (frontends) in a SafeOS.
>>>
>>> On the other hand if we put an additional Root Complex in QEMU:
>>> - we pay a price in terms of complexity of the codebase
>>> - we pay a price in terms of resource utilization
>>> - we have one additional problem in terms of using this setup with a
>>>    SafeOS (one more device emulated by a non-safe component)
>>>
>>> Having 2 PCI Root Complexes both emulated in Xen is a middle ground
>>> solution because:
>>> - we still pay a price in terms of resource utilization
>>> - the code complexity goes up a bit but hopefully not by much
>>> - there is no impact on safety compared to the ideal scenario
>>>
>>> This is why I wrote that it is tolerable.
>> Ah, I see now. Yes, I am agree with this. Also I want to add some
>> more
>> points:
>> - There is ongoing work on implementing virtio backends as a
>> separate
>>    applications, written in Rust. Linaro are doing this part. Right now
>>    they are implementing only virtio-mmio, but if they want to provide
>>    virtio-pci as well, they will need a mechanism to plug only
>>    virtio-pci, without Root Complex. This is argument for using single Root
>>    Complex emulated in Xen.
>> - As far as I know (actually, Oleksandr told this to me), QEMU has
>> no
>>    mechanism for exposing virtio-pci backends without exposing PCI root
>>    complex as well. Architecturally, there should be a PCI bus to which
>>    virtio-pci devices are connected. Or we need to make some changes to
>>    QEMU internals to be able to create virtio-pci backends that are not
>>    connected to any bus. Also, added benefit that PCI Root Complex
>>    emulator in QEMU handles legacy PCI interrupts for us. This is
>>    argument for separate Root Complex for QEMU.
>> As right now we have only virtio-pci backends provided by QEMU and
>> this
>> setup is already working, I propose to stick to this
>> solution. Especially, taking into account that it does not require any
>> changes to hypervisor code.
>
> I am not against two hostbridge as a temporary solution as long as
> this is not a one way door decision. I am not concerned about the
> hypervisor itself, I am more concerned about the interface exposed by
> the toolstack and QEMU.
>
> To clarify, I don't particular want to have to maintain the two
> hostbridges solution once we can use a single hostbridge. So we need
> to be able to get rid of it without impacting the interface too much.

This depends on virtio-pci backends availability. AFAIK, now only one
option is to use QEMU and QEMU provides own host bridge. So if we want
get rid of the second host bridge we need either another virtio-pci
backend or we need to alter QEMU code so it can live without host
bridge.

As for interfaces, it appears that QEMU case does not require any changes
into hypervisor itself, it just boils down to writing couple of xenstore
entries and spawning QEMU with correct command line arguments.

>From the user perspective, all this is configured via xl.conf entry like

virtio=[
'backend=DomD, type=virtio,device, transport=pci, bdf=0000:00:01.0, 
grant_usage=1, backend_type=qemu',
]

In the future we can add backend_type=standalone for non-QEMU-based
backends. If there will be no QEMU-based backends, there will be no
second host bridge.

-- 
WBR, Volodymyr


 


Rackspace

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