Received: by 10.223.185.116 with SMTP id b49csp5905814wrg; Wed, 28 Feb 2018 00:17:41 -0800 (PST) X-Google-Smtp-Source: AH8x225XprHR29yoU+MRMBuSeB42M0JePU+QiOTpvHrplWsH1qdi+OBtCKdahyjYgUQdOTcSmqRj X-Received: by 2002:a17:902:8302:: with SMTP id bd2-v6mr16590481plb.295.1519805861535; Wed, 28 Feb 2018 00:17:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519805861; cv=none; d=google.com; s=arc-20160816; b=R03zhlTiXcX7hNGQ62KSIPkQi4bSv0dX8j9M4L++7ljsQSZpi3jnLVgaYKD4y631Pl FIkoPmPPEDfl2SOGzA6V0t2bfzMDyIWli9xeH/OVShcLy1V7EIrf7s8YrSDswdBw7AiS uFMbwlSAWf7TkzVOr18puSI7jcVWOVCEgKQ9eEeetwP5sF8BTdD+e+HFgYZWuyB1hv0n apEDXaLEPbrkAGMoKXPl5OXGLwPfCfuLXpkURXIGEAxG/y4XyCFlo6ZTXsH5DXJ7x1+f 9JIHOrtkWYOs04ojC7+Fcs8pZu+diVPSInnP+NmpIxKjXUk6FRSZL5JTuBFnm13H3H1a R1sw== 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=w08fbeD254DP8zid/JHTzmso2BU1gV15egTkvPvJlq4=; b=MdgLfTHy7HO8ihdukilyZuA6mmlK5dnAbXTquDkZGQ5HdWa4o6Z661GqsGD3m1k8uR XqfZ0lik5mORZ3Y1e4hjubWv5DfRINo9TKOYfA8+0L7K2dXsPZFOwAZx7g41x19KXtO3 xNdQ+r0x3u/FAoaALmk4oe+nEhK0TMpCG9JjwfUQ4ZKhD+fJoVHVlHobq04mKcAdUaq0 NIWMY1fMxkNz5xqW9UneisLom2gaCNn07Db/Vako1+2rXjWgDJUAPzu+Tfd2ktujx1zL z0BLd71uCA9wPmLo4hxv6wro9SPCRtKAqRZQDIMKjhHOAG817uLbAZvVhvIbNBVtIi++ K95w== 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 185si712770pgj.636.2018.02.28.00.17.22; Wed, 28 Feb 2018 00:17:41 -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 S1751972AbeB1IQh (ORCPT + 99 others); Wed, 28 Feb 2018 03:16:37 -0500 Received: from smtp.ctxuk.citrix.com ([185.25.65.24]:3202 "EHLO SMTP.EU.CITRIX.COM" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751682AbeB1IQg (ORCPT ); Wed, 28 Feb 2018 03:16:36 -0500 X-IronPort-AV: E=Sophos;i="5.47,404,1515456000"; d="scan'208";a="68757198" Date: Wed, 28 Feb 2018 08:16:23 +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 v2 2/2] xen: events: free irqs in error condition Message-ID: <20180228081623.umnyv4w67h2rsrwk@MacBook-Pro-de-Roger.local> References: <1519746958-52077-1-git-send-email-aams@amazon.com> <1519746958-52077-3-git-send-email-aams@amazon.com> <20180227170740.jcaxsvpepsn6eot2@MacBook-Pro-de-Roger.local> <1519752774.4965.23.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: <1519752774.4965.23.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 Tue, Feb 27, 2018 at 05:32:53PM +0000, Shah, Amit wrote: > > On Di, 2018-02-27 at 17:07 +0000, Roger Pau Monn? wrote: > > On Tue, Feb 27, 2018 at 03:55:58PM +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: 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 | 5 ++++- > > > ?1 file changed, 4 insertions(+), 1 deletion(-) > > > > > > diff --git a/drivers/xen/events/events_base.c > > > b/drivers/xen/events/events_base.c > > > index c86d10e..a299586 100644 > > > --- a/drivers/xen/events/events_base.c > > > +++ b/drivers/xen/events/events_base.c > > > @@ -750,11 +750,14 @@ int xen_bind_pirq_msi_to_irq(struct pci_dev > > > *dev, struct msi_desc *msidesc, > > > ? > > > ? ret = irq_set_msi_desc(irq, msidesc); > > > ? if (ret < 0) > > > - goto error_irq; > > > + goto error_desc; > > > ?out: > > > ? mutex_unlock(&irq_mapping_update_lock); > > > ? return irq; > > > ?error_irq: > > > + while (--nvec >= i) > > > + xen_free_irq(irq + nvec); > > > +error_desc: > > > ? while (i > 0) { > > > ? i--; > > > ? __unbind_from_irq(irq + i); > > It seems pointless to introduce another label and another loop to fix > > something that can be fixed with a single label and a single loop, > > this just makes the code more complex for no reason. > > I disagree, just because there are two different cleanups to be made > for two different issues; it's not as if the if.. and else conditions > are going to be interleaved. Oh, I don't mind so much whether it ends up being two patches or a single one, but IMHO the code should end up looking similar to what I proposed, I would like to avoid having two loops and two labels. Could you rework the series so that the end result uses a single loop (and label)? Thanks, Roger.