Received: by 10.223.185.116 with SMTP id b49csp4679069wrg; Tue, 27 Feb 2018 00:15:15 -0800 (PST) X-Google-Smtp-Source: AH8x226C5QmXX9K+Wg01KssF10/Ew6OlVHlaD5Cs5gyT6k66W++an2g0Tm5vLZydc69nvbzFvTfF X-Received: by 10.99.97.205 with SMTP id v196mr10632061pgb.319.1519719315673; Tue, 27 Feb 2018 00:15:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519719315; cv=none; d=google.com; s=arc-20160816; b=Z6KypAhK2RphHr6D2zkIDxRCGAWdMA4OgTIWbuoH43m6MVaqY5TQWTrL58imfJZAHx EXYBFu8ojmiRmf2tiCJ7iz6BTtMERMGYV714Nh2gfGG7+zH1o3Ha55MSCxTkmGZux0wV i9Dr1ng1Af0c6Kj5KgVv1mxR7PZxkbyDzeOkwvOaC76d77VtajZg5p4G+DKemz8qQT0I MSIyBUkRmVKXnwkv0sBPCJaX1n4kFiWvm9HW+vlhvbCLDksGRwzvQ8vPUu27b7Q44FQ+ aCcUt61Pc+Uelv2LeP5WQXa1EfKDK/8SdN2YXFQrORoJDbCjF+T7yWUIF6FL9d5IaPO4 DrQw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date :arc-authentication-results; bh=Iyu52z60GEo0dctRQmaLP89R9ZWcT/w+WWr9+hEIR98=; b=fBvuV0GenXsj3LRG15JIdUkb6rpPUtC0LdL7B1gNjyOb9wWwsKXJDD+NG2R8NZZHhk L12X/rVIMUwQlQ8gOf8H6c1I2FtHB2T7eCP9OSqJOwksKPgTFe7q2UIQdtlEcBb5OMdl 7wcIM8q19Ks+dbmouRw1vUTeiD2NSE+emgIjknhs5lNzFrHG+F5oGG2xSfj2pAlnBTCH 7ST6K8E7PHMgBOzcWBqn50brBoYv9znLSbUkPEosBqpO6HL8m9bJT7+ZUsc6TD64s+PH HKD1f3nwjlelK2t1qmuAmyYjNPXAV57zEnrtuNTqOMHaYx2KBCbZO+B0fOAJOl/spsou zgug== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s125si8251608pfb.37.2018.02.27.00.14.59; Tue, 27 Feb 2018 00:15:15 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752114AbeB0IOR (ORCPT + 99 others); Tue, 27 Feb 2018 03:14:17 -0500 Received: from smtp.eu.citrix.com ([185.25.65.24]:4975 "EHLO SMTP.EU.CITRIX.COM" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751949AbeB0IOQ (ORCPT ); Tue, 27 Feb 2018 03:14:16 -0500 X-IronPort-AV: E=Sophos;i="5.47,400,1515456000"; d="scan'208";a="68664509" Date: Tue, 27 Feb 2018 08:14:21 +0000 From: Roger Pau =?iso-8859-1?Q?Monn=E9?= To: "Shah, Amit" CC: "boris.ostrovsky@oracle.com" , "linux-kernel@vger.kernel.org" , "tglx@linutronix.de" , "kys@microsoft.com" , "Valentin, Eduardo" , "jgross@suse.com" , "stable@vger.kernel.org" , "shuo.a.liu@intel.com" , "anoob.soman@citrix.com" , "xen-devel@lists.xenproject.org" Subject: Re: [PATCH 2/2] xen: events: free irqs in error condition Message-ID: <20180227081421.i2x3vcw6imrreshv@MacBook-Pro-de-Roger.local> References: <1519666595-41362-1-git-send-email-aams@amazon.com> <1519666595-41362-3-git-send-email-aams@amazon.com> <20180226181439.zbdtzbv7wifjst2l@MacBook-Pro-de-Roger.local> <1519671423.4965.11.camel@amazon.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1519671423.4965.11.camel@amazon.com> User-Agent: NeoMutt/20171215 X-ClientProxiedBy: AMSPEX02CAS02.citrite.net (10.69.22.113) To AMSPEX02CL02.citrite.net (10.69.22.126) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Feb 26, 2018 at 06:57:03PM +0000, Shah, Amit wrote: > > On Mo, 2018-02-26 at 18:14 +0000, Roger Pau Monn? wrote: > > On Mon, Feb 26, 2018 at 05:36:35PM +0000, Amit Shah wrote: > > > > > > In case of errors in irq setup for MSI, free up the allocated irqs. > > > > > > Fixes: 4892c9b4ada9f9 ("xen: add support for MSI message groups") > > > Reported-by: Hooman Mirhadi > > > CC: > > > CC: Roger Pau Monn? > > > CC: David Vrabel > > > CC: Boris Ostrovsky > > > CC: Eduardo Valentin > > > CC: Juergen Gross > > > CC: Thomas Gleixner > > > CC: "K. Y. Srinivasan" > > > CC: Liu Shuo > > > CC: Anoob Soman > > > Signed-off-by: Amit Shah > > > --- > > > ?drivers/xen/events/events_base.c | 1 + > > > ?1 file changed, 1 insertion(+) > > > > > > diff --git a/drivers/xen/events/events_base.c > > > b/drivers/xen/events/events_base.c > > > index b6b8b29..96aa575 100644 > > > --- a/drivers/xen/events/events_base.c > > > +++ b/drivers/xen/events/events_base.c > > > @@ -758,6 +758,7 @@ int xen_bind_pirq_msi_to_irq(struct pci_dev > > > *dev, struct msi_desc *msidesc, > > > ?error_irq: > > > ? for (; i >= 0; i--) > > > ? __unbind_from_irq(irq + i); > > > + xen_free_irq(irq); > > Hm, xen_free_irq calls irq_free_desc, which is irq_free_descs(irq, > > 1), > > Er... ?right. > > > I think you will have to introduce a new free function: > > > > xen_free_irqs(unsigned irq, unsigned int nr) > > > > That calls irq_free_descs(irq, nr) > > Actually, xen_free_irq() is already done in __unbind_from_irq(), so > this patch is actually wrong and not needed. You still need to free unbound IRQs, AFAICT you could fix the issue with a single patch, like: while (nvec--) { if (nvec >= i) xen_free_irq(irq + i); else __unbind_from_irq(irq + i); } Roger.