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

Re: [PATCH] xen/arm: Validate generic timer frequency


  • To: Michal Orzel <michal.orzel@xxxxxxx>, Julien Grall <julien@xxxxxxx>
  • From: Henry Wang <Henry.Wang@xxxxxxx>
  • Date: Wed, 11 Oct 2023 07:01:17 +0000
  • Accept-language: zh-CN, 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=oI6z/DQ74miAYgZbmUPP2txDtsLvkbLOyNxeY7Ig74Y=; b=J0ENC40NsQyiouTahGn8nJvQGDhZcRrCbVAzAYv+WFm7FSBkGyBHtffR4uSw4P09QgUnOti2Cc6W2k3orP9d4qwdSI68lmj5wfrlT4E/Q2hdnL7/hGjvnQiOz98ee9SfmynRnKq8Mn7RHqRQLDv/qvotG2C4wrEW85uO2e8D0tbkKrG0fVvpUqw80Yez2d7F6f09k/Ft4/IvnhY6hqjLifM/AZpwXJOJTze0eULP2HGlxJpwoupp6kiCFKg3/HxtDF7skvLuQcgN6WPiEL0Ziz6jbLcpH9dohpZex6rivNwRt+oZgSJWOLD6sNNqZm5iscuUmLwukfAhnOSydrrcfA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ajW1aVEvXUKz/EBR8wSbEgLU3CMwFTidLrt6oMUPFqxwDQPbOoJ/2carsRODR9NtyKt6s3r1LA/aGbe8G+nZUJ5tUQ57GqP/Hx4oF8lfaBbCgd7ct61Du5xUtZhgHAv/VcydFAtOGBT0aeFQTDnpBOzfFQIVBJIooAyBwqMIVa5E0E2C6hpfyaeAcMwrKjgofHA29zWyuRiygquxsurwcisq6MU2zwFQoLLu0cILGkGnF7zNtjo1rLYD4fJjNqPzWrUKiQyZZVSv7bcfidcnEs0c9ENmFZndKdIE41QrtADXoKN6P6lKUpBNvdK812+2WaY1JHtZiiFR9gekoU8AiA==
  • Authentication-results-original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
  • Cc: Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Bertrand Marquis <Bertrand.Marquis@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>
  • Delivery-date: Wed, 11 Oct 2023 07:01:49 +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: AQHZ8ghhUxpPHXka0EK/1dVmmxa3crAxa7iAgBHBwACAAQ3zgIAAAegA
  • Thread-topic: [PATCH] xen/arm: Validate generic timer frequency

Hi Michal, Julien,

> On Oct 11, 2023, at 14:54, Michal Orzel <michal.orzel@xxxxxxx> wrote:
> 
> Hi Julien, Henry,
> 
> On 10/10/2023 16:48, Julien Grall wrote:
>> 
>> 
>> (+ Henry)
>> 
>> Hi Michal,
>> 
>> On 29/09/2023 08:38, Julien Grall wrote:
>>> Hi Michal,
>>> 
>>> On 28/09/2023 13:34, Michal Orzel wrote:
>>>> Generic timer dt node property "clock-frequency" (refer Linux dt binding
>>>> Documentation/devicetree/bindings/timer/arm,arch_timer.yaml) is used to
>>>> override the incorrect value set by firmware in CNTFRQ_EL0. If the value
>>>> of this property is 0 (i.e. by mistake), Xen would continue to work and
>>>> use the value from the sysreg instead. The logic is thus incorrect and
>>>> results in inconsistency when creating timer node for domUs:
>>>>  - libxl domUs: clock_frequency member of struct xen_arch_domainconfig
>>>>    is set to 0 and libxl ignores setting the "clock-frequency" property,
>>>>  - dom0less domUs: "clock-frequency" property is taken from dt_host and
>>>>    thus set to 0.
>>>> 
>>>> Property "clock-frequency" is used to override the value from sysreg,
>>>> so if it is also invalid, there is nothing we can do and we shall panic
>>>> to let user know about incorrect setting. Going even further, we operate
>>>> under assumption that the frequency must be at least 1KHz (i.e. cpu_khz
>>>> not 0) in order for Xen to boot. Therefore, introduce a new helper
>>>> validate_timer_frequency() to verify this assumption and use it to check
>>>> the frequency obtained either from dt property or from sysreg.
>>>> 
>>>> Signed-off-by: Michal Orzel <michal.orzel@xxxxxxx>
>>> 
>>> Acked-by: Julien Grall <jgrall@xxxxxxxxxx>
>> 
>> Going through the list of pending patches, I noticed Henry wasn't CCed.
>> Is this patch intended for Xen 4.18? If so, can you provide some
>> reasoning why would want it?
> Strictly speaking, lack of "for-4.18" prefix indicates that I did not 
> particularly aim for 4.18.
> However, I find it useful, so I will leave it up to Henry to decide if we 
> want that or not.
> 
> Benefits:
> - fixes the invalid logic the consequence of which might result in 
> inconsistency when booting
>  the same OS as libxl domU and dom0less domU.
> - prevents spreading out the error condition (i.e. rate < 1KHZ) that can lead 
> to e.g. Xen inability to schedule,
>  by panicing with proper msg
> Risks:
> - early init code, no critical path, in case of an error, panic returned with 
> proper msg - no risks AFAICT

Thanks for the explanation, this looks like an improvement for the
current code to me so I am fine with including it in 4.18 

Release-acked-by: Henry Wang <Henry.Wang@xxxxxxx>

Kind regards,
Henry

> 
> ~Michal




 


Rackspace

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