mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Edgecombe, Rick P" <rick.p.edgecombe@intel.com>
To: "Hansen, Dave" <dave.hansen@intel.com>,
	"bp@alien8.de" <bp@alien8.de>, "Huang, Kai" <kai.huang@intel.com>,
	"peterz@infradead.org" <peterz@infradead.org>,
	"hpa@zytor.com" <hpa@zytor.com>,
	"mingo@redhat.com" <mingo@redhat.com>,
	"kirill.shutemov@linux.intel.com"
	<kirill.shutemov@linux.intel.com>,
	"tglx@linutronix.de" <tglx@linutronix.de>
Cc: "pbonzini@redhat.com" <pbonzini@redhat.com>,
	"seanjc@google.com" <seanjc@google.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"x86@kernel.org" <x86@kernel.org>
Subject: Re: [PATCH] x86/virt/tdx: Further fix tdh_vp_enter() calls instrumentable code warning
Date: Thu, 26 Jun 2025 15:07:41 +0000	[thread overview]
Message-ID: <b7ee10745a6ab4335229e56fa401e505ecc7e1c9.camel@intel.com> (raw)
In-Reply-To: <1f738756819f046feaac2e89e08b87f93927cb06.camel@intel.com>

On Thu, 2025-06-26 at 01:24 +0000, Huang, Kai wrote:
> > > 
> > > To fix the second problem, change tdx_tdvpr_pa() to use
> > > PFN_PHYS(page_to_pfn()) instead of page_to_phys() so that there will be
> > > no more function call inside tdx_tdvpr_pa()[*].
> > 
> > To check my understanding, page_to_pfn() on CONFIG_SPARSEMEM_VMEMMAP or
> > CONFIG_FLATMEM has no function calls, but on CONFIG_SPARSEMEM, it does. We
> > are
> > counting on x86_64 to not use CONFIG_SPARSEMEM?
> 
> Yes.  Please see include/asm-generic/memory_model.h.

It's a little brittle, but the compiler should warn at least.

> 
> > 
> > > 
> > > The TDVPR page is always an actual page out of page allocator, so the
> > > additional warning around pfn_valid() check in page_to_phys() doesn't
> > > help a lot anyway.  It's not worth complicating the code for such
> > > warning when CONFIG_DEBUG_VIRTUAL=y.
> > > 
> > > [*] Since commit cba5d9b3e99d ("x86/mm/64: Make SPARSEMEM_VMEMMAP the
> > >     only memory model") page_to_pfn() has been a simple macro without
> > >     any function call.
> > > 
> > > Fixes: e9f17038d814 ("x86/tdx: mark tdh_vp_enter() as __flatten")
> > > Signed-off-by: Kai Huang <kai.huang@intel.com>
> > 
> > Otherwise, LGTM.
> 
> Is this a RB? :-)

Yes, I think this problem has been annoying. This is a decent solution all
things considered.

Reviewed-by: Rick Edgecombe <rick.p.edgecombe@intel.com>

      reply	other threads:[~2025-06-26 15:07 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-24 10:13 Kai Huang
2025-06-25 23:56 ` Edgecombe, Rick P
2025-06-26  1:24   ` Huang, Kai
2025-06-26 15:07     ` Edgecombe, Rick P [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b7ee10745a6ab4335229e56fa401e505ecc7e1c9.camel@intel.com \
    --to=rick.p.edgecombe@intel.com \
    --cc=bp@alien8.de \
    --cc=dave.hansen@intel.com \
    --cc=hpa@zytor.com \
    --cc=kai.huang@intel.com \
    --cc=kirill.shutemov@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peterz@infradead.org \
    --cc=seanjc@google.com \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®