Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 98DF3D37E5C for ; Wed, 14 Jan 2026 15:53:49 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.1203379.1518590 (Exim 4.92) (envelope-from ) id 1vg3BY-0002LT-Va; Wed, 14 Jan 2026 15:53:28 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 1203379.1518590; Wed, 14 Jan 2026 15:53:28 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1vg3BY-0002LM-Sj; Wed, 14 Jan 2026 15:53:28 +0000 Received: by outflank-mailman (input) for mailman id 1203379; Wed, 14 Jan 2026 15:53:27 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1vg3BX-0002Ky-Pv for xen-devel@lists.xenproject.org; Wed, 14 Jan 2026 15:53:27 +0000 Received: from mail-ej1-x62b.google.com (mail-ej1-x62b.google.com [2a00:1450:4864:20::62b]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 29a2e914-f161-11f0-b15e-2bf370ae4941; Wed, 14 Jan 2026 16:53:26 +0100 (CET) Received: by mail-ej1-x62b.google.com with SMTP id a640c23a62f3a-b87124c6295so552126366b.3 for ; Wed, 14 Jan 2026 07:53:26 -0800 (PST) Received: from [192.168.1.6] (user-109-243-67-101.play-internet.pl. [109.243.67.101]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-b842a5641casm2669242666b.64.2026.01.14.07.53.24 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 14 Jan 2026 07:53:25 -0800 (PST) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 29a2e914-f161-11f0-b15e-2bf370ae4941 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1768406006; x=1769010806; darn=lists.xenproject.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=/elI78rHTIFfPYXOwGaxs777CQdiDc2ax5tIcwgj7aA=; b=nVQWXQhNfO1zm/duhmFm2gIwJHMf1QKjvIaRFw7Re1ScFqsdp/zmQ51z1NWO1NAJvl yzQTFFyzXNUxPVZZAFW/PizikPiHfU8vep7GEPb64tYldwJMMMtXa783oHZNHN5/pyY0 NVVZvXrGAyNYH3d43tnRVY3+y5tJRl2Y8nWOR2z4z+h/QJwvVsOLoKWM3oCrWfAFZ09v HlrS1tdwH7PSOm1lLV2FcudmAlcdWvKKp/S9ipCCYI6xgPfc6+za7ikZeelYG3XtbUpc Ad7NwHYGx99SCi+4RWUHys36KZmPKxCl7NqQ87Uqw2LqACqFx3pV+s66MY8cfKd1yR4d JoNg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1768406006; x=1769010806; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=/elI78rHTIFfPYXOwGaxs777CQdiDc2ax5tIcwgj7aA=; b=Rxe2o9ILJ2ZU6QCcAwawRiSDgFXWDWqJiSexu/XVnBAgbhT1xgNNNIR7YBopDjF7l6 F5/qhHe8NdKpUhDeRkqHHmMebEsxJ56WyD77Rpw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a62f3a-b876141f2b0mr286287666b.62.1768406005456; Wed, 14 Jan 2026 07:53:25 -0800 (PST) Message-ID: <948f83bd-60aa-4ed2-b9e7-fd0e410fa1b9@gmail.com> Date: Wed, 14 Jan 2026 16:53:24 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v1 13/15] xen/riscv: implement reprogram_timer() using SBI To: Jan Beulich Cc: Alistair Francis , Bob Eshleman , Connor Davis , Andrew Cooper , Anthony PERARD , Michal Orzel , Julien Grall , =?UTF-8?Q?Roger_Pau_Monn=C3=A9?= , Stefano Stabellini , xen-devel@lists.xenproject.org References: <43249171def325c49541ebdac141fe99d159b60f.1766595589.git.oleksii.kurochko@gmail.com> <90e7fc60-09cc-4b61-ab0a-80037f8ecaf8@gmail.com> <4141bb71-7aef-4287-aefd-92009977294f@gmail.com> <922c5809-8070-4ff4-9caf-d953c4ac0c2b@suse.com> Content-Language: en-US From: Oleksii Kurochko In-Reply-To: <922c5809-8070-4ff4-9caf-d953c4ac0c2b@suse.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 1/14/26 4:04 PM, Jan Beulich wrote: > On 14.01.2026 13:41, Oleksii Kurochko wrote: >> On 1/14/26 12:17 PM, Jan Beulich wrote: >>> On 14.01.2026 11:33, Oleksii Kurochko wrote: >>>> On the other hand, if some >>>> other negative error code is returned, it might be better to return 0 and simply >>>> allow the timer programming to be retried later. >>>> However, if we look at the comments for other architectures, the meaning of a >>>> return value of 0 from this function is: >>>> Returns 1 on success; 0 if the timeout is too soon or is in the past. >>>> In that case, it becomes difficult to distinguish whether 0 was returned due to >>>> an error or because the timeout was too soon or already in the past. >>> Well, your problem is that neither Arm nor x86 can actually fail. Hence >>> calling code isn't presently prepared for that. With panic() (and hence >>> also BUG()) and domain_crash() ruled out, maybe generic infrastructure >>> needs touching first (in a different way than making the function's return >>> type "bool")? >> I think making the function's return still is fine and it is only question to >> arch-specific reprogram_timer() what to do when an error happens. >> >> Still doesn't clear to me what should be a reaction on failure of >> reprogram_timer(). >> Considering that SBI spec doesn't specify a list of possible errors and now >> the only possible error is -ENOSUPP it seems to me it is fine >> to have panic() as we don't have any other mechanism to set a timer >> except SBI call > panic() (or BUG_ON()) is pretty drastic a measure when possibly the system > could be kept alive. If is pretty certain that future SBI timer calls also > aren't going to work, then I'd agree that panic()ing might be appropriate. > If otoh a subsequent call might work, a less heavyweight action would seem > preferable. (Welcome to the funs of relying on lower-level software.) I don’t know how OpenSBI will be updated in the future, but looking at the current situation, since SBI timer calls have existed from very early OpenSBI versions up to the latest ones, repeatedly issuing the SBI timer call will always return the same negative error code indicating that the timer call is not supported. I can add a comment above panic(), or include an explanation in the commit message. > >> (except the case SSTC is supported then we can use just >> supervisor timer register directly without SBI call). > So maybe a good first step would be to use that extension if available? > Might even think about requiring it for the time being ... I initially started working on SSTC support, but then stopped because an almost production-ready board to which I do have indirect access does not support this extension. As a result, I decided to proceed with SBI approach as it covers both cases when SSTC is available and when no. ~ Oleksii