linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: KY Srinivasan <kys@microsoft.com>
To: Jan Beulich <JBeulich@suse.com>
Cc: "olaf@aepfle.de" <olaf@aepfle.de>, "bp@alien8.de" <bp@alien8.de>,
	"apw@canonical.com" <apw@canonical.com>,
	"x86@kernel.org" <x86@kernel.org>,
	"tglx@linutronix.de" <tglx@linutronix.de>,
	"devel@linuxdriverproject.org" <devel@linuxdriverproject.org>,
	"gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>,
	"jasowang@redhat.com" <jasowang@redhat.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"hpa@zytor.com" <hpa@zytor.com>
Subject: RE: [PATCH 3/3] X86: Handle Hyper-V vmbus interrupts as special hypervisor interrupts
Date: Thu, 31 Jan 2013 14:55:54 +0000	[thread overview]
Message-ID: <4b1cb126e6f94d26be741b7b98b58a75@SN2PR03MB061.namprd03.prod.outlook.com> (raw)
In-Reply-To: <5108EEDD02000078000BAA22@nat28.tlf.novell.com>



> -----Original Message-----
> From: Jan Beulich [mailto:JBeulich@suse.com]
> Sent: Wednesday, January 30, 2013 3:59 AM
> To: KY Srinivasan
> Cc: olaf@aepfle.de; bp@alien8.de; apw@canonical.com; x86@kernel.org;
> tglx@linutronix.de; devel@linuxdriverproject.org; gregkh@linuxfoundation.org;
> jasowang@redhat.com; linux-kernel@vger.kernel.org; hpa@zytor.com
> Subject: Re: [PATCH 3/3] X86: Handle Hyper-V vmbus interrupts as special
> hypervisor interrupts
> 
> >>> On 30.01.13 at 01:51, "K. Y. Srinivasan" <kys@microsoft.com> wrote:
> > --- a/arch/x86/kernel/cpu/mshyperv.c
> > +++ b/arch/x86/kernel/cpu/mshyperv.c
> > @@ -14,10 +14,15 @@
> >  #include <linux/time.h>
> >  #include <linux/clocksource.h>
> >  #include <linux/module.h>
> > +#include <linux/hardirq.h>
> > +#include <linux/interrupt.h>
> >  #include <asm/processor.h>
> >  #include <asm/hypervisor.h>
> >  #include <asm/hyperv.h>
> >  #include <asm/mshyperv.h>
> > +#include <asm/desc.h>
> > +#include <asm/idle.h>
> > +#include <asm/irq_regs.h>
> >
> >  struct ms_hyperv_info ms_hyperv;
> >  EXPORT_SYMBOL_GPL(ms_hyperv);
> > @@ -77,6 +82,12 @@ static void __init ms_hyperv_init_platform(void)
> >
> >  	if (ms_hyperv.features & HV_X64_MSR_TIME_REF_COUNT_AVAILABLE)
> >  		clocksource_register_hz(&hyperv_cs, NSEC_PER_SEC/100);
> > +#if IS_ENABLED(CONFIG_HYPERV)
> > +	/*
> > +	 * Setup the IDT for hypervisor callback.
> > +	 */
> > +	alloc_intr_gate(HYPERVISOR_CALLBACK_VECTOR,
> hyperv_callback_vector);
> > +#endif
> >  }
> >
> >  const __refconst struct hypervisor_x86 x86_hyper_ms_hyperv = {
> > @@ -85,3 +96,30 @@ const __refconst struct hypervisor_x86
> x86_hyper_ms_hyperv = {
> >  	.init_platform		= ms_hyperv_init_platform,
> >  };
> >  EXPORT_SYMBOL(x86_hyper_ms_hyperv);
> > +
> > +static int vmbus_irq = -1;
> > +static irq_handler_t vmbus_isr;
> > +
> > +void hv_register_vmbus_handler(int irq, irq_handler_t handler)
> > +{
> > +	vmbus_irq = irq;
> > +	vmbus_isr = handler;
> > +}
> > +EXPORT_SYMBOL_GPL(hv_register_vmbus_handler);
> > +
> > +void hyperv_vector_handler(struct pt_regs *regs)
> > +{
> > +	struct pt_regs *old_regs = set_irq_regs(regs);
> > +	struct irq_desc *desc;
> > +
> > +	irq_enter();
> > +	exit_idle();
> > +
> > +	desc = irq_to_desc(vmbus_irq);
> > +
> > +	if (desc)
> > +		generic_handle_irq_desc(vmbus_irq, desc);
> > +
> > +	irq_exit();
> > +	set_irq_regs(old_regs);
> > +}
> 
> This function appears to be dead code when !CONFIG_HYPERV,
> because ...

I will make the necessary adjustments to deal with this.

> 
> > --- a/arch/x86/kernel/entry_32.S
> > +++ b/arch/x86/kernel/entry_32.S
> > @@ -1046,11 +1046,18 @@ ENTRY(xen_failsafe_callback)
> >  	_ASM_EXTABLE(4b,9b)
> >  ENDPROC(xen_failsafe_callback)
> >
> > -BUILD_INTERRUPT3(xen_hvm_callback_vector,
> XEN_HVM_EVTCHN_CALLBACK,
> > +BUILD_INTERRUPT3(xen_hvm_callback_vector,
> HYPERVISOR_CALLBACK_VECTOR,
> >  		xen_evtchn_do_upcall)
> >
> >  #endif	/* CONFIG_XEN */
> >
> > +#if IS_ENABLED(CONFIG_HYPERV)
> > +
> > +BUILD_INTERRUPT3(hyperv_callback_vector,
> HYPERVISOR_CALLBACK_VECTOR,
> > +	hyperv_vector_handler)
> > +
> > +#endif /* CONFIG_HYPERV */
> > +
> >  #ifdef CONFIG_FUNCTION_TRACER
> >  #ifdef CONFIG_DYNAMIC_FTRACE
> >
> 
> ... the consumers here and below are conditional.
> 
> I also wonder why arch/x86/kernel/cpu/mshyperv.c is being built
> at all when !CONFIG_HYPERV (which would eliminate the need
> for the conditional the patch adds to ms_hyperv_init_platform()).

Linux is usable on Hyper-V in full emulation mode with the Hyper-V specific
clocksource plugged in. The current code permits that.

K. Y 


  reply	other threads:[~2013-01-31 14:57 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-30  0:51 [PATCH 0/3] X86: Deliver Hyper-V interrupts on a seperate IDT vector K. Y. Srinivasan
2013-01-30  0:51 ` [PATCH 1/3] x86: Hyper-V: register clocksource only if its advertised K. Y. Srinivasan
2013-01-30  0:51   ` [PATCH 2/3] X86: Add a check to catch Xen emulation of Hyper-V K. Y. Srinivasan
2013-01-30  8:53     ` Jan Beulich
2013-01-30 18:12       ` KY Srinivasan
2013-01-30 18:19         ` H. Peter Anvin
2013-01-31  7:37         ` Jan Beulich
2013-01-31 14:46           ` KY Srinivasan
2013-01-31 15:53             ` KY Srinivasan
2013-01-31 16:45               ` Jan Beulich
2013-01-31 18:29                 ` H. Peter Anvin
2013-01-31 21:41       ` H. Peter Anvin
2013-02-01 13:19         ` Stefano Stabellini
2013-02-01 15:10           ` KY Srinivasan
2013-02-01 19:34             ` KY Srinivasan
2013-01-30  0:51   ` [PATCH 3/3] X86: Handle Hyper-V vmbus interrupts as special hypervisor interrupts K. Y. Srinivasan
2013-01-30  8:58     ` Jan Beulich
2013-01-31 14:55       ` KY Srinivasan [this message]
2013-02-04  1:21 [PATCH 0/3] X86: Deliver Hyper-V interrupts on a seperate IDT vector K. Y. Srinivasan
2013-02-04  1:22 ` [PATCH 1/3] x86: Hyper-V: register clocksource only if its advertised K. Y. Srinivasan
2013-02-04  1:22   ` [PATCH 3/3] X86: Handle Hyper-V vmbus interrupts as special hypervisor interrupts K. Y. Srinivasan

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=4b1cb126e6f94d26be741b7b98b58a75@SN2PR03MB061.namprd03.prod.outlook.com \
    --to=kys@microsoft.com \
    --cc=JBeulich@suse.com \
    --cc=apw@canonical.com \
    --cc=bp@alien8.de \
    --cc=devel@linuxdriverproject.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=hpa@zytor.com \
    --cc=jasowang@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=olaf@aepfle.de \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    --subject='RE: [PATCH 3/3] X86: Handle Hyper-V vmbus interrupts as special hypervisor interrupts' \
    /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

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).