mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Xin Li <xin@zytor.com>, Sean Christopherson <seanjc@google.com>,
	Max Kellermann <max.kellermann@ionos.com>
Cc: hpa@zytor.com, x86@kernel.org, linux-kernel@vger.kernel.org,
	Stephen Rothwell <sfr@canb.auug.org.au>,
	kvm@vger.kernel.org
Subject: Re: [PATCH] arch/x86/entry_fred: don't set up KVM IRQs if KVM is disabled
Date: Fri, 16 Feb 2024 07:31:46 +0100	[thread overview]
Message-ID: <5a332064-0a26-4bb9-8a3e-c99604d2d919@redhat.com> (raw)
In-Reply-To: <a61b113c-613c-41df-80a5-b061889edfdf@zytor.com>

On 2/16/24 03:10, Xin Li wrote:
> On 2/15/2024 11:55 AM, Sean Christopherson wrote:
>> +Paolo and Stephen
>>
>> FYI, there's a build failure in -next due to a collision between 
>> kvm/next and
>> tip/x86/fred.  The above makes everything happy.
>>
>> On Thu, Feb 15, 2024, Max Kellermann wrote:
>>> When KVM is disabled, the POSTED_INTR_* macros do not exist, and the
>>> build fails.
>>>
>>> Fixes: 14619d912b65 ("x86/fred: FRED entry/exit and dispatch code")
>>> Signed-off-by: Max Kellermann <max.kellermann@ionos.com>
>>> ---
>>>   arch/x86/entry/entry_fred.c | 2 ++
>>>   1 file changed, 2 insertions(+)
>>>
>>> diff --git a/arch/x86/entry/entry_fred.c b/arch/x86/entry/entry_fred.c
>>> index ac120cbdaaf2..660b7f7f9a79 100644
>>> --- a/arch/x86/entry/entry_fred.c
>>> +++ b/arch/x86/entry/entry_fred.c
>>> @@ -114,9 +114,11 @@ static idtentry_t 
>>> sysvec_table[NR_SYSTEM_VECTORS] __ro_after_init = {
>>>       SYSVEC(IRQ_WORK_VECTOR,            irq_work),
>>> +#if IS_ENABLED(CONFIG_KVM)
>>>       SYSVEC(POSTED_INTR_VECTOR,        kvm_posted_intr_ipi),
>>>       SYSVEC(POSTED_INTR_WAKEUP_VECTOR,    kvm_posted_intr_wakeup_ipi),
>>>       SYSVEC(POSTED_INTR_NESTED_VECTOR,    kvm_posted_intr_nested_ipi),
>>> +#endif
>>>   };
>>>   static bool fred_setup_done __initdata;
>>> -- 
>>> 2.39.2
> 
> We want to minimize #ifdeffery (which is why we didn't add any to
> sysvec_table[]), would it be better to simply remove "#if 
> IS_ENABLED(CONFIG_KVM)" around the the POSTED_INTR_* macros from the
> Linux-next tree?
> 
> BTW, kvm_posted_intr_*() are defined to NULL if !IS_ENABLED(CONFIG_KVM).

It is intentional that KVM-related things are compiled out completely
if !IS_ENABLED(CONFIG_KVM), because then it's also not necessary to have

# define fred_sysvec_kvm_posted_intr_ipi                NULL
# define fred_sysvec_kvm_posted_intr_wakeup_ipi         NULL
# define fred_sysvec_kvm_posted_intr_nested_ipi         NULL

in arch/x86/include/asm/idtentry.h. The full conflict resultion is

diff --git a/arch/x86/entry/entry_fred.c b/arch/x86/entry/entry_fred.c
index ac120cbdaaf2..660b7f7f9a79 100644
--- a/arch/x86/entry/entry_fred.c
+++ b/arch/x86/entry/entry_fred.c
@@ -114,9 +114,11 @@ static idtentry_t sysvec_table[NR_SYSTEM_VECTORS] __ro_after_init = {
  
      SYSVEC(IRQ_WORK_VECTOR,            irq_work),
  
+#if IS_ENABLED(CONFIG_KVM)
      SYSVEC(POSTED_INTR_VECTOR,        kvm_posted_intr_ipi),
      SYSVEC(POSTED_INTR_WAKEUP_VECTOR,    kvm_posted_intr_wakeup_ipi),
      SYSVEC(POSTED_INTR_NESTED_VECTOR,    kvm_posted_intr_nested_ipi),
+#endif
  };
  
  static bool fred_setup_done __initdata;
diff --git a/arch/x86/include/asm/idtentry.h b/arch/x86/include/asm/idtentry.h
index 749c7411d2f1..758f6a2838a8 100644
--- a/arch/x86/include/asm/idtentry.h
+++ b/arch/x86/include/asm/idtentry.h
@@ -745,10 +745,6 @@ DECLARE_IDTENTRY_SYSVEC(IRQ_WORK_VECTOR,        sysvec_irq_work);
  DECLARE_IDTENTRY_SYSVEC(POSTED_INTR_VECTOR,        sysvec_kvm_posted_intr_ipi);
  DECLARE_IDTENTRY_SYSVEC(POSTED_INTR_WAKEUP_VECTOR,    sysvec_kvm_posted_intr_wakeup_ipi);
  DECLARE_IDTENTRY_SYSVEC(POSTED_INTR_NESTED_VECTOR,    sysvec_kvm_posted_intr_nested_ipi);
-#else
-# define fred_sysvec_kvm_posted_intr_ipi        NULL
-# define fred_sysvec_kvm_posted_intr_wakeup_ipi        NULL
-# define fred_sysvec_kvm_posted_intr_nested_ipi        NULL
  #endif
  
  #if IS_ENABLED(CONFIG_HYPERV)

and it seems to be a net improvement to me.  The #ifs match in
the .h and .c files, and there are no unnecessary initializers
in the sysvec_table.

Paolo


  reply	other threads:[~2024-02-16  6:32 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-15 13:36 Max Kellermann
2024-02-15 18:23 ` Xin Li
2024-02-15 19:30   ` Max Kellermann
2024-02-15 19:55 ` Sean Christopherson
2024-02-16  2:10   ` Xin Li
2024-02-16  6:31     ` Paolo Bonzini [this message]
2024-02-16 17:41       ` Xin Li
2024-02-16 17:47         ` Xin Li
2024-02-16 21:45       ` Thomas Gleixner
2024-02-16 23:00         ` Max Kellermann
2024-02-17  0:11           ` Thomas Gleixner
2024-02-17  9:52         ` Paolo Bonzini
2024-02-17 22:25           ` Thomas Gleixner
2024-02-16 21:46       ` Borislav Petkov
2024-02-16 22:29         ` Thomas Gleixner

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=5a332064-0a26-4bb9-8a3e-c99604d2d919@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=hpa@zytor.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=max.kellermann@ionos.com \
    --cc=seanjc@google.com \
    --cc=sfr@canb.auug.org.au \
    --cc=x86@kernel.org \
    --cc=xin@zytor.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

all inboxes | Powered by JetHome®