linux-kselftest.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sean Christopherson <seanjc@google.com>
To: Vishal Annapurve <vannapurve@google.com>
Cc: x86 <x86@kernel.org>, kvm list <kvm@vger.kernel.org>,
	LKML <linux-kernel@vger.kernel.org>,
	linux-kselftest@vger.kernel.org,
	Paolo Bonzini <pbonzini@redhat.com>,
	Vitaly Kuznetsov <vkuznets@redhat.com>,
	Wanpeng Li <wanpengli@tencent.com>,
	Jim Mattson <jmattson@google.com>, Joerg Roedel <joro@8bytes.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
	dave.hansen@linux.intel.com, "H . Peter Anvin" <hpa@zytor.com>,
	shauh@kernel.org, yang.zhong@intel.com, drjones@redhat.com,
	Ricardo Koller <ricarkol@google.com>,
	Aaron Lewis <aaronlewis@google.com>,
	wei.w.wang@intel.com,
	"Kirill A . Shutemov" <kirill.shutemov@linux.intel.com>,
	Jonathan Corbet <corbet@lwn.net>, Hugh Dickins <hughd@google.com>,
	Jeff Layton <jlayton@kernel.org>,
	"J . Bruce Fields" <bfields@fieldses.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Chao Peng <chao.p.peng@linux.intel.com>,
	Yu Zhang <yu.c.zhang@linux.intel.com>,
	Jun Nakajima <jun.nakajima@intel.com>,
	Dave Hansen <dave.hansen@intel.com>,
	Michael Roth <michael.roth@amd.com>,
	Quentin Perret <qperret@google.com>,
	Steven Price <steven.price@arm.com>,
	Andi Kleen <ak@linux.intel.com>,
	David Hildenbrand <david@redhat.com>,
	Andy Lutomirski <luto@kernel.org>,
	Vlastimil Babka <vbabka@suse.cz>, Marc Orr <marcorr@google.com>,
	Erdem Aktas <erdemaktas@google.com>,
	Peter Gonda <pgonda@google.com>,
	"Nikunj A. Dadhania" <nikunj@amd.com>,
	Austin Diviness <diviness@google.com>
Subject: Re: [RFC V2 PATCH 2/8] selftests: kvm: Add a basic selftest to test private memory
Date: Thu, 21 Jul 2022 21:16:10 +0000	[thread overview]
Message-ID: <YtnCGktd8S7gtAQJ@google.com> (raw)
In-Reply-To: <CAGtprH9BQkcJcpp=uEJJLwM-Z=cW9rsJ7iVKbjv_gisVj8EWGQ@mail.gmail.com>

On Thu, Jul 21, 2022, Vishal Annapurve wrote:
> On Wed, Jul 20, 2022 at 4:03 PM Sean Christopherson <seanjc@google.com> wrote:
> > ...
> > > + * which doesn't handle global offset table updates. Calling standard libc
> > > + * functions would normally result in referring to the global offset table.
> > > + * Adding O1 here seems to prohibit compiler from replacing the memory
> > > + * operations with standard libc functions such as memset.
> > > + */
> >
> > Eww.  We should either fix kvm_vm_elf_load() or override the problematic libc
> > variants.  Playing games with per-function attributes is not maintainable.
> >
> 
> I will try to spend more time on how kvm_vm_elf_load can be modified
> to handle GOT fixups in different scenarios including
> statically/dynamically linked sefltest binaries as I currently recall
> limited information here.
> 
> But modifying kvm_vm_elf_load to fixup GOT entries will be
> insufficient as guest VM code (possibly whole selftest binary) will
> need to be compiled with flags that allow memset/memcpy
> implementations to work with specific guest VM configurations e.g. AVX
> extension. Same concern is outlined in
> https://elixir.bootlin.com/linux/latest/source/tools/testing/selftests/kvm/lib/x86_64/svm.c#L64.
> 
> Would it be ok to maintain selftest binary compilation flags based on
> guest VM configurations?

No, we should instead define/implement versions of memset/memcpy that are
guaranteed to be guest-friendly, either explicitly by selftests are implicitly
by compiler builtins, e.g. see arch/x86/boot/string.h.

  reply	other threads:[~2022-07-21 21:16 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-11  0:08 [RFC V2 PATCH 0/8] selftests: KVM: selftests for fd-based approach of supporting private memory Vishal Annapurve
2022-05-11  0:08 ` [RFC V2 PATCH 1/8] selftests: kvm: Fix inline assembly for hypercall Vishal Annapurve
2022-05-12 17:31   ` Shuah Khan
2022-05-11  0:08 ` [RFC V2 PATCH 2/8] selftests: kvm: Add a basic selftest to test private memory Vishal Annapurve
2022-05-12 17:29   ` Shuah Khan
2022-07-20 23:03   ` Sean Christopherson
2022-07-21 20:24     ` Vishal Annapurve
2022-07-21 21:16       ` Sean Christopherson [this message]
2022-05-11  0:08 ` [RFC V2 PATCH 3/8] selftests: kvm: priv_memfd_test: Add support for memory conversion Vishal Annapurve
2022-05-12 17:40   ` Shuah Khan
2022-05-11  0:08 ` [RFC V2 PATCH 4/8] selftests: kvm: priv_memfd_test: Add shared access test Vishal Annapurve
2022-05-12 17:45   ` Shuah Khan
2022-05-11  0:08 ` [RFC V2 PATCH 5/8] selftests: kvm: Add implicit memory conversion tests Vishal Annapurve
2022-05-12 17:48   ` Shuah Khan
2022-05-11  0:08 ` [RFC V2 PATCH 6/8] selftests: kvm: Add KVM_HC_MAP_GPA_RANGE hypercall test Vishal Annapurve
2022-05-12 17:50   ` Shuah Khan
2022-05-11  0:08 ` [RFC V2 PATCH 7/8] selftests: kvm: Add hugepage support to priv_memfd_test suite Vishal Annapurve
2022-05-12 17:51   ` Shuah Khan
2022-05-11  0:08 ` [RFC V2 PATCH 8/8] selftests: kvm: priv_memfd: Add test avoiding double allocation Vishal Annapurve
2022-05-12 17:52   ` Shuah Khan
2022-05-11  0:08 ` [RFC V2 PATCH 8/8] selftests: kvm: priv_memfd: Add test without " Vishal Annapurve
2022-05-12 18:04 ` [RFC V2 PATCH 0/8] selftests: KVM: selftests for fd-based approach of supporting private memory Shuah Khan
2022-05-12 18:18   ` Vishal Annapurve
2022-07-20 22:19 ` Sean Christopherson

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=YtnCGktd8S7gtAQJ@google.com \
    --to=seanjc@google.com \
    --cc=aaronlewis@google.com \
    --cc=ak@linux.intel.com \
    --cc=akpm@linux-foundation.org \
    --cc=bfields@fieldses.org \
    --cc=bp@alien8.de \
    --cc=chao.p.peng@linux.intel.com \
    --cc=corbet@lwn.net \
    --cc=dave.hansen@intel.com \
    --cc=dave.hansen@linux.intel.com \
    --cc=david@redhat.com \
    --cc=diviness@google.com \
    --cc=drjones@redhat.com \
    --cc=erdemaktas@google.com \
    --cc=hpa@zytor.com \
    --cc=hughd@google.com \
    --cc=jlayton@kernel.org \
    --cc=jmattson@google.com \
    --cc=joro@8bytes.org \
    --cc=jun.nakajima@intel.com \
    --cc=kirill.shutemov@linux.intel.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=luto@kernel.org \
    --cc=marcorr@google.com \
    --cc=michael.roth@amd.com \
    --cc=mingo@redhat.com \
    --cc=nikunj@amd.com \
    --cc=pbonzini@redhat.com \
    --cc=pgonda@google.com \
    --cc=qperret@google.com \
    --cc=ricarkol@google.com \
    --cc=shauh@kernel.org \
    --cc=steven.price@arm.com \
    --cc=tglx@linutronix.de \
    --cc=vannapurve@google.com \
    --cc=vbabka@suse.cz \
    --cc=vkuznets@redhat.com \
    --cc=wanpengli@tencent.com \
    --cc=wei.w.wang@intel.com \
    --cc=x86@kernel.org \
    --cc=yang.zhong@intel.com \
    --cc=yu.c.zhang@linux.intel.com \
    /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;
as well as URLs for NNTP newsgroup(s).