linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Juergen Gross <jgross@suse.com>
To: "Shah, Amit" <aams@amazon.de>,
	"roger.pau@citrix.com" <roger.pau@citrix.com>
Cc: "boris.ostrovsky@oracle.com" <boris.ostrovsky@oracle.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"tglx@linutronix.de" <tglx@linutronix.de>,
	"kys@microsoft.com" <kys@microsoft.com>,
	"stable@vger.kernel.org" <stable@vger.kernel.org>,
	"shuo.a.liu@intel.com" <shuo.a.liu@intel.com>,
	"anoob.soman@citrix.com" <anoob.soman@citrix.com>,
	"Valentin, Eduardo" <eduval@lab126.com>,
	"xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org>
Subject: Re: [PATCH v2 2/2] xen: events: free irqs in error condition
Date: Wed, 28 Feb 2018 09:27:12 +0100	[thread overview]
Message-ID: <ea7f2264-08e4-d107-ac95-89488c144fa4@suse.com> (raw)
In-Reply-To: <1519806324.4965.25.camel@amazon.com>

On 28/02/18 09:25, Shah, Amit wrote:
> 
> On Mi, 2018-02-28 at 08:16 +0000, Roger Pau Monné wrote:
>> 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 <mirhadih@amazon.com>
>>>>> CC: <stable@vger.kernel.org>
>>>>> CC: Roger Pau Monné <roger.pau@citrix.com>
>>>>> CC: Boris Ostrovsky <boris.ostrovsky@oracle.com>
>>>>> CC: Eduardo Valentin <eduval@amazon.com>
>>>>> CC: Juergen Gross <jgross@suse.com>
>>>>> CC: Thomas Gleixner <tglx@linutronix.de>
>>>>> CC: "K. Y. Srinivasan" <kys@microsoft.com>
>>>>> CC: Liu Shuo <shuo.a.liu@intel.com>
>>>>> CC: Anoob Soman <anoob.soman@citrix.com>
>>>>> Signed-off-by: Amit Shah <aams@amazon.com>
>>>>> ---
>>>>>  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)?
> 
> That was the part I didn't like much, so it would be better if the
> patch came from you :)

I'd prefer Roger's solution, too.

Roger, in case you don't want to write the patch, I can do it.


Juergen

      reply	other threads:[~2018-02-28  8:27 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-27 15:55 [PATCH v2 0/2] xen: fix bugs in error conditions Amit Shah
2018-02-27 15:55 ` [PATCH v2 1/2] xen: fix out-of-bounds irq unbind for MSI message groups Amit Shah
2018-02-27 16:58   ` Roger Pau Monné
2018-02-27 15:55 ` [PATCH v2 2/2] xen: events: free irqs in error condition Amit Shah
2018-02-27 17:07   ` Roger Pau Monné
2018-02-27 17:32     ` Shah, Amit
2018-02-28  8:16       ` Roger Pau Monné
2018-02-28  8:25         ` Shah, Amit
2018-02-28  8:27           ` Juergen Gross [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ea7f2264-08e4-d107-ac95-89488c144fa4@suse.com \
    --to=jgross@suse.com \
    --cc=aams@amazon.de \
    --cc=anoob.soman@citrix.com \
    --cc=boris.ostrovsky@oracle.com \
    --cc=eduval@lab126.com \
    --cc=kys@microsoft.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=roger.pau@citrix.com \
    --cc=shuo.a.liu@intel.com \
    --cc=stable@vger.kernel.org \
    --cc=tglx@linutronix.de \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).