All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sean Christopherson <seanjc@google.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [GIT PULL (sort of)] KVM: x86: Static call changes for 6.11
Date: Tue, 16 Jul 2024 08:46:54 -0700	[thread overview]
Message-ID: <ZpaV7kaVL1rj7MXj@google.com> (raw)
In-Reply-To: <0f60918d-bc46-4332-ad28-c155a1990e3d@redhat.com>

On Tue, Jul 16, 2024, Paolo Bonzini wrote:
> On 7/13/24 01:56, Sean Christopherson wrote:
> > Here's a massage pull request for the static_call() changes, just in case you
> > want to go this route instead of applying patches directly after merging
> > everything else for 6.11 (it was easy to generate this).  If you want to go the
> > patches route, I'll post 'em next week.
> > 
> > The following changes since commit c1c8a908a5f4c372f8a8dca0501b56ffc8d260fe:
> > 
> >    Merge branch 'vmx' (2024-06-28 22:22:53 +0000)
> > 
> > are available in the Git repository at:
> > 
> >    https://github.com/kvm-x86/linux.git  tags/kvm-x86-static_calls-6.11
> > 
> > for you to fetch changes up to b528de209c858f61953023b405a4abbf9a9933da:
> > 
> >    KVM: x86/pmu: Add kvm_pmu_call() to simplify static calls of kvm_pmu_ops (2024-06-28 15:23:49 -0700)
> 
> Thanks, indeed there was no straggler static_call() after applying
> this.  However, there might be a problem: static_call_cond() is equal
> to static_call() only if CONFIG_HAVE_STATIC_CALL_INLINE,

No, I think you misread the #if-#elif-#else.  It's only the !HAVE_STATIC_CALL
case that requires use of static_call_cond().  From include/linux/static_call.h:

  #ifdef CONFIG_HAVE_STATIC_CALL_INLINE
  #define static_call_cond(name)	(void)__static_call(name)

  #elif defined(CONFIG_HAVE_STATIC_CALL)
  #define static_call_cond(name)	(void)__static_call(name)

  #else
  #define static_call_cond(name)	(void)__static_call_cond(name)

  #endif

And per Josh, from an old RFC[*] to yank out static_call_cond():

 : Static calling a NULL pointer is a NOP, unless you're one of those poor
 : souls running on an arch (or backported x86 monstrosity) with
 : CONFIG_HAVE_STATIC_CALL=n, then it's a panic.

I double checked that 32-bit KVM works on Intel (which is guaranteed to have a
NULL guest_memory_reclaimed()).  I also verified that the generated code is
identical for both static_call() and static_call_cond(), i.e. the READ_ONCE() of
the func at runtime that's present in __static_call_cond() isn't showing up.

Dump of assembler code for function kvm_arch_guest_memory_reclaimed:
   0xc1042094 <+0>:	call   0xc10ce650 <__fentry__>
   0xc1042099 <+5>:	push   %ebp
   0xc104209a <+6>:	mov    %esp,%ebp
   0xc104209c <+8>:	call   0xc1932d8c <__SCT__kvm_x86_guest_memory_reclaimed>
   0xc10420a1 <+13>:	pop    %ebp
   0xc10420a2 <+14>:	ret    
End of assembler dump.

Dump of assembler code for function __SCT__kvm_x86_guest_memory_reclaimed:
   0xc1932d8c <+0>:	ret    
   0xc1932d8d <+1>:	int3   
   0xc1932d8e <+2>:	nop
   0xc1932d8f <+3>:	nop
   0xc1932d90 <+4>:	nop
   0xc1932d91 <+5>:	ud1    %esp,%ecx
End of assembler dump.

[*] https://lore.kernel.org/all/cover.1678474914.git.jpoimboe@kernel.org

  reply	other threads:[~2024-07-16 15:47 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-12 23:56 [GIT PULL] KVM: x86 pull requests for 6.11 Sean Christopherson
2024-07-12 23:56 ` [GIT PULL] KVM: x86: Single Xen fix for 6.10 or 6.11 Sean Christopherson
2024-07-12 23:56 ` [GIT PULL] KVM: Generic changes for 6.11 Sean Christopherson
2024-07-12 23:56 ` [GIT PULL] KVM: x86: Misc " Sean Christopherson
2024-07-12 23:56 ` [GIT PULL] KVM: x86: MMU " Sean Christopherson
2024-07-12 23:56 ` [GIT PULL] KVM: x86: Remove MTRR virtualization Sean Christopherson
2024-07-12 23:56 ` [GIT PULL] KVM: x86: PMU changes for 6.11 Sean Christopherson
2024-07-12 23:56 ` [GIT PULL] KVM: Selftests " Sean Christopherson
2024-07-12 23:56 ` [GIT PULL (sort of)] KVM: x86: Static call " Sean Christopherson
2024-07-16 14:16   ` Paolo Bonzini
2024-07-16 15:46     ` Sean Christopherson [this message]
2024-07-17  5:52       ` Paolo Bonzini
2024-07-12 23:56 ` [GIT PULL] KVM: x86: SVM " Sean Christopherson
2024-07-12 23:57 ` [GIT PULL] KVM: x86: VMX " 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=ZpaV7kaVL1rj7MXj@google.com \
    --to=seanjc@google.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.