From: Sean Christopherson <seanjc@google.com>
To: Maxim Levitsky <mlevitsk@redhat.com>
Cc: kvm@vger.kernel.org, Kieran Bingham <kbingham@kernel.org>,
Jan Kiszka <jan.kiszka@siemens.com>,
Andrew Jones <drjones@redhat.com>,
Jonathan Corbet <corbet@lwn.net>,
Vitaly Kuznetsov <vkuznets@redhat.com>,
Ingo Molnar <mingo@redhat.com>,
Thomas Gleixner <tglx@linutronix.de>,
"maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)"
<x86@kernel.org>, Johannes Berg <johannes.berg@intel.com>,
Wanpeng Li <wanpengli@tencent.com>,
"H. Peter Anvin" <hpa@zytor.com>, Jessica Yu <jeyu@kernel.org>,
Jim Mattson <jmattson@google.com>,
Paolo Bonzini <pbonzini@redhat.com>,
Joerg Roedel <joro@8bytes.org>,
Yang Weijiang <weijiang.yang@intel.com>,
linux-kernel@vger.kernel.org, Borislav Petkov <bp@alien8.de>,
"open list:KERNEL SELFTEST FRAMEWORK"
<linux-kselftest@vger.kernel.org>,
"open list:DOCUMENTATION" <linux-doc@vger.kernel.org>,
Shuah Khan <shuah@kernel.org>,
Andrew Morton <akpm@linux-foundation.org>,
Borislav Petkov <bp@suse.de>
Subject: Re: [PATCH v3 2/6] KVM: x86: add force_intercept_exceptions_mask
Date: Tue, 8 Mar 2022 23:37:46 +0000 [thread overview]
Message-ID: <YifoysEvfnQgq59A@google.com> (raw)
In-Reply-To: <0cdac80177eea408b7e316bd1fc4c0c5839ba1d4.camel@redhat.com>
On Tue, Feb 08, 2022, Maxim Levitsky wrote:
> On Thu, 2021-09-02 at 16:56 +0000, Sean Christopherson wrote:
> > Assuming this hasn't been abandoned...
> >
> > On Wed, Aug 11, 2021, Maxim Levitsky wrote:
> > > This parameter will be used by VMX and SVM code to force
> > > interception of a set of exceptions, given by a bitmask
> > > for guest debug and/or kvm debug.
> > >
> > > This is based on an idea first shown here:
> > > https://patchwork.kernel.org/project/kvm/patch/20160301192822.GD22677@pd.tnic/
> > >
> > > CC: Borislav Petkov <bp@suse.de>
> > > Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com>
> > > ---
> > > arch/x86/kvm/x86.c | 3 +++
> > > arch/x86/kvm/x86.h | 2 ++
> > > 2 files changed, 5 insertions(+)
> > >
> > > diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
> > > index fdc0c18339fb..092e2fad3c0d 100644
> > > --- a/arch/x86/kvm/x86.c
> > > +++ b/arch/x86/kvm/x86.c
> > > @@ -184,6 +184,9 @@ module_param(force_emulation_prefix, bool, S_IRUGO);
> > > int __read_mostly pi_inject_timer = -1;
> > > module_param(pi_inject_timer, bint, S_IRUGO | S_IWUSR);
> > >
> > > +uint force_intercept_exceptions_mask;
> > > +module_param(force_intercept_exceptions_mask, uint, S_IRUGO | S_IWUSR);
> >
> > Use octal permissions. This also can't be a simple writable param, at least not
> > without a well-documented disclaimer, as there's no guarantee a vCPU will update
> > its exception bitmap in a timely fashion. An alternative to a module param would
> > be to extend/add a per-VM ioctl(), e.g. maybe KVM_SET_GUEST_DEBUG? The downside
> > of an ioctl() is that it would require userspace enabling :-/
> >
>
> All other module params in this file use macros for permissions, that is why
> I used them too.
>
> I'll add a comment with a disclaimer here - this is only for debug.
> I strongly don't want to have this as ioctl as that will indeed need qemu patches,
> not to mention things like unit tests and which don't even always use qemu.
>
> Or I can make this parameter read-only. I don't mind reloading kvm module when
> I change this parameter.
Oh! We can force an update, a la nx_huge_pages, where the setter loops through
all VMs and does a kvm_make_all_cpus_request() to instruct vCPUs to update their
bitmaps. Requires a new request, but that doesn't seem like a huge deal, and it
might help pave the way for adding more debug hooks for developers.
The param should also be "unsafe".
E.g. something like
static const struct kernel_param_ops force_ex_intercepts_ops = {
.set = set_force_exception_intercepts,
.get = get_force_exception_intercepts,
};
module_param_cb_unsafe(force_exception_intercepts, &force_ex_intercepts_ops,
&force_exception_intercepts, 0644);
next prev parent reply other threads:[~2022-03-09 1:08 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-11 12:29 [PATCH v3 0/6] KVM: my debug patch queue Maxim Levitsky
2021-08-11 12:29 ` [PATCH v3 1/6] KVM: SVM: split svm_handle_invalid_exit Maxim Levitsky
2021-08-11 12:29 ` [PATCH v3 2/6] KVM: x86: add force_intercept_exceptions_mask Maxim Levitsky
2021-09-02 16:56 ` Sean Christopherson
2022-02-08 14:34 ` Maxim Levitsky
2022-03-08 23:37 ` Sean Christopherson [this message]
2022-03-09 12:31 ` Maxim Levitsky
2022-03-09 14:03 ` Paolo Bonzini
2022-03-09 15:40 ` Sean Christopherson
2021-08-11 12:29 ` [PATCH v3 3/6] KVM: SVM: implement force_intercept_exceptions_mask Maxim Levitsky
2021-08-11 14:26 ` Maxim Levitsky
2021-09-02 17:34 ` Sean Christopherson
2022-02-08 14:35 ` Maxim Levitsky
2021-08-11 12:29 ` [PATCH v3 4/6] scripts/gdb: rework lx-symbols gdb script Maxim Levitsky
2021-08-11 12:29 ` [PATCH v3 5/6] KVM: x86: implement KVM_GUESTDBG_BLOCKIRQ Maxim Levitsky
2021-08-11 12:29 ` [PATCH v3 6/6] KVM: selftests: test KVM_GUESTDBG_BLOCKIRQ Maxim Levitsky
2021-09-06 11:20 ` Paolo Bonzini
2021-09-06 21:03 ` Maxim Levitsky
2021-11-01 15:43 ` Vitaly Kuznetsov
2021-11-01 16:19 ` Maxim Levitsky
2021-11-01 23:21 ` Sean Christopherson
2021-11-02 10:46 ` Vitaly Kuznetsov
2021-11-02 15:53 ` Sean Christopherson
2021-11-02 16:18 ` Vitaly Kuznetsov
2021-11-02 18:45 ` Sean Christopherson
2021-11-03 9:04 ` Maxim Levitsky
2021-08-11 13:10 ` [PATCH v3 0/6] KVM: my debug patch queue Paolo Bonzini
2021-08-11 13:22 ` Maxim Levitsky
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=YifoysEvfnQgq59A@google.com \
--to=seanjc@google.com \
--cc=akpm@linux-foundation.org \
--cc=bp@alien8.de \
--cc=bp@suse.de \
--cc=corbet@lwn.net \
--cc=drjones@redhat.com \
--cc=hpa@zytor.com \
--cc=jan.kiszka@siemens.com \
--cc=jeyu@kernel.org \
--cc=jmattson@google.com \
--cc=johannes.berg@intel.com \
--cc=joro@8bytes.org \
--cc=kbingham@kernel.org \
--cc=kvm@vger.kernel.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=mlevitsk@redhat.com \
--cc=pbonzini@redhat.com \
--cc=shuah@kernel.org \
--cc=tglx@linutronix.de \
--cc=vkuznets@redhat.com \
--cc=wanpengli@tencent.com \
--cc=weijiang.yang@intel.com \
--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;
as well as URLs for NNTP newsgroup(s).