Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1271334 > unrolled thread

[PATCH] xen/events: Always allocate legacy interrupts on PV guests

Started byBoris Ostrovsky <boris.ostrovsky@oracle.com>
First post2015-11-17 16:40 +0100
Last post2015-11-18 16:10 +0100
Articles 6 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] xen/events: Always allocate legacy interrupts on PV guests Boris Ostrovsky <boris.ostrovsky@oracle.com> - 2015-11-17 16:40 +0100
    Re: [PATCH] xen/events: Always allocate legacy interrupts on PV  guests Juergen Gross <jgross@suse.com> - 2015-11-17 17:30 +0100
    Re: [Xen-devel] [PATCH] xen/events: Always allocate legacy interrupts on PV guests Vitaly Kuznetsov <vkuznets@redhat.com> - 2015-11-18 12:20 +0100
      Re: [Xen-devel] [PATCH] xen/events: Always allocate legacy interrupts  on PV guests Boris Ostrovsky <boris.ostrovsky@oracle.com> - 2015-11-18 15:10 +0100
        Re: [Xen-devel] [PATCH] xen/events: Always allocate legacy interrupts on PV guests Vitaly Kuznetsov <vkuznets@redhat.com> - 2015-11-18 15:30 +0100
          Re: [Xen-devel] [PATCH] xen/events: Always allocate legacy interrupts  on PV guests Boris Ostrovsky <boris.ostrovsky@oracle.com> - 2015-11-18 16:10 +0100

#1271334 — [PATCH] xen/events: Always allocate legacy interrupts on PV guests

FromBoris Ostrovsky <boris.ostrovsky@oracle.com>
Date2015-11-17 16:40 +0100
Subject[PATCH] xen/events: Always allocate legacy interrupts on PV guests
Message-ID<qvQwp-6RR-3@gated-at.bofh.it>
After commit 8c058b0b9c34 ("x86/irq: Probe for PIC presence before
allocating descs for legacy IRQs") early_irq_init() will no longer
preallocate descriptors for legacy interrupts if PIT does not
exist.

Therefore we need to allocate those descriptors for PV guests
ourselves.

Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Suggested-by: Thomas Gleixner <tglx@linutronix.de>
---
 drivers/xen/events/events_base.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/xen/events/events_base.c b/drivers/xen/events/events_base.c
index 849500e..a2bb333 100644
--- a/drivers/xen/events/events_base.c
+++ b/drivers/xen/events/events_base.c
@@ -419,8 +419,8 @@ static int __must_check xen_allocate_irq_gsi(unsigned gsi)
 	if (xen_pv_domain() && !xen_initial_domain())
 		return xen_allocate_irq_dynamic();
 
-	/* Legacy IRQ descriptors are already allocated by the arch. */
-	if (gsi < NR_IRQS_LEGACY)
+	/* On HVM legacy IRQ descriptors are already allocated by the arch. */
+	if (xen_hvm_domain() && gsi < NR_IRQS_LEGACY)
 		irq = gsi;
 	else
 		irq = irq_alloc_desc_at(gsi, -1);
@@ -445,8 +445,8 @@ static void xen_free_irq(unsigned irq)
 
 	kfree(info);
 
-	/* Legacy IRQ descriptors are managed by the arch. */
-	if (irq < NR_IRQS_LEGACY)
+	/* On HVM legacy IRQ descriptors are managed by the arch. */
+	if (xen_hvm_domain() && irq < NR_IRQS_LEGACY)
 		return;
 
 	irq_free_desc(irq);
-- 
1.9.3

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1271381 — Re: [PATCH] xen/events: Always allocate legacy interrupts on PV guests

FromJuergen Gross <jgross@suse.com>
Date2015-11-17 17:30 +0100
SubjectRe: [PATCH] xen/events: Always allocate legacy interrupts on PV guests
Message-ID<qvRiO-7og-5@gated-at.bofh.it>
In reply to#1271334
On 17/11/15 16:36, Boris Ostrovsky wrote:
> After commit 8c058b0b9c34 ("x86/irq: Probe for PIC presence before
> allocating descs for legacy IRQs") early_irq_init() will no longer
> preallocate descriptors for legacy interrupts if PIT does not
> exist.
> 
> Therefore we need to allocate those descriptors for PV guests
> ourselves.
> 
> Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
> Suggested-by: Thomas Gleixner <tglx@linutronix.de>

Tested-by: Juergen Gross <jgross@suse.com>


Juergen
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1272097 — Re: [Xen-devel] [PATCH] xen/events: Always allocate legacy interrupts on PV guests

FromVitaly Kuznetsov <vkuznets@redhat.com>
Date2015-11-18 12:20 +0100
SubjectRe: [Xen-devel] [PATCH] xen/events: Always allocate legacy interrupts on PV guests
Message-ID<qw8Wl-29z-15@gated-at.bofh.it>
In reply to#1271334
Boris Ostrovsky <boris.ostrovsky@oracle.com> writes:

> After commit 8c058b0b9c34 ("x86/irq: Probe for PIC presence before
> allocating descs for legacy IRQs") early_irq_init() will no longer
> preallocate descriptors for legacy interrupts if PIT does not
> exist.

PIC?

>
> Therefore we need to allocate those descriptors for PV guests
> ourselves.
>
> Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
> Suggested-by: Thomas Gleixner <tglx@linutronix.de>
> ---
>  drivers/xen/events/events_base.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/xen/events/events_base.c b/drivers/xen/events/events_base.c
> index 849500e..a2bb333 100644
> --- a/drivers/xen/events/events_base.c
> +++ b/drivers/xen/events/events_base.c
> @@ -419,8 +419,8 @@ static int __must_check xen_allocate_irq_gsi(unsigned gsi)
>  	if (xen_pv_domain() && !xen_initial_domain())
>  		return xen_allocate_irq_dynamic();
>
> -	/* Legacy IRQ descriptors are already allocated by the arch. */
> -	if (gsi < NR_IRQS_LEGACY)
> +	/* On HVM legacy IRQ descriptors are already allocated by the arch. */
> +	if (xen_hvm_domain() && gsi < NR_IRQS_LEGACY)
>  		irq = gsi;

Wouldn't it be better to write it as
 if (gsi < nr_legacy_irqs()) ?

I think it's possible to have PIC-less HVM guests in future (btw, what
about HVMlite?). I see nr_legacy_irqs() is x86-only but it can easily be
defined to NR_IRQS_LEGACY on other arches.

>  	else
>  		irq = irq_alloc_desc_at(gsi, -1);
> @@ -445,8 +445,8 @@ static void xen_free_irq(unsigned irq)
>
>  	kfree(info);
>
> -	/* Legacy IRQ descriptors are managed by the arch. */
> -	if (irq < NR_IRQS_LEGACY)
> +	/* On HVM legacy IRQ descriptors are managed by the arch. */
> +	if (xen_hvm_domain() && irq < NR_IRQS_LEGACY)
>  		return;
>
>  	irq_free_desc(irq);

-- 
  Vitaly
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1272197 — Re: [Xen-devel] [PATCH] xen/events: Always allocate legacy interrupts on PV guests

FromBoris Ostrovsky <boris.ostrovsky@oracle.com>
Date2015-11-18 15:10 +0100
SubjectRe: [Xen-devel] [PATCH] xen/events: Always allocate legacy interrupts on PV guests
Message-ID<qwbAT-3W1-15@gated-at.bofh.it>
In reply to#1272097
On 11/18/2015 06:16 AM, Vitaly Kuznetsov wrote:
> Boris Ostrovsky <boris.ostrovsky@oracle.com> writes:
>
>> After commit 8c058b0b9c34 ("x86/irq: Probe for PIC presence before
>> allocating descs for legacy IRQs") early_irq_init() will no longer
>> preallocate descriptors for legacy interrupts if PIT does not
>> exist.
> PIC?

Right. David, can you fix this before committing?

>
>> Therefore we need to allocate those descriptors for PV guests
>> ourselves.
>>
>> Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
>> Suggested-by: Thomas Gleixner <tglx@linutronix.de>
>> ---
>>   drivers/xen/events/events_base.c | 8 ++++----
>>   1 file changed, 4 insertions(+), 4 deletions(-)
>>
>> diff --git a/drivers/xen/events/events_base.c b/drivers/xen/events/events_base.c
>> index 849500e..a2bb333 100644
>> --- a/drivers/xen/events/events_base.c
>> +++ b/drivers/xen/events/events_base.c
>> @@ -419,8 +419,8 @@ static int __must_check xen_allocate_irq_gsi(unsigned gsi)
>>   	if (xen_pv_domain() && !xen_initial_domain())
>>   		return xen_allocate_irq_dynamic();
>>
>> -	/* Legacy IRQ descriptors are already allocated by the arch. */
>> -	if (gsi < NR_IRQS_LEGACY)
>> +	/* On HVM legacy IRQ descriptors are already allocated by the arch. */
>> +	if (xen_hvm_domain() && gsi < NR_IRQS_LEGACY)
>>   		irq = gsi;
> Wouldn't it be better to write it as
>   if (gsi < nr_legacy_irqs()) ?

I don't think so: on PV we end up setting legacy_pic to null_legacy_pic 
in probe_8259A() and that will make nr_legacy_irqs() return 0.

>
> I think it's possible to have PIC-less HVM guests in future (btw, what
> about HVMlite?). I see nr_legacy_irqs() is x86-only but it can easily be
> defined to NR_IRQS_LEGACY on other arches.

Yes, HVMlite (or however we will end up calling it) will allow these 
sorts of thing. But HVMlite is not supported yet at all. And it's x86 only.

-boris

>
>>   	else
>>   		irq = irq_alloc_desc_at(gsi, -1);
>> @@ -445,8 +445,8 @@ static void xen_free_irq(unsigned irq)
>>
>>   	kfree(info);
>>
>> -	/* Legacy IRQ descriptors are managed by the arch. */
>> -	if (irq < NR_IRQS_LEGACY)
>> +	/* On HVM legacy IRQ descriptors are managed by the arch. */
>> +	if (xen_hvm_domain() && irq < NR_IRQS_LEGACY)
>>   		return;
>>
>>   	irq_free_desc(irq);

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1272219 — Re: [Xen-devel] [PATCH] xen/events: Always allocate legacy interrupts on PV guests

FromVitaly Kuznetsov <vkuznets@redhat.com>
Date2015-11-18 15:30 +0100
SubjectRe: [Xen-devel] [PATCH] xen/events: Always allocate legacy interrupts on PV guests
Message-ID<qwbUf-445-23@gated-at.bofh.it>
In reply to#1272197
Boris Ostrovsky <boris.ostrovsky@oracle.com> writes:

> On 11/18/2015 06:16 AM, Vitaly Kuznetsov wrote:
>> Boris Ostrovsky <boris.ostrovsky@oracle.com> writes:
>>
>>> After commit 8c058b0b9c34 ("x86/irq: Probe for PIC presence before
>>> allocating descs for legacy IRQs") early_irq_init() will no longer
>>> preallocate descriptors for legacy interrupts if PIT does not
>>> exist.
>> PIC?
>
> Right. David, can you fix this before committing?
>
>>
>>> Therefore we need to allocate those descriptors for PV guests
>>> ourselves.
>>>
>>> Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
>>> Suggested-by: Thomas Gleixner <tglx@linutronix.de>
>>> ---
>>>   drivers/xen/events/events_base.c | 8 ++++----
>>>   1 file changed, 4 insertions(+), 4 deletions(-)
>>>
>>> diff --git a/drivers/xen/events/events_base.c b/drivers/xen/events/events_base.c
>>> index 849500e..a2bb333 100644
>>> --- a/drivers/xen/events/events_base.c
>>> +++ b/drivers/xen/events/events_base.c
>>> @@ -419,8 +419,8 @@ static int __must_check xen_allocate_irq_gsi(unsigned gsi)
>>>   	if (xen_pv_domain() && !xen_initial_domain())
>>>   		return xen_allocate_irq_dynamic();
>>>
>>> -	/* Legacy IRQ descriptors are already allocated by the arch. */
>>> -	if (gsi < NR_IRQS_LEGACY)
>>> +	/* On HVM legacy IRQ descriptors are already allocated by the arch. */
>>> +	if (xen_hvm_domain() && gsi < NR_IRQS_LEGACY)
>>>   		irq = gsi;
>> Wouldn't it be better to write it as
>>   if (gsi < nr_legacy_irqs()) ?
>
> I don't think so: on PV we end up setting legacy_pic to
> null_legacy_pic in probe_8259A() and that will make nr_legacy_irqs()
> return 0.

Yes, so the condition will always be false for PV and it equals to
xen_hvm_domain() or am I missng something?

>
>>
>> I think it's possible to have PIC-less HVM guests in future (btw, what
>> about HVMlite?). I see nr_legacy_irqs() is x86-only but it can easily be
>> defined to NR_IRQS_LEGACY on other arches.
>
> Yes, HVMlite (or however we will end up calling it) will allow these
> sorts of thing. But HVMlite is not supported yet at all. And it's x86
> only.
>
> -boris
>
>>
>>>   	else
>>>   		irq = irq_alloc_desc_at(gsi, -1);
>>> @@ -445,8 +445,8 @@ static void xen_free_irq(unsigned irq)
>>>
>>>   	kfree(info);
>>>
>>> -	/* Legacy IRQ descriptors are managed by the arch. */
>>> -	if (irq < NR_IRQS_LEGACY)
>>> +	/* On HVM legacy IRQ descriptors are managed by the arch. */
>>> +	if (xen_hvm_domain() && irq < NR_IRQS_LEGACY)
>>>   		return;
>>>
>>>   	irq_free_desc(irq);

-- 
  Vitaly
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1272276 — Re: [Xen-devel] [PATCH] xen/events: Always allocate legacy interrupts on PV guests

FromBoris Ostrovsky <boris.ostrovsky@oracle.com>
Date2015-11-18 16:10 +0100
SubjectRe: [Xen-devel] [PATCH] xen/events: Always allocate legacy interrupts on PV guests
Message-ID<qwcwW-4zt-5@gated-at.bofh.it>
In reply to#1272219
On 11/18/2015 09:28 AM, Vitaly Kuznetsov wrote:
> Boris Ostrovsky <boris.ostrovsky@oracle.com> writes:
>
>> On 11/18/2015 06:16 AM, Vitaly Kuznetsov wrote:
>>> Boris Ostrovsky <boris.ostrovsky@oracle.com> writes:
>>>
>>>> After commit 8c058b0b9c34 ("x86/irq: Probe for PIC presence before
>>>> allocating descs for legacy IRQs") early_irq_init() will no longer
>>>> preallocate descriptors for legacy interrupts if PIT does not
>>>> exist.
>>> PIC?
>> Right. David, can you fix this before committing?
>>
>>>> Therefore we need to allocate those descriptors for PV guests
>>>> ourselves.
>>>>
>>>> Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
>>>> Suggested-by: Thomas Gleixner <tglx@linutronix.de>
>>>> ---
>>>>    drivers/xen/events/events_base.c | 8 ++++----
>>>>    1 file changed, 4 insertions(+), 4 deletions(-)
>>>>
>>>> diff --git a/drivers/xen/events/events_base.c b/drivers/xen/events/events_base.c
>>>> index 849500e..a2bb333 100644
>>>> --- a/drivers/xen/events/events_base.c
>>>> +++ b/drivers/xen/events/events_base.c
>>>> @@ -419,8 +419,8 @@ static int __must_check xen_allocate_irq_gsi(unsigned gsi)
>>>>    	if (xen_pv_domain() && !xen_initial_domain())
>>>>    		return xen_allocate_irq_dynamic();
>>>>
>>>> -	/* Legacy IRQ descriptors are already allocated by the arch. */
>>>> -	if (gsi < NR_IRQS_LEGACY)
>>>> +	/* On HVM legacy IRQ descriptors are already allocated by the arch. */
>>>> +	if (xen_hvm_domain() && gsi < NR_IRQS_LEGACY)
>>>>    		irq = gsi;
>>> Wouldn't it be better to write it as
>>>    if (gsi < nr_legacy_irqs()) ?
>> I don't think so: on PV we end up setting legacy_pic to
>> null_legacy_pic in probe_8259A() and that will make nr_legacy_irqs()
>> return 0.
> Yes, so the condition will always be false for PV and it equals to
> xen_hvm_domain() or am I missng something?

Oh, I see what you are saying. Yes, it would be cleaner.

-boris



>
>>> I think it's possible to have PIC-less HVM guests in future (btw, what
>>> about HVMlite?). I see nr_legacy_irqs() is x86-only but it can easily be
>>> defined to NR_IRQS_LEGACY on other arches.
>>>

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web