From patchwork Tue Apr 23 14:31:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 13640166 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 7C418C4345F for ; Tue, 23 Apr 2024 14:31:59 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.710683.1110048 (Exim 4.92) (envelope-from ) id 1rzHBZ-0000Tk-Dk; Tue, 23 Apr 2024 14:31:53 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 710683.1110048; Tue, 23 Apr 2024 14:31:53 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rzHBZ-0000Td-B6; Tue, 23 Apr 2024 14:31:53 +0000 Received: by outflank-mailman (input) for mailman id 710683; Tue, 23 Apr 2024 14:31:52 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rzHBY-00082U-AH for xen-devel@lists.xenproject.org; Tue, 23 Apr 2024 14:31:52 +0000 Received: from mail-wm1-x32e.google.com (mail-wm1-x32e.google.com [2a00:1450:4864:20::32e]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 39107441-017e-11ef-b4bb-af5377834399; Tue, 23 Apr 2024 16:31:50 +0200 (CEST) Received: by mail-wm1-x32e.google.com with SMTP id 5b1f17b1804b1-4155819f710so47335975e9.2 for ; Tue, 23 Apr 2024 07:31:50 -0700 (PDT) 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 fl18-20020a05600c0b9200b0041ae0048b5dsm481577wmb.45.2024.04.23.07.31.49 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 23 Apr 2024 07:31:50 -0700 (PDT) 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: 39107441-017e-11ef-b4bb-af5377834399 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1713882710; x=1714487510; darn=lists.xenproject.org; h=content-transfer-encoding:in-reply-to:autocrypt:content-language :references:cc:to:from:subject:user-agent:mime-version:date :message-id:from:to:cc:subject:date:message-id:reply-to; bh=FaBzcTniCeLPDlfDE8HsE9EvmLilsBkel36WuSLRy1M=; b=EMgdggwI8sShHy3rL1SjS57lBu9RJhoiF6zZpgfo3MNB2EQM8co0hPqocMwRd+8hCS 1QdlqXCix91hVVxfMyzuBB55YCakidcxtznjGvh6Cjs3z+wdlV5NgtPUXJzTex4n7paC Gp7Qrrfroli3T6XIUrzLxi9V8PxbW3a2hLHCyA4QTBHj4b021KwykLvc8p9Ls7HXXKph pktl2fJTMBLfLYvZwp8e8xOT+culbWfaNLyGczG/4yI0qr70vh8PANsPj6PkotSqduZ7 vreo7kVpfxY/wK29D5nXubaHQD9sNj69n8anYxYRkVjecti4aIAM5VFoJAk1p0577xKV orEw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713882710; x=1714487510; h=content-transfer-encoding:in-reply-to:autocrypt:content-language :references:cc:to:from:subject:user-agent:mime-version:date :message-id:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=FaBzcTniCeLPDlfDE8HsE9EvmLilsBkel36WuSLRy1M=; b=s84Tdh3kz60Rx3lgapDy21JuEvY0VI+A0mplcKFhsDDPgoMZ33zVpe7h53j1aggc6u I6E8UbdKjGr9zr634W3t969AYHcenkjidOeF3XStosEvB35fvxi/QqpXY10q1pWm2IiU z0VwxxNF7J6VDjCefamLWhEJe4OFVplsnrCxjE6hdkBRKSqxhjkwag9RxBWJX+PlVo44 hsXEWd2S46VqJtC7fdAYHVkUDzQfR91STBBZ+ZcYLs3p6MTYOg5tAn5JjekA9N4KJjAw J/TKdf/7haHh+Hk/pUF7kntAvkbhFH2y+PD+UaLaZcazoEs4z9Ny9qf1vdMoDQnMUc4M MmAA== X-Gm-Message-State: AOJu0YzsChhdwETx6nn4YeJ0/RYr3m+YdKUhG89FN5rOC3TCZNCBMI1/ NRPUjhnCbEhNGoBZxXE7V4QPpRVs02r5zAEeYKk6VnnoCYk3jvEdaf3p0UDfXk0XDGOk/r0Jiu8 = X-Google-Smtp-Source: AGHT+IHRxjmp9hzeoObXZyflT9qVP9fTo2B7EerM/xNB+brJvEXoz5INBRgPhKuzsbsmi66KqGHClQ== X-Received: by 2002:a05:600c:1c0f:b0:41a:c170:701f with SMTP id j15-20020a05600c1c0f00b0041ac170701fmr1633663wms.38.1713882710369; Tue, 23 Apr 2024 07:31:50 -0700 (PDT) Message-ID: <296c3ecc-b04d-4734-a451-0d4f9ed312d4@suse.com> Date: Tue, 23 Apr 2024 16:31:49 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: [PATCH 1/4] x86/P2M: write_p2m_entry() is HVM-only anyway From: Jan Beulich To: "xen-devel@lists.xenproject.org" Cc: Andrew Cooper , =?utf-8?q?Roger_Pau_Monn?= =?utf-8?q?=C3=A9?= , George Dunlap References: <0d846228-323b-4427-87d1-684c3d0047c5@suse.com> Content-Language: en-US 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: <0d846228-323b-4427-87d1-684c3d0047c5@suse.com> The latest as of e2b2ff677958 ("x86/P2M: split out init/teardown functions") the function is obviously unreachable for PV guests. Hence the paging_mode_enabled(d) check is pointless. Further host mode of a vCPU is always set, by virtue of paging_vcpu_init() being part of vCPU creation. Hence the paging_get_hostmode() check is pointless. With that the v local variable is unnecessary too. Drop the "if()" conditional and its corresponding "else". Signed-off-by: Jan Beulich --- I have to confess that this if() has been puzzling me before. --- a/xen/arch/x86/mm/p2m-pt.c +++ b/xen/arch/x86/mm/p2m-pt.c @@ -110,12 +110,7 @@ static int write_p2m_entry(struct p2m_do unsigned int level) { struct domain *d = p2m->domain; - const struct vcpu *v = current; - if ( v->domain != d ) - v = d->vcpu ? d->vcpu[0] : NULL; - if ( likely(v && paging_mode_enabled(d) && paging_get_hostmode(v)) || - p2m_is_nestedp2m(p2m) ) { unsigned int oflags; mfn_t omfn; @@ -156,8 +151,6 @@ static int write_p2m_entry(struct p2m_do !perms_strictly_increased(oflags, l1e_get_flags(new))) ) p2m_flush_nestedp2m(d); } - else - safe_write_pte(p, new); return 0; } From patchwork Tue Apr 23 14:32:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 13640167 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 AB65BC4345F for ; Tue, 23 Apr 2024 14:32:25 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.710688.1110059 (Exim 4.92) (envelope-from ) id 1rzHBx-00013T-Qn; Tue, 23 Apr 2024 14:32:17 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 710688.1110059; Tue, 23 Apr 2024 14:32:17 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rzHBx-00013M-Nx; Tue, 23 Apr 2024 14:32:17 +0000 Received: by outflank-mailman (input) for mailman id 710688; Tue, 23 Apr 2024 14:32:16 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rzHBw-00082U-TL for xen-devel@lists.xenproject.org; Tue, 23 Apr 2024 14:32:16 +0000 Received: from mail-wm1-x335.google.com (mail-wm1-x335.google.com [2a00:1450:4864:20::335]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 47abb492-017e-11ef-b4bb-af5377834399; Tue, 23 Apr 2024 16:32:15 +0200 (CEST) Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-41a5b68ed0aso15415335e9.2 for ; Tue, 23 Apr 2024 07:32:15 -0700 (PDT) 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 fl18-20020a05600c0b9200b0041ae0048b5dsm481577wmb.45.2024.04.23.07.32.14 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 23 Apr 2024 07:32:14 -0700 (PDT) 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: 47abb492-017e-11ef-b4bb-af5377834399 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1713882735; x=1714487535; darn=lists.xenproject.org; h=content-transfer-encoding:in-reply-to:autocrypt:references:cc:to :from:content-language:subject:user-agent:mime-version:date :message-id:from:to:cc:subject:date:message-id:reply-to; bh=rxvduw49sEMo1AmOKfLcnwBmnciDEleJ9FmgDixVJkw=; b=USsnZDbuB44TcLaBj6Wnp8nCTHWxhmH2lbygjvciwDsuvW1nrrmTLiZzqO9rkzdnLh ID0t4e11t+RMwHrX0xYBGspbw1PDOIgQE1zUJChwSPG3NB0np2pijVN9MWL0v4bqEWcl pUgtlHHFfwP0+4IHeFuBtLuKUNJQlCj9XavcL7z7BXo8aGFyRyotGxjZF+imb2/ggUJD 5caoLin57MWj9yb1bkCaJBEXT2mOtBLyCcbzZHyQuStLs8C7dorNTQe/XEtkQDymahhd NGGHlwOldZzItAfTQ5LPd3vZdOk1295u0R+SrRuirmWC76JJGg+RNiFO4NIS4NPb+AS+ TL6g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713882735; x=1714487535; h=content-transfer-encoding:in-reply-to:autocrypt:references:cc:to :from:content-language:subject:user-agent:mime-version:date :message-id:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=rxvduw49sEMo1AmOKfLcnwBmnciDEleJ9FmgDixVJkw=; b=NOit2jfFs97oS2NTeVDKhrnTu5ed58K53rbjpBdmVp8NfLTDpVbM9I6nwemIIUgsaX RgBo6WKarLO5aNnxzAUIdacCcEnlgbv2W9f0kdyGrK7VJB1BdwpFvYWXoVQjNLvXkta5 1oSYhWfQLk3o0XIDWmAZ8GhhLsOKz+zcm9D43vTwESAOL0Fm0Q9rXVkhHI9cLAIYY82V 53H3ZF99f+/6ragn+keLbh4H8LJJl5VKlRna3IUXocHm7s4Ui6JXWnpJUMcwM+k6sc4C L2LB5gEclKHy58q40DAaubWf+bpiYDg4cJYl3Ukqg18WobndA0RjV8rEb5zlrAu4Vv5N pmCw== X-Gm-Message-State: AOJu0YyNLRN9H4dL+SUZIpXLmaTQg5yW8H0b6hgDkRKOJ5dyubwUCQKO LJ8y82bU/0bJJcjYVUERwcsxaQteorfD8yX6JVU/bfhbopcI+SRPaj36AM5nJCi0MTO0J68jKX4 = X-Google-Smtp-Source: AGHT+IEJc+Eu3hdLEKjEJgge/Jbryo6rZHXTd6WRUSDkXXMZiUPVZcAJQORr5j/lVcxqLE0mZVCfNA== X-Received: by 2002:a05:600c:1d15:b0:41a:41c8:d8e7 with SMTP id l21-20020a05600c1d1500b0041a41c8d8e7mr4598456wms.3.1713882734733; Tue, 23 Apr 2024 07:32:14 -0700 (PDT) Message-ID: <52b4b0d8-1761-45c7-b6e6-91e1c308209c@suse.com> Date: Tue, 23 Apr 2024 16:32:14 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: [PATCH 2/4] x86/P2M: un-indent write_p2m_entry() Content-Language: en-US From: Jan Beulich To: "xen-devel@lists.xenproject.org" Cc: Andrew Cooper , =?utf-8?q?Roger_Pau_Monn?= =?utf-8?q?=C3=A9?= , George Dunlap References: <0d846228-323b-4427-87d1-684c3d0047c5@suse.com> 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: <0d846228-323b-4427-87d1-684c3d0047c5@suse.com> Drop the inner scope that was left from earlier if/else removal. Take the opportunity and make the paging_unlock() invocation common to success and error paths, though. Signed-off-by: Jan Beulich Acked-by: Roger Pau Monné --- a/xen/arch/x86/mm/p2m-pt.c +++ b/xen/arch/x86/mm/p2m-pt.c @@ -110,49 +110,43 @@ static int write_p2m_entry(struct p2m_do unsigned int level) { struct domain *d = p2m->domain; - + unsigned int oflags; + mfn_t omfn; + int rc; + + paging_lock(d); + + if ( p2m->write_p2m_entry_pre && gfn != gfn_x(INVALID_GFN) ) + p2m->write_p2m_entry_pre(d, gfn, *p, new, level); + + oflags = l1e_get_flags(*p); + omfn = l1e_get_mfn(*p); + + rc = p2m_entry_modify(p2m, p2m_flags_to_type(l1e_get_flags(new)), + p2m_flags_to_type(oflags), l1e_get_mfn(new), + omfn, level); + if ( !rc ) { - unsigned int oflags; - mfn_t omfn; - int rc; - - paging_lock(d); - - if ( p2m->write_p2m_entry_pre && gfn != gfn_x(INVALID_GFN) ) - p2m->write_p2m_entry_pre(d, gfn, *p, new, level); - - oflags = l1e_get_flags(*p); - omfn = l1e_get_mfn(*p); - - rc = p2m_entry_modify(p2m, p2m_flags_to_type(l1e_get_flags(new)), - p2m_flags_to_type(oflags), l1e_get_mfn(new), - omfn, level); - if ( rc ) - { - paging_unlock(d); - return rc; - } - safe_write_pte(p, new); if ( p2m->write_p2m_entry_post ) p2m->write_p2m_entry_post(p2m, oflags); + } - paging_unlock(d); + paging_unlock(d); - if ( nestedhvm_enabled(d) && !p2m_is_nestedp2m(p2m) && - (oflags & _PAGE_PRESENT) && - !p2m_get_hostp2m(d)->defer_nested_flush && - /* - * We are replacing a valid entry so we need to flush nested p2ms, - * unless the only change is an increase in access rights. - */ - (!mfn_eq(omfn, l1e_get_mfn(new)) || - !perms_strictly_increased(oflags, l1e_get_flags(new))) ) - p2m_flush_nestedp2m(d); - } + if ( !rc && nestedhvm_enabled(d) && !p2m_is_nestedp2m(p2m) && + (oflags & _PAGE_PRESENT) && + !p2m_get_hostp2m(d)->defer_nested_flush && + /* + * We are replacing a valid entry so we need to flush nested p2ms, + * unless the only change is an increase in access rights. + */ + (!mfn_eq(omfn, l1e_get_mfn(new)) || + !perms_strictly_increased(oflags, l1e_get_flags(new))) ) + p2m_flush_nestedp2m(d); - return 0; + return rc; } // Find the next level's P2M entry, checking for out-of-range gfn's... From patchwork Tue Apr 23 14:32:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 13640168 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 B9098C4345F for ; Tue, 23 Apr 2024 14:32:43 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.710690.1110068 (Exim 4.92) (envelope-from ) id 1rzHCG-0001WN-2T; Tue, 23 Apr 2024 14:32:36 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 710690.1110068; Tue, 23 Apr 2024 14:32:36 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rzHCF-0001WG-W3; Tue, 23 Apr 2024 14:32:35 +0000 Received: by outflank-mailman (input) for mailman id 710690; Tue, 23 Apr 2024 14:32:34 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rzHCE-00082U-HQ for xen-devel@lists.xenproject.org; Tue, 23 Apr 2024 14:32:34 +0000 Received: from mail-wm1-x32e.google.com (mail-wm1-x32e.google.com [2a00:1450:4864:20::32e]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 52432252-017e-11ef-b4bb-af5377834399; Tue, 23 Apr 2024 16:32:33 +0200 (CEST) Received: by mail-wm1-x32e.google.com with SMTP id 5b1f17b1804b1-41a4f291f80so18825825e9.1 for ; Tue, 23 Apr 2024 07:32:33 -0700 (PDT) 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 fl18-20020a05600c0b9200b0041ae0048b5dsm481577wmb.45.2024.04.23.07.32.32 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 23 Apr 2024 07:32:32 -0700 (PDT) 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: 52432252-017e-11ef-b4bb-af5377834399 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1713882752; x=1714487552; darn=lists.xenproject.org; h=content-transfer-encoding:in-reply-to:autocrypt:references:cc:to :from:content-language:subject:user-agent:mime-version:date :message-id:from:to:cc:subject:date:message-id:reply-to; bh=UqfbDwnUwSfB2mqt9VJQheXNCjV8uwEuyxbCPQDuBZg=; b=Y1psqdjsMqN0Us8SpXkgaoZqMXtZHpSLs65bx7v3Rzmp3hcTP5eO23qv+UQYIB6mOG 4+u4vyzyxRIF0YE7JstSwfP6e9hbEiW/k5Zh2DZib1KZucmtUNkq5dr/TIBTAHil6IRK Vr3JNgKgfJg/T4/1tb2XE0mei6tMy4ERSi3vn9yty2S4dv74qvgX9EULqF4ADi9aBGws Z94qLkXma697DMP9rqo6l6aufGQ094Y+1otDg5+bWIk5/wFGezIxHPCGICcoPpUuIlGo rfxmH1fqN304rxDdMzYfI91tzHfh/nIvrD9fBoA4lybCiwt3PnuIqHtOGiUXqm6LHu+H 07Vw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713882752; x=1714487552; h=content-transfer-encoding:in-reply-to:autocrypt:references:cc:to :from:content-language:subject:user-agent:mime-version:date :message-id:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=UqfbDwnUwSfB2mqt9VJQheXNCjV8uwEuyxbCPQDuBZg=; b=QEbuZvwE4aY4zd8vXu6LIKTZJDO+owZcUccbz6xDIJpswW6/4myo7vfZAZNJRZErfF BruBWfXU+MBk9MfXv8DFckTjE5PwrLYCFSmm8jSJ2YsnH/DOGmNEti07E516aGXn+S9b GdfrftcCom8ld3cIWDHMrsBrCmPgpN7eclMQq7ggf6UxrTV4EeLTIdP0QgjvsrN1LKI2 7NQqBtxSaiqwjafVg6MVxAzOG1mdUVYVUqRQpD4j9pFW4wnLB0STjKK08eJlkBYgCcal DlpHVVBxMLQ5N9FR9VEdG3YN8emU+Ldt7vcu0w5+cENwE94E+ZxObJ2yMQ4mD68gBiND 16Bg== X-Gm-Message-State: AOJu0YzvVqzkXdZr2uLdRfEFoUkl5xjhbpGLD2h1hlNXfc3QvSPeqPCn 5q3PU2eI4xTkR0ORuY0h96rdYA/mxqE1sdtZaYyGpUnj21kEtrzGKek+AFhOdi56J4+qTn2lHt0 = X-Google-Smtp-Source: AGHT+IHu3HP7wLmspoWlz+cFqPiemlWMuXgZIHW+cU9H0awHdI4caRRCQ1twIyPtsW28bc2DjudTKg== X-Received: by 2002:a05:600c:1c0f:b0:41a:c170:701f with SMTP id j15-20020a05600c1c0f00b0041ac170701fmr1635411wms.38.1713882752571; Tue, 23 Apr 2024 07:32:32 -0700 (PDT) Message-ID: <67805c1f-7187-446c-a5c4-14be8f170f11@suse.com> Date: Tue, 23 Apr 2024 16:32:32 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: [PATCH 3/4] x86/paging: vCPU host mode is always set Content-Language: en-US From: Jan Beulich To: "xen-devel@lists.xenproject.org" Cc: Andrew Cooper , =?utf-8?q?Roger_Pau_Monn?= =?utf-8?q?=C3=A9?= , George Dunlap References: <0d846228-323b-4427-87d1-684c3d0047c5@suse.com> 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: <0d846228-323b-4427-87d1-684c3d0047c5@suse.com> ... thanks to paging_vcpu_init() being part of vCPU creation. Further if paging is enabled on a domain, it's also guaranteed to be either HAP or shadow. Drop respective unnecessary (parts of) conditionals. Signed-off-by: Jan Beulich Acked-by: Roger Pau Monné --- a/xen/arch/x86/mm/paging.c +++ b/xen/arch/x86/mm/paging.c @@ -937,19 +937,12 @@ void paging_dump_vcpu_info(struct vcpu * { printk(" paging assistance: "); if ( paging_mode_shadow(v->domain) ) - { - if ( paging_get_hostmode(v) ) - printk("shadowed %u-on-%u\n", - paging_get_hostmode(v)->guest_levels, - paging_get_hostmode(v)->shadow.shadow_levels); - else - printk("not shadowed\n"); - } - else if ( paging_mode_hap(v->domain) && paging_get_hostmode(v) ) + printk("shadowed %u-on-%u\n", + paging_get_hostmode(v)->guest_levels, + paging_get_hostmode(v)->shadow.shadow_levels); + else printk("hap, %u levels\n", paging_get_hostmode(v)->guest_levels); - else - printk("none\n"); } } From patchwork Tue Apr 23 14:33:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 13640169 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 8A0E2C4345F for ; Tue, 23 Apr 2024 14:33:20 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.710695.1110078 (Exim 4.92) (envelope-from ) id 1rzHCr-0002K4-9i; Tue, 23 Apr 2024 14:33:13 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 710695.1110078; Tue, 23 Apr 2024 14:33:13 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rzHCr-0002Jx-75; Tue, 23 Apr 2024 14:33:13 +0000 Received: by outflank-mailman (input) for mailman id 710695; Tue, 23 Apr 2024 14:33:11 +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 1rzHCp-0002IN-Oe for xen-devel@lists.xenproject.org; Tue, 23 Apr 2024 14:33:11 +0000 Received: from mail-wm1-x331.google.com (mail-wm1-x331.google.com [2a00:1450:4864:20::331]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 68a7f8bc-017e-11ef-909a-e314d9c70b13; Tue, 23 Apr 2024 16:33:10 +0200 (CEST) Received: by mail-wm1-x331.google.com with SMTP id 5b1f17b1804b1-41a442c9dcbso18490745e9.2 for ; Tue, 23 Apr 2024 07:33:10 -0700 (PDT) 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 fl18-20020a05600c0b9200b0041ae0048b5dsm481577wmb.45.2024.04.23.07.33.09 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 23 Apr 2024 07:33:10 -0700 (PDT) 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: 68a7f8bc-017e-11ef-909a-e314d9c70b13 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1713882790; x=1714487590; darn=lists.xenproject.org; h=content-transfer-encoding:in-reply-to:autocrypt:references:cc:to :from:content-language:subject:user-agent:mime-version:date :message-id:from:to:cc:subject:date:message-id:reply-to; bh=BFXNdq6YoYaequ8GhZeipZXfz1Szm9kVsf7MfcSDAGw=; b=B7VEUe+lMhdfjrmQzYoo5MbIZQSpGeCVkwG7ZzFU4j5+Xr014wVccC1AxJIau+B66n KtTGmE51cSQbFGXUTdZ2I8XMiGiRIqzulvynLvh6DLVpo8boa7EzIyB1mq4xSMDzKaAf bymhaok4XLkIKe/m/1sXTGtRoIBidAA3Rx6fObkzmGYtNgHZeXbo8tSeEjiGX/5K5cf+ rMgAXyikv66LfrF7cFRCFbcH/hfjZjSQ4o3QqR8Gd0YTO+/mNXmtSSEUKA3J8a2gRJAi g5a+CElhUf6cKImwIeRzGVYjeXm0PkTzK0tWvlMOkChCBuzjn+mI/kBK1ipLxNZHg67S NWag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713882790; x=1714487590; h=content-transfer-encoding:in-reply-to:autocrypt:references:cc:to :from:content-language:subject:user-agent:mime-version:date :message-id:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=BFXNdq6YoYaequ8GhZeipZXfz1Szm9kVsf7MfcSDAGw=; b=SkvCAjXHkn4deoDrMJCyk1KTNy33yS4PUN0o4V8QdW9bAtlSi5rgIHZaKs6NhzSZPa sNgYfIFP4OposW2jf3sSnVrDdUuMUICh1WBBfNuR7BG6XYHPyntjWkkFMmmdSA+6UELM pWaATMlNu0tr1VX7ybcWhBACpgFo5rdaDzCglH1a/Mo+XolKlMCpVhcvWqnG8MpfbBKR rZoQrowqhtStS4lTWJTed9MMmdEcZWL9FXqT+bqd6vBneHhta+yjbsv0k4Hommvo4DqZ O9HXa9zrjLXb/roT2syMjT8m4TrWmuudtjvDQkFBxPTNRxEs8UkTH9E1DdU6xX7ygMhA fkEQ== X-Gm-Message-State: AOJu0YxWbSAL7gb5EX8rGfQ7jytmjNUvBRy8ObcA/f24NXeJBgN47zTU YxcWbmxupyvOOZ2NyCNN0gUqH9d5Y4C2Qzp1i2fYcu3Qe/pC8+k+JeEVlAW6rEcwVsVMb8QP/AQ = X-Google-Smtp-Source: AGHT+IH4QlFNBVmeCCGL/PoVHIfnC99naWmpwVMbrulsdRX9vlXd2W1Zm1HJYRSMV8b8NdXmyofDrQ== X-Received: by 2002:a05:600c:348e:b0:41a:b961:9495 with SMTP id a14-20020a05600c348e00b0041ab9619495mr1366338wmq.25.1713882790229; Tue, 23 Apr 2024 07:33:10 -0700 (PDT) Message-ID: Date: Tue, 23 Apr 2024 16:33:09 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: [PATCH 4/4] x86/shadow: correct shadow_vcpu_init()'s comment Content-Language: en-US From: Jan Beulich To: "xen-devel@lists.xenproject.org" Cc: Andrew Cooper , =?utf-8?q?Roger_Pau_Monn?= =?utf-8?q?=C3=A9?= , George Dunlap , Tim Deegan References: <0d846228-323b-4427-87d1-684c3d0047c5@suse.com> 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: <0d846228-323b-4427-87d1-684c3d0047c5@suse.com> As of the commit referenced below the update_paging_modes() hook is per- domain and hence also set (already) during domain construction. Fixes: d0816a9085b5 ("x86/paging: move update_paging_modes() hook") Signed-off-by: Jan Beulich Acked-by: Roger Pau Monné --- a/xen/arch/x86/mm/shadow/common.c +++ b/xen/arch/x86/mm/shadow/common.c @@ -99,11 +99,12 @@ int shadow_domain_init(struct domain *d) return 0; } -/* Setup the shadow-specfic parts of a vcpu struct. Note: The most important - * job is to initialize the update_paging_modes() function pointer, which is - * used to initialized the rest of resources. Therefore, it really does not - * matter to have v->arch.paging.mode pointing to any mode, as long as it can - * be compiled. +/* + * Setup the shadow-specific parts of a vcpu struct. Note: The + * update_paging_modes() function pointer, which is used to initialize other + * resources, was already set during domain creation. Therefore it really does + * not matter to have v->arch.paging.mode pointing to any (legitimate) mode, + * as long as it can be compiled. */ void shadow_vcpu_init(struct vcpu *v) {