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 D37EEEE57E5 for ; Wed, 31 Dec 2025 08:28:00 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.1194523.1512905 (Exim 4.92) (envelope-from ) id 1varYd-0001pC-PS; Wed, 31 Dec 2025 08:27:51 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 1194523.1512905; Wed, 31 Dec 2025 08:27:51 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1varYd-0001p5-MR; Wed, 31 Dec 2025 08:27:51 +0000 Received: by outflank-mailman (input) for mailman id 1194523; Wed, 31 Dec 2025 08:27:50 +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 1varYc-0001os-0q for xen-devel@lists.xenproject.org; Wed, 31 Dec 2025 08:27:50 +0000 Received: from mail-ed1-x535.google.com (mail-ed1-x535.google.com [2a00:1450:4864:20::535]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 9719126c-e622-11f0-b15d-2bf370ae4941; Wed, 31 Dec 2025 09:27:48 +0100 (CET) Received: by mail-ed1-x535.google.com with SMTP id 4fb4d7f45d1cf-64dfb22c7e4so7367764a12.1 for ; Wed, 31 Dec 2025 00:27:48 -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 4fb4d7f45d1cf-64b91599605sm36937041a12.23.2025.12.31.00.27.47 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 31 Dec 2025 00:27:47 -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: 9719126c-e622-11f0-b15d-2bf370ae4941 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1767169668; x=1767774468; 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=fobpSK9AUXphPAhG1PyM5Pwgt4TvSHa2X/lrd8clEqM=; b=aIteteG8NdbWENjFWnS8zke9aG+mLSegZ/WJwUwY0JfykdaJ7YaRRE3XQ96yk+/HXW AuTZvGJUeipgaK0fX1JjWwJ/uaCl2JIlWFfe5WBIMgYjvt4rk+J923QVNCw8us27Bf93 qYT/GbPEhqS89YobJtQbSzjgqQ9RWOs2Hhbslo4mSsxbQ1hfO8qwp+1163VJa+lyodNy nv0Hxz4bTe0+sd+6mhkJsttoRe71mTh11KI8ICwB5aKxRjSoCyy5B2BWpwS4sS2+1tnL NM5jI5kOG3eYYFoFdxVYmOxSM6nuQP4XZ5c8aIUm7Rw6WseWWXEksuk8SDBD2E4SWjys 27/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1767169668; x=1767774468; 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=fobpSK9AUXphPAhG1PyM5Pwgt4TvSHa2X/lrd8clEqM=; b=qY+VmKZeT3dY4T6obYboNEgi3HoqPhc475cQPBkRatm1z8Aw/eAqTNTBRe554pVZ92 icT9wO3d+8FZ+7eF4y093uCvVaq0qD7l8Qc9Qw3JI6bI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urOY4EmCLTTRinr0c5I0yvFw6GWfQ== X-Received: by 2002:a17:907:70d7:b0:b80:1403:764c with SMTP id a640c23a62f3a-b80205e6bd3mr3024207366b.24.1767169668174; Wed, 31 Dec 2025 00:27:48 -0800 (PST) Message-ID: <096a8105-667e-43a6-856f-3ed52fb1c0a0@gmail.com> Date: Wed, 31 Dec 2025 09:27:47 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v4 2/4] xen/arm: optimize the size of struct vcpu To: "Orzel, Michal" , xen-devel@lists.xenproject.org Cc: Stefano Stabellini , Julien Grall , Bertrand Marquis , Volodymyr Babchuk , Andrew Cooper References: <0756ee97dd47f6acdefe593694b743eb6bfefacb.1766504313.git.oleksii.kurochko@gmail.com> <9f2c9e4a-64e3-4e5e-b5da-976ab433f6cd@amd.com> <9f343323-2743-4bd6-82de-afe3b48adb70@amd.com> Content-Language: en-US From: Oleksii Kurochko In-Reply-To: <9f343323-2743-4bd6-82de-afe3b48adb70@amd.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 12/29/25 12:10 PM, Orzel, Michal wrote: > > On 29/12/2025 12:08, Orzel, Michal wrote: >> >> On 23/12/2025 18:01, Oleksii Kurochko wrote: >>> When CONFIG_NEW_VGIC=y and CONFIG_ARM_64=y, the size of struct vcpu >>> exceeds one page, which requires allocating two pages and led to the >>> introduction of MAX_PAGES_PER_VCPU. > Also, I think it would be better to drop MAX_PAGES_PER_VCPU in this patch. Then I'll update alloc_vcpu_struct() and free_vcpu_struct() to: struct vcpu *alloc_vcpu_struct(const struct domain *d) { struct vcpu *v; - BUILD_BUG_ON(sizeof(*v) > MAX_PAGES_PER_VCPU * PAGE_SIZE); - v = alloc_xenheap_pages(get_order_from_bytes(sizeof(*v)), 0); + BUILD_BUG_ON(sizeof(*v) > PAGE_SIZE); + v = alloc_xenheap_pages(0, 0); if ( v != NULL ) - { - unsigned int i; - - for ( i = 0; i < DIV_ROUND_UP(sizeof(*v), PAGE_SIZE); i++ ) - clear_page((void *)v + i * PAGE_SIZE); - } + clear_page(v); return v; @@ -503,5 +488,5 @@ struct vcpu *alloc_vcpu_struct(const struct domain *d) void free_vcpu_struct(struct vcpu *v) { - free_xenheap_pages(v, get_order_from_bytes(sizeof(*v))); + free_xenheap_page(v); } Thanks. ~ Oleksii