public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Sean Christopherson <seanjc@google.com>
To: Maxim Levitsky <mlevitsk@redhat.com>
Cc: kvm@vger.kernel.org, Cathy Avery <cavery@redhat.com>,
	Paolo Bonzini <pbonzini@redhat.com>
Subject: Re: [kvm-unit-tests PATCH 01/16] x86: make irq_enable avoid the interrupt shadow
Date: Mon, 24 Oct 2022 22:49:34 +0000	[thread overview]
Message-ID: <Y1cWfiKayXy5xvji@google.com> (raw)
In-Reply-To: <a52dfb9b126354f0ec6a3f6cb514cc5e426b22ae.camel@redhat.com>

On Mon, Oct 24, 2022, Maxim Levitsky wrote:
> On Thu, 2022-10-20 at 18:01 +0000, Sean Christopherson wrote:
> > On Thu, Oct 20, 2022, Maxim Levitsky wrote:
> > > Tests that need interrupt shadow can't rely on irq_enable function anyway,
> > > as its comment states,  and it is useful to know for sure that interrupts
> > > are enabled after the call to this function.
> > > 
> > > Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com>
> > > ---
> > >  lib/x86/processor.h       | 9 ++++-----
> > >  x86/apic.c                | 1 -
> > >  x86/ioapic.c              | 1 -
> > >  x86/svm_tests.c           | 9 ---------
> > >  x86/tscdeadline_latency.c | 1 -
> > >  x86/vmx_tests.c           | 7 -------
> > >  6 files changed, 4 insertions(+), 24 deletions(-)
> > > 
> > > diff --git a/lib/x86/processor.h b/lib/x86/processor.h
> > > index 03242206..9db07346 100644
> > > --- a/lib/x86/processor.h
> > > +++ b/lib/x86/processor.h
> > > @@ -720,13 +720,12 @@ static inline void irq_disable(void)
> > >         asm volatile("cli");
> > >  }
> > >  
> > > -/* Note that irq_enable() does not ensure an interrupt shadow due
> > > - * to the vagaries of compiler optimizations.  If you need the
> > > - * shadow, use a single asm with "sti" and the instruction after it.
> > > - */
> > >  static inline void irq_enable(void)
> > >  {
> > > -       asm volatile("sti");
> > > +       asm volatile(
> > > +                       "sti \n\t"
> > 
> > Formatting is odd.  Doesn't really matter, but I think this can simply be:
> > 
> > static inline void sti_nop(void)
> > {
> >         asm volatile("sti; nop");
> 
> "\n\t" is what gcc manual recommends for separating the assembly lines as you
> know from the gcc manual:
> https://gcc.gnu.org/onlinedocs/gcc/Extended-Asm.html "You may place multiple
> assembler instructions together in a single asm string, separated by  the
> characters normally used in assembly code for the system. A combination that
> works in  most places is a newline to break the line, plus a tab character to
> move to the instruction  field (written as ‘\n\t’). Some assemblers allow
> semicolons as a line separator.  However, note that some assembler dialects
> use semicolons to start a comment"
> 
> Looks like gnu assembler does use semicolon for new statements and hash for comments 
> but some assemblers do semicolon for comments.
> 
> I usually use just "\n", but the safest is "\n\t".

I'm pretty sure we can ignore GCC's warning here and maximize readability.  There
are already plenty of asm blobs that use a semicolon.

  reply	other threads:[~2022-10-25  0:26 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-20 15:23 [kvm-unit-tests PATCH 00/16] kvm-unit-tests: set of fixes and new tests Maxim Levitsky
2022-10-20 15:23 ` [kvm-unit-tests PATCH 01/16] x86: make irq_enable avoid the interrupt shadow Maxim Levitsky
2022-10-20 18:01   ` Sean Christopherson
2022-10-24 12:36     ` Maxim Levitsky
2022-10-24 22:49       ` Sean Christopherson [this message]
2022-10-27 10:16         ` Maxim Levitsky
2022-10-27 15:50           ` Sean Christopherson
2022-10-27 17:10             ` Maxim Levitsky
2022-10-20 15:23 ` [kvm-unit-tests PATCH 02/16] x86: add few helper functions for apic local timer Maxim Levitsky
2022-10-20 19:14   ` Sean Christopherson
2022-10-24 12:37     ` Maxim Levitsky
2022-10-24 16:10       ` Sean Christopherson
2022-10-27 10:19         ` Maxim Levitsky
2022-10-27 15:54           ` Sean Christopherson
2022-10-27 17:11             ` Maxim Levitsky
2022-10-20 15:23 ` [kvm-unit-tests PATCH 03/16] svm: use irq_enable instead of sti/nop Maxim Levitsky
2022-10-20 15:23 ` [kvm-unit-tests PATCH 04/16] svm: make svm_intr_intercept_mix_if/gif test a bit more robust Maxim Levitsky
2022-10-20 15:23 ` [kvm-unit-tests PATCH 05/16] svm: use apic_start_timer/apic_stop_timer instead of open coding it Maxim Levitsky
2022-10-20 15:23 ` [kvm-unit-tests PATCH 06/16] x86: Add test for #SMI during interrupt window Maxim Levitsky
2022-10-20 15:23 ` [kvm-unit-tests PATCH 07/16] x86: Add a simple test for SYSENTER instruction Maxim Levitsky
2022-10-20 19:25   ` Sean Christopherson
2022-10-24 12:38     ` Maxim Levitsky
2022-10-20 15:23 ` [kvm-unit-tests PATCH 08/16] svm: add nested shutdown test Maxim Levitsky
2022-10-20 15:26   ` Maxim Levitsky
2022-10-20 19:06     ` Sean Christopherson
2022-10-24 12:39       ` Maxim Levitsky
2022-10-20 15:23 ` [kvm-unit-tests PATCH 09/16] svm: move svm spec definitions to lib/x86/svm.h Maxim Levitsky
2022-10-20 19:08   ` Sean Christopherson
2022-10-20 15:23 ` [kvm-unit-tests PATCH 10/16] svm: move some svm support functions into lib/x86/svm_lib.h Maxim Levitsky
2022-10-20 15:23 ` [kvm-unit-tests PATCH 11/16] svm: add svm_suported Maxim Levitsky
2022-10-20 18:21   ` Sean Christopherson
2022-10-24 12:40     ` Maxim Levitsky
2022-10-20 15:24 ` [kvm-unit-tests PATCH 12/16] svm: move setup_svm to svm_lib.c Maxim Levitsky
2022-10-20 15:24 ` [kvm-unit-tests PATCH 13/16] svm: move vmcb_ident " Maxim Levitsky
2022-10-20 18:37   ` Sean Christopherson
2022-10-24 12:46     ` Maxim Levitsky
2022-10-20 15:24 ` [kvm-unit-tests PATCH 14/16] svm: rewerite vm entry macros Maxim Levitsky
2022-10-20 18:55   ` Sean Christopherson
2022-10-24 12:45     ` Maxim Levitsky
2022-10-24 19:56       ` Sean Christopherson
2022-10-27 12:07         ` Maxim Levitsky
2022-10-27 19:39           ` Sean Christopherson
2022-10-20 15:24 ` [kvm-unit-tests PATCH 15/16] svm: introduce svm_vcpu Maxim Levitsky
2022-10-20 19:02   ` Sean Christopherson
2022-10-24 12:46     ` Maxim Levitsky
2022-10-20 15:24 ` [kvm-unit-tests PATCH 16/16] add IPI loss stress test Maxim Levitsky
2022-10-20 20:23   ` Sean Christopherson
2022-10-24 12:54     ` Maxim Levitsky
2022-10-24 17:19       ` Sean Christopherson
2022-10-27 11:00         ` Maxim Levitsky
2022-10-27 18:41           ` 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=Y1cWfiKayXy5xvji@google.com \
    --to=seanjc@google.com \
    --cc=cavery@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=mlevitsk@redhat.com \
    --cc=pbonzini@redhat.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