Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933075AbbKRPBE (ORCPT ); Wed, 18 Nov 2015 10:01:04 -0500 Received: from userp1040.oracle.com ([156.151.31.81]:26429 "EHLO userp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755389AbbKRPBC (ORCPT ); Wed, 18 Nov 2015 10:01:02 -0500 Subject: Re: [Xen-devel] [PATCH] xen/events: Always allocate legacy interrupts on PV guests To: Vitaly Kuznetsov References: <1447774585-21857-1-git-send-email-boris.ostrovsky@oracle.com> <87lh9vv9pv.fsf@vitty.brq.redhat.com> <564C8531.2000608@oracle.com> <87d1v7v0t8.fsf@vitty.brq.redhat.com> Cc: david.vrabel@citrix.com, konrad.wilk@oracle.com, jgross@suse.com, tglx@linutronix.de, linux-kernel@vger.kernel.org, xen-devel@lists.xen.org From: Boris Ostrovsky Message-ID: <564C9293.8070703@oracle.com> Date: Wed, 18 Nov 2015 10:00:35 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.1.0 MIME-Version: 1.0 In-Reply-To: <87d1v7v0t8.fsf@vitty.brq.redhat.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Source-IP: aserv0022.oracle.com [141.146.126.234] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2348 Lines: 60 On 11/18/2015 09:28 AM, Vitaly Kuznetsov wrote: > Boris Ostrovsky writes: > >> On 11/18/2015 06:16 AM, Vitaly Kuznetsov wrote: >>> Boris Ostrovsky 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 >>>> Suggested-by: Thomas Gleixner >>>> --- >>>> 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/