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 86810E909C1 for ; Tue, 17 Feb 2026 15:36:32 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.1235171.1538221 (Exim 4.92) (envelope-from ) id 1vsN7W-0000l1-WC; Tue, 17 Feb 2026 15:36:14 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 1235171.1538221; Tue, 17 Feb 2026 15:36:14 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1vsN7W-0000ku-TW; Tue, 17 Feb 2026 15:36:14 +0000 Received: by outflank-mailman (input) for mailman id 1235171; Tue, 17 Feb 2026 15:36:14 +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 1vsN7W-0000ko-Eo for xen-devel@lists.xenproject.org; Tue, 17 Feb 2026 15:36:14 +0000 Received: from mail-wm1-x32c.google.com (mail-wm1-x32c.google.com [2a00:1450:4864:20::32c]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 5f9b0fe5-0c16-11f1-b164-2bf370ae4941; Tue, 17 Feb 2026 16:36:06 +0100 (CET) Received: by mail-wm1-x32c.google.com with SMTP id 5b1f17b1804b1-4836d4c26d3so31539555e9.2 for ; Tue, 17 Feb 2026 07:36:06 -0800 (PST) Received: from [10.156.60.236] (ip-037-024-206-209.um08.pools.vodafone-ip.de. [37.24.206.209]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-48371a298ebsm136509565e9.13.2026.02.17.07.36.04 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 17 Feb 2026 07:36:04 -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: 5f9b0fe5-0c16-11f1-b164-2bf370ae4941 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1771342565; x=1771947365; darn=lists.xenproject.org; h=content-transfer-encoding:in-reply-to:autocrypt:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:from:to:cc:subject:date:message-id:reply-to; bh=FM0lAZ1LjaJF4V6XUF62gv2YltTFYUV0Mkcferf4Qr8=; b=Ttuuc/POaGy/ox/dE9Carf6T85l/Kg+sbLVRbc7YZRwFNFtyUeBFzYVpipuxMAYkUX u6ugMJ4V0KnKe2CQtJZbrpUTYgqyAwhYeioSq/cswDxb3sMQCawLi52nD3ex8FE7NB3x GSoZV+NZnqogZYpcOIDXIuCRKPcmloq+VvnrvtoKt0TLCDNam2FGZvw9Bzoqek+ZVWfM bfmSp58bjnGBl8W4zJ/AtNSxO8pHfnvAcxyZjCmOt/ZiTntWz7zQP0RZi7qGPp2h57/a J8D4TpyVLgymPJiwnZqYTDQDfWHNzfKBSCd9IB6Vxu3V6ekqhFV924ufcVzFuf7FOHZZ muTA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1771342565; x=1771947365; h=content-transfer-encoding:in-reply-to:autocrypt: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=FM0lAZ1LjaJF4V6XUF62gv2YltTFYUV0Mkcferf4Qr8=; b=L0PvReIuhMpV1KJnin6achhq/SGab2UC529s15OnbjupNDLXD7Bp0+e41MpI13YEoJ hsu2I9OJVs/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HZXX2D0ZOIoDlm/GRWRjsg== X-Received: by 2002:a05:600c:450a:b0:46e:35a0:3587 with SMTP id 5b1f17b1804b1-48373a4e82emr241223725e9.27.1771342565407; Tue, 17 Feb 2026 07:36:05 -0800 (PST) Message-ID: Date: Tue, 17 Feb 2026 16:36:03 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v4 08/16] xen/riscv: introduce basic vtimer infrastructure for guests To: Oleksii Kurochko Cc: Romain Caritey , Alistair Francis , 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: <7426e2d974bfe67786c67709d487c7f64c22ae58.1770999383.git.oleksii.kurochko@gmail.com> <211c492f-23e1-44ae-8601-ecbce8650e0d@gmail.com> Content-Language: en-US From: Jan Beulich Autocrypt: addr=jbeulich@suse.com; keydata= xsDiBFk3nEQRBADAEaSw6zC/EJkiwGPXbWtPxl2xCdSoeepS07jW8UgcHNurfHvUzogEq5xk hu507c3BarVjyWCJOylMNR98Yd8VqD9UfmX0Hb8/BrA+Hl6/DB/eqGptrf4BSRwcZQM32aZK 7Pj2XbGWIUrZrd70x1eAP9QE3P79Y2oLrsCgbZJfEwCgvz9JjGmQqQkRiTVzlZVCJYcyGGsD /0tbFCzD2h20ahe8rC1gbb3K3qk+LpBtvjBu1RY9drYk0NymiGbJWZgab6t1jM7sk2vuf0Py O9Hf9XBmK0uE9IgMaiCpc32XV9oASz6UJebwkX+zF2jG5I1BfnO9g7KlotcA/v5ClMjgo6Gl MDY4HxoSRu3i1cqqSDtVlt+AOVBJBACrZcnHAUSuCXBPy0jOlBhxPqRWv6ND4c9PH1xjQ3NP nxJuMBS8rnNg22uyfAgmBKNLpLgAGVRMZGaGoJObGf72s6TeIqKJo/LtggAS9qAUiuKVnygo 3wjfkS9A3DRO+SpU7JqWdsveeIQyeyEJ/8PTowmSQLakF+3fote9ybzd880fSmFuIEJldWxp Y2ggPGpiZXVsaWNoQHN1c2UuY29tPsJgBBMRAgAgBQJZN5xEAhsDBgsJCAcDAgQVAggDBBYC AwECHgECF4AACgkQoDSui/t3IH4J+wCfQ5jHdEjCRHj23O/5ttg9r9OIruwAn3103WUITZee e7Sbg12UgcQ5lv7SzsFNBFk3nEQQCACCuTjCjFOUdi5Nm244F+78kLghRcin/awv+IrTcIWF hUpSs1Y91iQQ7KItirz5uwCPlwejSJDQJLIS+QtJHaXDXeV6NI0Uef1hP20+y8qydDiVkv6l IreXjTb7DvksRgJNvCkWtYnlS3mYvQ9NzS9PhyALWbXnH6sIJd2O9lKS1Mrfq+y0IXCP10eS FFGg+Av3IQeFatkJAyju0PPthyTqxSI4lZYuJVPknzgaeuJv/2NccrPvmeDg6Coe7ZIeQ8Yj t0ARxu2xytAkkLCel1Lz1WLmwLstV30g80nkgZf/wr+/BXJW/oIvRlonUkxv+IbBM3dX2OV8 AmRv1ySWPTP7AAMFB/9PQK/VtlNUJvg8GXj9ootzrteGfVZVVT4XBJkfwBcpC/XcPzldjv+3 HYudvpdNK3lLujXeA5fLOH+Z/G9WBc5pFVSMocI71I8bT8lIAzreg0WvkWg5V2WZsUMlnDL9 mpwIGFhlbM3gfDMs7MPMu8YQRFVdUvtSpaAs8OFfGQ0ia3LGZcjA6Ik2+xcqscEJzNH+qh8V m5jjp28yZgaqTaRbg3M/+MTbMpicpZuqF4rnB0AQD12/3BNWDR6bmh+EkYSMcEIpQmBM51qM EKYTQGybRCjpnKHGOxG0rfFY1085mBDZCH5Kx0cl0HVJuQKC+dV2ZY5AqjcKwAxpE75MLFkr wkkEGBECAAkFAlk3nEQCGwwACgkQoDSui/t3IH7nnwCfcJWUDUFKdCsBH/E5d+0ZnMQi+G0A nAuWpQkjM1ASeQwSHEeAWPgskBQL In-Reply-To: <211c492f-23e1-44ae-8601-ecbce8650e0d@gmail.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On 17.02.2026 16:20, Oleksii Kurochko wrote: > > On 2/17/26 3:59 PM, Jan Beulich wrote: >> On 13.02.2026 17:28, Oleksii Kurochko wrote: >>> Lay the groundwork for guest timer support by introducing a per-vCPU >>> virtual timer backed by Xen’s common timer infrastructure. >>> >>> The virtual timer is programmed in response to the guest SBI >>> sbi_set_timer() call and injects a virtual supervisor timer interrupt >>> into the vCPU when it expires. >>> >>> While a dedicated struct vtimer is not strictly required at present, >>> it is expected to become necessary once SSTC support is introduced. >>> In particular, it will need to carry additional state such as whether >>> SSTC is enabled, the next compare value (e.g. for the VSTIMECMP CSR) >>> to be saved and restored across context switches, and time delta state >>> (e.g. HTIMEDELTA) required for use cases such as migration. Introducing >>> struct vtimer now avoids a later refactoring. >>> >>> Signed-off-by: Oleksii Kurochko >> Acked-by: Jan Beulich >> with a question and a remark. >> >>> @@ -126,6 +130,8 @@ int arch_vcpu_create(struct vcpu *v) >>> >>> void arch_vcpu_destroy(struct vcpu *v) >>> { >>> + vcpu_timer_destroy(v); >> It feels pretty late to do this, yet I notice vcpu_teardown() doesn't invoke >> any per-arch function (yet). There's arch_domain_teardown(), though, which >> technically could do this for all vCPU-s in a domain. > > Why it isn't enough to be implicitly called by domain_destroy()? It's enough; what I wonder is why it's done so late. Technically anything that can be torn down in domain_kill() would better be torn down there already. Just to leave as little baggage as possible to the rest of the running system. For this particular one: If a domain was killed when some of its vCPU-s still had timers pending, why would those need keeping on the respective lists, and why would their handlers still need running once those timers expire? Jan