[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <YtnCGktd8S7gtAQJ@google.com>
Date: Thu, 21 Jul 2022 21:16:10 +0000
From: Sean Christopherson <seanjc@...gle.com>
To: Vishal Annapurve <vannapurve@...gle.com>
Cc: x86 <x86@...nel.org>, kvm list <kvm@...r.kernel.org>,
LKML <linux-kernel@...r.kernel.org>,
linux-kselftest@...r.kernel.org,
Paolo Bonzini <pbonzini@...hat.com>,
Vitaly Kuznetsov <vkuznets@...hat.com>,
Wanpeng Li <wanpengli@...cent.com>,
Jim Mattson <jmattson@...gle.com>,
Joerg Roedel <joro@...tes.org>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
dave.hansen@...ux.intel.com, "H . Peter Anvin" <hpa@...or.com>,
shauh@...nel.org, yang.zhong@...el.com, drjones@...hat.com,
Ricardo Koller <ricarkol@...gle.com>,
Aaron Lewis <aaronlewis@...gle.com>, wei.w.wang@...el.com,
"Kirill A . Shutemov" <kirill.shutemov@...ux.intel.com>,
Jonathan Corbet <corbet@....net>,
Hugh Dickins <hughd@...gle.com>,
Jeff Layton <jlayton@...nel.org>,
"J . Bruce Fields" <bfields@...ldses.org>,
Andrew Morton <akpm@...ux-foundation.org>,
Chao Peng <chao.p.peng@...ux.intel.com>,
Yu Zhang <yu.c.zhang@...ux.intel.com>,
Jun Nakajima <jun.nakajima@...el.com>,
Dave Hansen <dave.hansen@...el.com>,
Michael Roth <michael.roth@....com>,
Quentin Perret <qperret@...gle.com>,
Steven Price <steven.price@....com>,
Andi Kleen <ak@...ux.intel.com>,
David Hildenbrand <david@...hat.com>,
Andy Lutomirski <luto@...nel.org>,
Vlastimil Babka <vbabka@...e.cz>,
Marc Orr <marcorr@...gle.com>,
Erdem Aktas <erdemaktas@...gle.com>,
Peter Gonda <pgonda@...gle.com>,
"Nikunj A. Dadhania" <nikunj@....com>,
Austin Diviness <diviness@...gle.com>
Subject: Re: [RFC V2 PATCH 2/8] selftests: kvm: Add a basic selftest to test
private memory
On Thu, Jul 21, 2022, Vishal Annapurve wrote:
> On Wed, Jul 20, 2022 at 4:03 PM Sean Christopherson <seanjc@...gle.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.
Powered by blists - more mailing lists