linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Marc Orr <marcorr@google.com>
To: dave.hansen@intel.com
Cc: kvm@vger.kernel.org, Jim Mattson <jmattson@google.com>,
	David Rientjes <rientjes@google.com>,
	Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>,
	linux-mm@kvack.org, akpm@linux-foundation.org,
	pbonzini@redhat.com, rkrcmar@redhat.com, willy@infradead.org,
	sean.j.christopherson@intel.com, dave.hansen@linux.intel.com,
	Wanpeng Li <kernellwp@gmail.com>
Subject: Re: [kvm PATCH v6 2/2] kvm: x86: Dynamically allocate guest_fpu
Date: Thu, 1 Nov 2018 10:35:11 -0700	[thread overview]
Message-ID: <CAA03e5EU9j3tCLH=ZU8T4vz_N=D+2os_s8VcAYjC-o9cu-TJ0g@mail.gmail.com> (raw)
In-Reply-To: <86c27c0c-1326-c757-9b43-251f2290182b@intel.com>

> On 10/31/18 4:49 PM, Marc Orr wrote:
> > +     if (!boot_cpu_has(X86_FEATURE_FPU) || !boot_cpu_has(X86_FEATURE_FXSR)) {
> > +             printk(KERN_ERR "kvm: inadequate fpu\n");
> > +             r = -EOPNOTSUPP;
> > +             goto out;
> > +     }
>
> It would be nice to have a comment about _why_ this is inadequate.

Ack. I'll uptdate the patch.

> >       r = -ENOMEM;
> > +     x86_fpu_cache = kmem_cache_create_usercopy(
> > +                             "x86_fpu",
>
> For now, this should probably be kvm_x86_fpu since it's not used as a
> generic x86 thing, yet.
>
> Also, why is this a "usercopy"?  "fpu_kernel_xstate_size" includes (or
> will soon include) supervisor state which can never be copied to
> userspace.  If this structure is going out to userspace, that tells me
> we might instead want fpu_user_xstate_size, *or* we want the
> non-usercopy variant.

Good question. Configuring the usercopy kmem cache to restrict access
beyond fpu_user_xstate_size bytes (rather than fpu_kernel_xstate_size
bytes) from the beginning of the state field seems intuitive to me,
but I'm honestly not familiar with what user space expects KVM to
return through the ioctls. Can someone familiar with this suggest what
to do? Otherwise, I can update the patch to use the non-usercopy
variant.

  reply	other threads:[~2018-11-01 17:35 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-31 23:49 [kvm PATCH v6 0/2] shrink vcpu_vmx down to order 2 Marc Orr
2018-10-31 23:49 ` [kvm PATCH v6 1/2] kvm: x86: Use task structs fpu field for user Marc Orr
2018-10-31 23:49 ` [kvm PATCH v6 2/2] kvm: x86: Dynamically allocate guest_fpu Marc Orr
2018-11-01 17:09   ` Dave Hansen
2018-11-01 17:35     ` Marc Orr [this message]
2018-11-05 10:08       ` Paolo Bonzini
2018-11-05  5:04   ` [LKP] [kvm] ac347c1bc8: WARNING:at_mm/slab_common.c:#kmem_cache_create_usercopy kernel test robot
2021-05-21 20:58 ` [kvm PATCH v6 0/2] shrink vcpu_vmx down to order 2 Jim Mattson
2021-05-24 12:50   ` Paolo Bonzini
2021-05-24 22:44     ` Sean Christopherson
2021-05-24 23:01       ` Jim Mattson
2021-05-25  0:00         ` 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='CAA03e5EU9j3tCLH=ZU8T4vz_N=D+2os_s8VcAYjC-o9cu-TJ0g@mail.gmail.com' \
    --to=marcorr@google.com \
    --cc=akpm@linux-foundation.org \
    --cc=dave.hansen@intel.com \
    --cc=dave.hansen@linux.intel.com \
    --cc=jmattson@google.com \
    --cc=kernellwp@gmail.com \
    --cc=konrad.wilk@oracle.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=pbonzini@redhat.com \
    --cc=rientjes@google.com \
    --cc=rkrcmar@redhat.com \
    --cc=sean.j.christopherson@intel.com \
    --cc=willy@infradead.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