From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751187AbeAPOXR (ORCPT + 1 other); Tue, 16 Jan 2018 09:23:17 -0500 Received: from mga09.intel.com ([134.134.136.24]:33138 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750832AbeAPOXQ (ORCPT ); Tue, 16 Jan 2018 09:23:16 -0500 X-Amp-Result: UNSCANNABLE X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.46,368,1511856000"; d="scan'208";a="166505816" Date: Tue, 16 Jan 2018 07:26:30 -0700 From: Keith Busch To: Thomas Gleixner Cc: LKML Subject: Re: [BUG 4.15-rc7] IRQ matrix management errors Message-ID: <20180116142629.GB5643@localhost.localdomain> References: <20180115025759.GG13580@localhost.localdomain> <20180115030255.GA13921@localhost.localdomain> <20180116061641.GB32639@localhost.localdomain> <20180116071145.GA5643@localhost.localdomain> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.1 (2017-09-22) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: On Tue, Jan 16, 2018 at 12:20:18PM +0100, Thomas Gleixner wrote: > What we want is s/i + 1/i/ > > That's correct because x86_vector_free_irqs() does: > > for (i = 0; i < nr; i++) > .... > > So if we fail at the first irq, then the loop will do nothing. Failing on > the second will free the first .... > > Fix below. > > Thanks, > > tglx Thanks! This looks much better. I'll try to verify by tomorrow, though the hardware I was using to recreate is not available to me at the moment. I may be able to synth the conditions on something else. > 8<---------------------- > diff --git a/arch/x86/kernel/apic/vector.c b/arch/x86/kernel/apic/vector.c > index f8b03bb8e725..3cc471beb50b 100644 > --- a/arch/x86/kernel/apic/vector.c > +++ b/arch/x86/kernel/apic/vector.c > @@ -542,14 +542,17 @@ static int x86_vector_alloc_irqs(struct irq_domain *domain, unsigned int virq, > > err = assign_irq_vector_policy(irqd, info); > trace_vector_setup(virq + i, false, err); > - if (err) > + if (err) { > + irqd->chip_data = NULL; > + free_apic_chip_data(apicd); > goto error; > + } > } > > return 0; > > error: > - x86_vector_free_irqs(domain, virq, i + 1); > + x86_vector_free_irqs(domain, virq, i); > return err; > } >