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

Re: [XEN PATCH v4 02/14] x86/altp2m: add static inline stub for altp2m_vcpu_idx()


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: Sergiy Kibrik <sergiy_kibrik@xxxxxxxx>
  • Date: Fri, 19 Jul 2024 13:25:37 +0300
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=epam.com; dmarc=pass action=none header.from=epam.com; dkim=pass header.d=epam.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=JXNt+dP5yqQ5aS8tLzvcmScu7fdKdFrX4XddTGOPoNI=; b=RTsEc8HU5c9RTo2/H8S1z53SQV306AEOaVsYi7VST5eYc8LsULYPjHW6qroNkhYot3bDvRbcq/zefGv+gi4ayVZsDgzfNgRAVlORQOvzcN/TbZz+WobQhcwN8CW6CKyPK4NnUiux4V6dhSS4b1tX9Nw5bXML5aglSPyNOcL4zJTXrSYLtjd8YBF0O8m5+97qqz31YYNumFzJXty0PiztfQnHhwp7RSkos6MCeyh2EYmoEk8Dy67zdFlElp0HSw7S6UXbiBOjjs2IOGOAXRDNrwb4yp/GxTIC4wy49itt/EEnP/6vp/mtNOxA4szLw1sppHuIdzXBdddHlD42JXMZpw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=NnAggtMaLfnm/kmHQz8ADUMiQusZjkwK0DzIwm495dpynXQS9CdIjKklwpXjTfFYomf05PVLiUY+oYTULaEv7AojRaPakrLVop45vAWssd1Q9gMlDt9YZYzzg5Xs0yG3yFoGjipUTSyg5TCKtt+AMtewKHsCFUGewMAY85lKH5XKr4bIBSt9sMV9tnTwBXmtl5BS+OhqOgBocRFP9mi1BVYJVvZYxibV2QDeFSCZ4UnXNoqSLqkqwVkhUT1S3q6GwEgVTA1mwrZLMrE9+4q4TH2N5WVn/uBoUnmWm6Bx/RLD8jiDBW537vJOCo4b0AtbUqc8/Atko8AmIHg1at5Yvg==
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Xenia Ragiadakou <xenia.ragiadakou@xxxxxxx>, Tamas K Lengyel <tamas@xxxxxxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Fri, 19 Jul 2024 10:26:02 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

09.07.24 10:09, Jan Beulich:
On 09.07.2024 07:48, Sergiy Kibrik wrote:
The stub just returns 0 due to implementation of  p2m_get_mem_access() for
x86 & ARM expects it to be 0 when altp2m not active or not implemented.

The separate stub is favoured over dynamic check for alt2pm availability
inside regular altp2m_vcpu_idx() because this way we retain the possibility
to later put the whole struct altp2mvcpu under CONFIG_ALTP2M.

The purpose of the change is later to be able to disable altp2m support and
exclude its code from the build completely, when not supported by target
platform (as of now it's implemented for Intel EPT only).

Signed-off-by: Sergiy Kibrik <Sergiy_Kibrik@xxxxxxxx>

Yet what doesn't become clear is why 0 is a valid value to return. On the
surface 0 is a valid index when altp2m is enabled. In which case it
couldn't be used (without clarification) when altp2m is disabled.


I looked into it a bit more and found your concerns to be valid -- indeed altp2m_vcpu_idx() should not return valid index when altp2m not supported. In fact it seems that this routine should not even be called when altp2m is not active -- all but one call sites check altp2m_active() first, and there's stub in include/asm-generic/altp2m.h to block accidental calls to it.

So I think about falling back to v2 of this patch i.e. to guard that one out of line call in hvm_monitor_check_p2m() but with better patch description:

https://lore.kernel.org/xen-devel/01767c3f98a88999d4b8ed3ae742ad66a0921ba3.1715761386.git.Sergiy_Kibrik@xxxxxxxx/

would that be acceptable ?

  -Sergiy



 


Rackspace

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