public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1] x86/hyper-V: Allocate the IDT entry early in boot
@ 2017-09-08 21:54 K. Y. Srinivasan
  2017-09-09  9:39 ` Thomas Gleixner
  0 siblings, 1 reply; 8+ messages in thread
From: K. Y. Srinivasan @ 2017-09-08 21:54 UTC (permalink / raw)
  To: x86, gregkh, linux-kernel, devel, olaf, apw, jasowang, tglx, hpa,
	mingo
  Cc: K. Y. Srinivasan

Allocate the hypervisor callback IDT entry early in the boot sequence.

Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
---
 arch/x86/kernel/cpu/mshyperv.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/x86/kernel/cpu/mshyperv.c b/arch/x86/kernel/cpu/mshyperv.c
index 3b3f713e15e5..236324e83a3a 100644
--- a/arch/x86/kernel/cpu/mshyperv.c
+++ b/arch/x86/kernel/cpu/mshyperv.c
@@ -59,8 +59,6 @@ void hyperv_vector_handler(struct pt_regs *regs)
 void hv_setup_vmbus_irq(void (*handler)(void))
 {
 	vmbus_handler = handler;
-	/* Setup the IDT for hypervisor callback */
-	alloc_intr_gate(HYPERVISOR_CALLBACK_VECTOR, hyperv_callback_vector);
 }
 
 void hv_remove_vmbus_irq(void)
@@ -251,6 +249,8 @@ static void __init ms_hyperv_init_platform(void)
 	 */
 	x86_platform.apic_post_init = hyperv_init;
 	hyperv_setup_mmu_ops();
+	/* Setup the IDT for hypervisor callback */
+	alloc_intr_gate(HYPERVISOR_CALLBACK_VECTOR, hyperv_callback_vector);
 #endif
 }
 
-- 
2.14.1

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 1/1] x86/hyper-V: Allocate the IDT entry early in boot
@ 2017-09-08 23:15 kys
  2017-09-09 11:04 ` Dan Carpenter
  0 siblings, 1 reply; 8+ messages in thread
From: kys @ 2017-09-08 23:15 UTC (permalink / raw)
  To: x86, gregkh, linux-kernel, devel, olaf, apw, jasowang, tglx, hpa,
	mingo
  Cc: K. Y. Srinivasan

From: "K. Y. Srinivasan" <kys@microsoft.com>

Allocate the hypervisor callback IDT entry early in the boot sequence.

Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
---
 arch/x86/kernel/cpu/mshyperv.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/x86/kernel/cpu/mshyperv.c b/arch/x86/kernel/cpu/mshyperv.c
index 3b3f713e15e5..236324e83a3a 100644
--- a/arch/x86/kernel/cpu/mshyperv.c
+++ b/arch/x86/kernel/cpu/mshyperv.c
@@ -59,8 +59,6 @@ void hyperv_vector_handler(struct pt_regs *regs)
 void hv_setup_vmbus_irq(void (*handler)(void))
 {
 	vmbus_handler = handler;
-	/* Setup the IDT for hypervisor callback */
-	alloc_intr_gate(HYPERVISOR_CALLBACK_VECTOR, hyperv_callback_vector);
 }
 
 void hv_remove_vmbus_irq(void)
@@ -251,6 +249,8 @@ static void __init ms_hyperv_init_platform(void)
 	 */
 	x86_platform.apic_post_init = hyperv_init;
 	hyperv_setup_mmu_ops();
+	/* Setup the IDT for hypervisor callback */
+	alloc_intr_gate(HYPERVISOR_CALLBACK_VECTOR, hyperv_callback_vector);
 #endif
 }
 
-- 
2.14.1

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/1] x86/hyper-V: Allocate the IDT entry early in boot
  2017-09-08 21:54 [PATCH 1/1] x86/hyper-V: Allocate the IDT entry early in boot K. Y. Srinivasan
@ 2017-09-09  9:39 ` Thomas Gleixner
  2017-09-09 15:58   ` KY Srinivasan
  0 siblings, 1 reply; 8+ messages in thread
From: Thomas Gleixner @ 2017-09-09  9:39 UTC (permalink / raw)
  To: K. Y. Srinivasan
  Cc: x86, gregkh, linux-kernel, devel, olaf, apw, jasowang, hpa, mingo

On Fri, 8 Sep 2017, K. Y. Srinivasan wrote:

> Allocate the hypervisor callback IDT entry early in the boot sequence.
> 
> Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
> ---
>  arch/x86/kernel/cpu/mshyperv.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/x86/kernel/cpu/mshyperv.c b/arch/x86/kernel/cpu/mshyperv.c
> index 3b3f713e15e5..236324e83a3a 100644
> --- a/arch/x86/kernel/cpu/mshyperv.c
> +++ b/arch/x86/kernel/cpu/mshyperv.c
> @@ -59,8 +59,6 @@ void hyperv_vector_handler(struct pt_regs *regs)
>  void hv_setup_vmbus_irq(void (*handler)(void))
>  {
>  	vmbus_handler = handler;
> -	/* Setup the IDT for hypervisor callback */
> -	alloc_intr_gate(HYPERVISOR_CALLBACK_VECTOR, hyperv_callback_vector);
>  }
>  
>  void hv_remove_vmbus_irq(void)
> @@ -251,6 +249,8 @@ static void __init ms_hyperv_init_platform(void)
>  	 */
>  	x86_platform.apic_post_init = hyperv_init;
>  	hyperv_setup_mmu_ops();
> +	/* Setup the IDT for hypervisor callback */
> +	alloc_intr_gate(HYPERVISOR_CALLBACK_VECTOR, hyperv_callback_vector);
>  #endif
>  }

Nice. So we can make all of that gate/idt stuff __init now.

That makes my previous fix obsolete, right?

Thanks,

	tglx

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/1] x86/hyper-V: Allocate the IDT entry early in boot
  2017-09-08 23:15 kys
@ 2017-09-09 11:04 ` Dan Carpenter
  2017-09-09 16:00   ` KY Srinivasan
  0 siblings, 1 reply; 8+ messages in thread
From: Dan Carpenter @ 2017-09-09 11:04 UTC (permalink / raw)
  To: kys; +Cc: x86, gregkh, linux-kernel, devel, olaf, apw, jasowang, tglx, hpa,
	mingo

On Fri, Sep 08, 2017 at 04:15:57PM -0700, kys@exchange.microsoft.com wrote:
> From: "K. Y. Srinivasan" <kys@microsoft.com>
> 
> Allocate the hypervisor callback IDT entry early in the boot sequence.
> 

I'm guessing this fixes a NULL dereference or something?  The changelog
doesn't really say why we are doing this.

regards,
dan carpenter

^ permalink raw reply	[flat|nested] 8+ messages in thread

* RE: [PATCH 1/1] x86/hyper-V: Allocate the IDT entry early in boot
  2017-09-09  9:39 ` Thomas Gleixner
@ 2017-09-09 15:58   ` KY Srinivasan
  0 siblings, 0 replies; 8+ messages in thread
From: KY Srinivasan @ 2017-09-09 15:58 UTC (permalink / raw)
  To: Thomas Gleixner
  Cc: x86@kernel.org, gregkh@linuxfoundation.org,
	linux-kernel@vger.kernel.org, devel@linuxdriverproject.org,
	olaf@aepfle.de, apw@canonical.com, jasowang@redhat.com,
	hpa@zytor.com, mingo@kernel.org



> -----Original Message-----
> From: Thomas Gleixner [mailto:tglx@linutronix.de]
> Sent: Saturday, September 9, 2017 2:40 AM
> To: KY Srinivasan <kys@microsoft.com>
> Cc: x86@kernel.org; gregkh@linuxfoundation.org; linux-
> kernel@vger.kernel.org; devel@linuxdriverproject.org; olaf@aepfle.de;
> apw@canonical.com; jasowang@redhat.com; hpa@zytor.com;
> mingo@kernel.org
> Subject: Re: [PATCH 1/1] x86/hyper-V: Allocate the IDT entry early in boot
> 
> On Fri, 8 Sep 2017, K. Y. Srinivasan wrote:
> 
> > Allocate the hypervisor callback IDT entry early in the boot sequence.
> >
> > Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
> > ---
> >  arch/x86/kernel/cpu/mshyperv.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/arch/x86/kernel/cpu/mshyperv.c
> b/arch/x86/kernel/cpu/mshyperv.c
> > index 3b3f713e15e5..236324e83a3a 100644
> > --- a/arch/x86/kernel/cpu/mshyperv.c
> > +++ b/arch/x86/kernel/cpu/mshyperv.c
> > @@ -59,8 +59,6 @@ void hyperv_vector_handler(struct pt_regs *regs)
> >  void hv_setup_vmbus_irq(void (*handler)(void))
> >  {
> >  	vmbus_handler = handler;
> > -	/* Setup the IDT for hypervisor callback */
> > -	alloc_intr_gate(HYPERVISOR_CALLBACK_VECTOR,
> hyperv_callback_vector);
> >  }
> >
> >  void hv_remove_vmbus_irq(void)
> > @@ -251,6 +249,8 @@ static void __init ms_hyperv_init_platform(void)
> >  	 */
> >  	x86_platform.apic_post_init = hyperv_init;
> >  	hyperv_setup_mmu_ops();
> > +	/* Setup the IDT for hypervisor callback */
> > +	alloc_intr_gate(HYPERVISOR_CALLBACK_VECTOR,
> hyperv_callback_vector);
> >  #endif
> >  }
> 
> Nice. So we can make all of that gate/idt stuff __init now.
> 
> That makes my previous fix obsolete, right?

Yes.

K. Y
> 
> Thanks,
> 
> 	tglx
> 

^ permalink raw reply	[flat|nested] 8+ messages in thread

* RE: [PATCH 1/1] x86/hyper-V: Allocate the IDT entry early in boot
  2017-09-09 11:04 ` Dan Carpenter
@ 2017-09-09 16:00   ` KY Srinivasan
  2017-09-13  9:00     ` Ingo Molnar
  0 siblings, 1 reply; 8+ messages in thread
From: KY Srinivasan @ 2017-09-09 16:00 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: x86@kernel.org, gregkh@linuxfoundation.org,
	linux-kernel@vger.kernel.org, devel@linuxdriverproject.org,
	olaf@aepfle.de, apw@canonical.com, jasowang@redhat.com,
	tglx@linutronix.de, hpa@zytor.com, mingo@kernel.org



> -----Original Message-----
> From: Dan Carpenter [mailto:dan.carpenter@oracle.com]
> Sent: Saturday, September 9, 2017 4:04 AM
> To: KY Srinivasan <kys@microsoft.com>
> Cc: x86@kernel.org; gregkh@linuxfoundation.org; linux-
> kernel@vger.kernel.org; devel@linuxdriverproject.org; olaf@aepfle.de;
> apw@canonical.com; jasowang@redhat.com; tglx@linutronix.de;
> hpa@zytor.com; mingo@kernel.org
> Subject: Re: [PATCH 1/1] x86/hyper-V: Allocate the IDT entry early in boot
> 
> On Fri, Sep 08, 2017 at 04:15:57PM -0700, kys@exchange.microsoft.com
> wrote:
> > From: "K. Y. Srinivasan" <kys@microsoft.com>
> >
> > Allocate the hypervisor callback IDT entry early in the boot sequence.
> >
> 
> I'm guessing this fixes a NULL dereference or something?  The changelog
> doesn't really say why we are doing this.

The changelog does say what we are doing - allocating the IDT entry early in the boot sequence.
The current code would allocate the entry as part of registering the handler when vmbus driver
loaded and this caused a problem for the cleanup Thomas had implemented.

K. Y
> 
> regards,
> dan carpenter

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/1] x86/hyper-V: Allocate the IDT entry early in boot
  2017-09-09 16:00   ` KY Srinivasan
@ 2017-09-13  9:00     ` Ingo Molnar
  2017-09-13 18:05       ` KY Srinivasan
  0 siblings, 1 reply; 8+ messages in thread
From: Ingo Molnar @ 2017-09-13  9:00 UTC (permalink / raw)
  To: KY Srinivasan
  Cc: Dan Carpenter, x86@kernel.org, gregkh@linuxfoundation.org,
	linux-kernel@vger.kernel.org, devel@linuxdriverproject.org,
	olaf@aepfle.de, apw@canonical.com, jasowang@redhat.com,
	tglx@linutronix.de, hpa@zytor.com


* KY Srinivasan <kys@microsoft.com> wrote:

> 
> 
> > -----Original Message-----
> > From: Dan Carpenter [mailto:dan.carpenter@oracle.com]
> > Sent: Saturday, September 9, 2017 4:04 AM
> > To: KY Srinivasan <kys@microsoft.com>
> > Cc: x86@kernel.org; gregkh@linuxfoundation.org; linux-
> > kernel@vger.kernel.org; devel@linuxdriverproject.org; olaf@aepfle.de;
> > apw@canonical.com; jasowang@redhat.com; tglx@linutronix.de;
> > hpa@zytor.com; mingo@kernel.org
> > Subject: Re: [PATCH 1/1] x86/hyper-V: Allocate the IDT entry early in boot
> > 
> > On Fri, Sep 08, 2017 at 04:15:57PM -0700, kys@exchange.microsoft.com
> > wrote:
> > > From: "K. Y. Srinivasan" <kys@microsoft.com>
> > >
> > > Allocate the hypervisor callback IDT entry early in the boot sequence.
> > >
> > 
> > I'm guessing this fixes a NULL dereference or something?  The changelog
> > doesn't really say why we are doing this.
> 
> The changelog does say what we are doing - allocating the IDT entry early in the boot sequence.

But the question was the 'why', not the 'what' - so Dan's question is
fully justified ...

> The current code would allocate the entry as part of registering the handler 
> when vmbus driver loaded and this caused a problem for the cleanup Thomas had 
> implemented.

I've put this explanation into the changelog.

Thanks,

	Ingo

^ permalink raw reply	[flat|nested] 8+ messages in thread

* RE: [PATCH 1/1] x86/hyper-V: Allocate the IDT entry early in boot
  2017-09-13  9:00     ` Ingo Molnar
@ 2017-09-13 18:05       ` KY Srinivasan
  0 siblings, 0 replies; 8+ messages in thread
From: KY Srinivasan @ 2017-09-13 18:05 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: Dan Carpenter, x86@kernel.org, gregkh@linuxfoundation.org,
	linux-kernel@vger.kernel.org, devel@linuxdriverproject.org,
	olaf@aepfle.de, apw@canonical.com, jasowang@redhat.com,
	tglx@linutronix.de, hpa@zytor.com



> -----Original Message-----
> From: Ingo Molnar [mailto:mingo.kernel.org@gmail.com] On Behalf Of Ingo
> Molnar
> Sent: Wednesday, September 13, 2017 2:01 AM
> To: KY Srinivasan <kys@microsoft.com>
> Cc: Dan Carpenter <dan.carpenter@oracle.com>; x86@kernel.org;
> gregkh@linuxfoundation.org; linux-kernel@vger.kernel.org;
> devel@linuxdriverproject.org; olaf@aepfle.de; apw@canonical.com;
> jasowang@redhat.com; tglx@linutronix.de; hpa@zytor.com
> Subject: Re: [PATCH 1/1] x86/hyper-V: Allocate the IDT entry early in boot
> 
> 
> * KY Srinivasan <kys@microsoft.com> wrote:
> 
> >
> >
> > > -----Original Message-----
> > > From: Dan Carpenter [mailto:dan.carpenter@oracle.com]
> > > Sent: Saturday, September 9, 2017 4:04 AM
> > > To: KY Srinivasan <kys@microsoft.com>
> > > Cc: x86@kernel.org; gregkh@linuxfoundation.org; linux-
> > > kernel@vger.kernel.org; devel@linuxdriverproject.org; olaf@aepfle.de;
> > > apw@canonical.com; jasowang@redhat.com; tglx@linutronix.de;
> > > hpa@zytor.com; mingo@kernel.org
> > > Subject: Re: [PATCH 1/1] x86/hyper-V: Allocate the IDT entry early in boot
> > >
> > > On Fri, Sep 08, 2017 at 04:15:57PM -0700, kys@exchange.microsoft.com
> > > wrote:
> > > > From: "K. Y. Srinivasan" <kys@microsoft.com>
> > > >
> > > > Allocate the hypervisor callback IDT entry early in the boot sequence.
> > > >
> > >
> > > I'm guessing this fixes a NULL dereference or something?  The changelog
> > > doesn't really say why we are doing this.
> >
> > The changelog does say what we are doing - allocating the IDT entry early in
> the boot sequence.
> 
> But the question was the 'why', not the 'what' - so Dan's question is
> fully justified ...
> 
> > The current code would allocate the entry as part of registering the handler
> > when vmbus driver loaded and this caused a problem for the cleanup
> Thomas had
> > implemented.
> 
> I've put this explanation into the changelog.

You are right. Thanks, Ingo.

K. Y
> 
> Thanks,
> 
> 	Ingo

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2017-09-13 18:05 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-09-08 21:54 [PATCH 1/1] x86/hyper-V: Allocate the IDT entry early in boot K. Y. Srinivasan
2017-09-09  9:39 ` Thomas Gleixner
2017-09-09 15:58   ` KY Srinivasan
  -- strict thread matches above, loose matches on Subject: below --
2017-09-08 23:15 kys
2017-09-09 11:04 ` Dan Carpenter
2017-09-09 16:00   ` KY Srinivasan
2017-09-13  9:00     ` Ingo Molnar
2017-09-13 18:05       ` KY Srinivasan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox