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

Re: [RFC PATCH 0/8] SVE feature for arm guests


  • To: Julien Grall <julien@xxxxxxx>
  • From: Bertrand Marquis <Bertrand.Marquis@xxxxxxx>
  • Date: Wed, 25 Jan 2023 13:21:30 +0000
  • Accept-language: en-GB, en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.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=k0988EFARxls/2WUpzJM70zTAbLoSmEkUSsQwSp7PJg=; b=SKe2r8dTjbs5KuaRqyOvenZJZiCCosUIZu3uAwN8LfGe1oTUfAuZvjojzF9dfEhRwdZvAbn59qk+znqpsqMFkuXKlN/6mwac1SYY8OKfs5t6xm6W9LA91esMqV4EDPT1OwNnJvSURbfmJr4I0A4OQyTWVQuCza2YvLRz9vSQhAkuQ7nrkqfstmctDtJqz7yhK0xkzOE74GHdVi5sl5OQ7561Xg7UeN8AHeKppOi9j/8CLMdsrKH5pNx/ZE8QeQeUDQDZokTMygLO1H3mk9aNTbQBhgQurhfb/CQvfk+U8b3lqqk54be4yzIeoZvsHycksLYTKkVq02NFC3Wbn1ZYaA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dB2bpc6m0J4hTnmASH7aw9SATgfZ34ekPfDD9o1PFVx1J+0V6bAQ20ZzLPQea1iaoZLHl5+2j4brH1/ULJaKqnfMRflHgi9ZHnPajh5FhqoG8aaIthrGEBac1SwqH+Yzg2FMlnRR1/3uhc1zTejAVjkvO1AFjkp9Zv+xig78DrqZhbiNyPUmt3TXFUMr+ZUm8IHAqM0NRLo5H1jL7o3/FL/pS8ZrcCaIKx9eWE+zaDYRa+MNBP5vRPtcJ8Id7XBSQoLoBk5VkECPHfZCD66Wh+0KZTWa8e/lmz2rz4kwbNCOomQjdlR0vAD4J6mAxuuroIoXw1xTO4p9tdTzGGzpwg==
  • Authentication-results-original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
  • Cc: Luca Fancellu <Luca.Fancellu@xxxxxxx>, Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Wei Chen <Wei.Chen@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, Wei Liu <wl@xxxxxxx>, Anthony PERARD <anthony.perard@xxxxxxxxxx>, Nick Rosbrook <rosbrookn@xxxxxxxxx>, Juergen Gross <jgross@xxxxxxxx>
  • Delivery-date: Wed, 25 Jan 2023 13:21:58 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Nodisclaimer: true
  • Original-authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
  • Thread-index: AQHZJcpxlecBD3vJ/066zddcxj2mrq6ZcImAgAE+YoCAAVwdAIATKTYA
  • Thread-topic: [RFC PATCH 0/8] SVE feature for arm guests

Hi Julien,

> On 13 Jan 2023, at 09:44, Julien Grall <julien@xxxxxxx> wrote:
> 
> Hi Luca,
> 
> On 12/01/2023 11:58, Luca Fancellu wrote:
>>> On 11 Jan 2023, at 16:59, Julien Grall <julien@xxxxxxx> wrote:
>>> On 11/01/2023 14:38, Luca Fancellu wrote:
>>>> This serie is introducing the possibility for Dom0 and DomU guests to use
>>>> sve/sve2 instructions.
>>>> SVE feature introduces new instruction and registers to improve 
>>>> performances on
>>>> floating point operations.
>>>> The SVE feature is advertised using the ID_AA64PFR0_EL1 register, SVE 
>>>> field, and
>>>> when available the ID_AA64ZFR0_EL1 register provides additional information
>>>> about the implemented version and other SVE feature.
>>>> New registers added by the SVE feature are Z0-Z31, P0-P15, FFR, ZCR_ELx.
>>>> Z0-Z31 are scalable vector register whose size is implementation defined 
>>>> and
>>>> goes from 128 bits to maximum 2048, the term vector length will be used to 
>>>> refer
>>>> to this quantity.
>>>> P0-P15 are predicate registers and the size is the vector length divided 
>>>> by 8,
>>>> same size is the FFR (First Fault Register).
>>>> ZCR_ELx is a register that can control and restrict the maximum vector 
>>>> length
>>>> used by the <x> exception level and all the lower exception levels, so for
>>>> example EL3 can restrict the vector length usable by EL3,2,1,0.
>>>> The platform has a maximum implemented vector length, so for every value
>>>> written in ZCR register, if this value is above the implemented length, 
>>>> then the
>>>> lower value will be used. The RDVL instruction can be used to check what 
>>>> vector
>>>> length is the HW using after setting ZCR.
>>>> For an SVE guest, the V0-V31 registers are part of the Z0-Z31, so there is 
>>>> no
>>>> need to save them separately, saving Z0-Z31 will save implicitly also 
>>>> V0-V31.
>>>> SVE usage can be trapped using a flag in CPTR_EL2, hence in this serie the
>>>> register is added to the domain state, to be able to trap only the guests 
>>>> that
>>>> are not allowed to use SVE.
>>>> This serie is introducing a command line parameter to enable Dom0 to use 
>>>> SVE and
>>>> to set its maximum vector length that by default is 0 which means the 
>>>> guest is
>>>> not allowed to use SVE. Values from 128 to 2048 mean the guest can use SVE 
>>>> with
>>>> the selected value used as maximum allowed vector length (which could be 
>>>> lower
>>>> if the implemented one is lower).
>>>> For DomUs, an XL parameter with the same way of use is introduced and a 
>>>> dom0less
>>>> DTB binding is created.
>>>> The context switch is the most critical part because there can be big 
>>>> registers
>>>> to be saved, in this serie an easy approach is used and the context is
>>>> saved/restored every time for the guests that are allowed to use SVE.
>>> 
>>> This would be OK for an initial approach. But I would be worry to 
>>> officially support SVE because of the potential large impact on other users.
>>> 
>>> What's the long term plan?
>> Hi Julien,
>> For the future we can plan some work and decide together how to handle the 
>> context switch,
>> we might need some suggestions from you (arm maintainers) to design that 
>> part in the best
>> way for functional and security perspective.
> I think SVE will need to be lazily saved/restored. So on context switch, we 
> would tell that the context belongs to the a previous domain. The first time 
> after the current domain tries to access SVE, then we would load it.

We should try to prevent those kind of things because it makes the real time 
analysis a lot more complex.
The only use case where this would make the system a lot faster is if there is 
only one guest using SVE (which might be a use case), other than that case this 
will just create delays when someone else is trying to use SVE instead of 
having a fix delay at context switch.

> 
>> For now we might flag the feature as unsupported, explaining in the Kconfig 
>> help that switching
>> between SVE and non-SVE guests, or between SVE guests, might add latency 
>> compared to
>> switching between non-SVE guests.
> 
> I am OK with that. I actually like the idea to spell it out because that 
> helps us to remember what are the gaps in the code :).

I like this solution to.

Cheers
Bertrand

> 
> Cheers,
> 
> -- 
> Julien Grall




 


Rackspace

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