linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Marek Vasut <marex@denx.de>
To: "Bjørn Erik Nilsen" <ben@datarespons.no>
Cc: "jg1.han@samsung.com" <jg1.han@samsung.com>,
	"pratyush.anand@gmail.com" <pratyush.anand@gmail.com>,
	"bhelgaas@google.com" <bhelgaas@google.com>,
	"linux-pci@vger.kernel.org" <linux-pci@vger.kernel.org>,
	"kishon@ti.com" <kishon@ti.com>,
	"Mohit.KUMAR@st.com" <Mohit.KUMAR@st.com>,
	"ajay.khandelwal@st.com" <ajay.khandelwal@st.com>,
	"tharvey@gateworks.com" <tharvey@gateworks.com>,
	"Eric.Nelson@boundarydevices.com"
	<Eric.Nelson@boundarydevices.com>,
	"troy.kisky@boundarydevices.com" <troy.kisky@boundarydevices.com>
Subject: Re: [PATCH v5 1/2] PCI: designware: Fix crash in dw_msi_teardown_irq
Date: Mon, 2 Dec 2013 09:10:26 +0100	[thread overview]
Message-ID: <201312020910.26538.marex@denx.de> (raw)
In-Reply-To: <cmu-lmtpd-8418-1385750273-5@frontend1.mail.m-online.net>

Dear Bjørn Erik Nilsen,

> 29. nov. 2013 kl. 18:02 skrev Marek Vasut <marex@denx.de>:
> > Dear Bjørn Erik Nilsen,
> > 
> >> Dear Marek Vasut,
> >> 
> >> On Fri, 2013-11-29 at 16:36 +0100, Marek Vasut wrote:
> >>> Dear Bjørn Erik Nilsen,
> >>> [...]
> >>> 
> >>>>> Won't simple
> >>>>> 
> >>>>> for (i = 0; i < nvec; i++) {
> >>>>> 
> >>>>> do here?
> >>>> 
> >>>> Yes.
> >>>> 
> >>>> The very same syntax ('while i < nvec') is used in assign_irq. That is
> >>>> why I wanted to keep it like that to avoid adding too much confusion,
> >>>> or at least make it easy to recognize the same pattern.
> >>>> 
> >>>> You still want me to change it?
> >>> 
> >>> Your loop does exactly what a for() loop would do, there's no need to
> >>> emulate it with a while() loop. If you can fix the other one, fix the
> >>> other one as well please.
> >> 
> >> Yes, it is syntax sugar indeed and I did it purely for readability as
> >> explained. You don't seem to agree with me on the readability argument,
> >> so I can make the new code use a for-loop. And then in an unrelated
> >> commit (which would look awfully silly) I can change the other
> >> while-loop too.
> > 
> > Either way is fine with me, I'm just more inclined to the for loop ;-)
> > Let's wait for what the others have to say, they can judge this
> > argument.
> > 
> >>>> As for the other nitpick, I don't agree with you.
> >>>> 
> >>>> In fact, dw_msi_teardown_irq has no return value itself. Moreover, if
> >>>> setting the msi desc to NULL fails, then it simply means there is no
> >>>> irq desc and there is nothing to unwind. Also, skipping the other
> >>>> unwind operations just because that single operation failed would
> >>>> leave the driver in a much worse state. At least in my opinion.
> >>>> 
> >>>> What's your opinion on that?
> >>> 
> >>> I see this:
> >>> 
> >>> $ git grep irq_set_msi_desc_off include/
> >>> include/linux/irq.h:extern int irq_set_msi_desc_off(unsigned int
> >>> irq_base, unsigned int irq_offset,
> >>> 
> >>> So it has a return value which needs to be handled. Sorry if I wasn't
> >>> clear on the first try.
> >> 
> >> I agree that return values should be checked.
> >> 
> >> However based on my reasoning there is absolutely nothing to do with the
> >> return value in this particular case, and in fact bailing out will leave
> >> the driver in a much worse state (as other unwind operations will be
> >> skipped).
> >> 
> >> That is what I kindly asked you to comment on.
> > 
> > How come you cannot unwind what you did thus far and bail out ? That
> > means the design here is seriously broken, don't you think ?
> 
> Maybe you need to take a closer look at the patch because the code in
> question is *the* unwinding code. So bailing out from there  doesn't make
> much sense.
> 
> Also note that I do check the return value of the same function call in
> setup, but the one you are complaining is for unwinding stuff that has
> already been setup.
> 
> I hope this helps :-)

Please consider me stupid and blind, sorry. I think maybe a WARN_ON(ret) might 
be a good sign things have gone severely awry here at least. What do you think?

Best regards,

  parent reply	other threads:[~2013-12-02  8:10 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <528a1bb6.6a88700a.28c9.ffff824aSMTPIN_ADDED_MISSING@mx.google.com>
     [not found] ` <CAErSpo4TbUuq0wb06JV9Xchmcjsk9q3cm7+XO-dOSiJAAhXPMA@mail.gmail.com>
2013-11-18 21:02   ` Kernel oops from pci_disable_msi Bjorn Helgaas
2013-11-18 23:11     ` Jingoo Han
2013-11-19 11:24       ` Marek Vasut
     [not found] ` <1384861142.3682.1.camel@bnilsen-HP-EliteBook-8760w>
     [not found]   ` <cmu-lmtpd-19155-1384861370-13@frontend1.mail.m-online.net>
2013-11-19 22:01     ` Marek Vasut
     [not found]       ` <cmu-lmtpd-1612-1384936883-21@frontend1.mail.m-online.net>
2013-11-20 10:30         ` Marek Vasut
     [not found]           ` <cmu-lmtpd-21237-1384948548-21@frontend1.mail.m-online.net>
2013-11-20 12:02             ` Marek Vasut
     [not found]               ` <cmu-lmtpd-23243-1384949805-3@frontend1.mail.m-online.net>
2013-11-20 13:57                 ` Marek Vasut
     [not found]                   ` <1385036087.3945.28.camel@bnilsen-HP>
     [not found]                     ` <1385039987.6020.5.camel@bnilsen-HP>
     [not found]                       ` <16.79.22145.6305E825@epmailin9.samsung.com>
2013-11-22  8:48                         ` Jingoo Han
     [not found]                           ` <1385118399.3944.32.camel@bnilsen-HP>
     [not found]                             ` <7D.78.31634.B838F825@epmailin2.samsung.com>
2013-11-26 11:21                               ` [PATCH] " Jingoo Han
     [not found]                             ` <cmu-lmtpd-32538-1385137032-0@frontend1.mail.m-online.net>
2013-11-26 21:19                               ` Marek Vasut
     [not found]                                 ` <cmu-lmtpd-17794-1385506605-2@frontend1.mail.m-online.net>
2013-11-26 23:05                                   ` Marek Vasut
2013-11-27  9:46                                   ` Marek Vasut
     [not found]                                     ` <cmu-lmtpd-20073-1385566822-1@frontend1.mail.m-online.net>
2013-11-27 19:05                                       ` [PATCH v4] " Marek Vasut
     [not found]                                     ` <C7.DF.00504.D1216925@epmailin4.samsung.com>
2013-11-29  7:37                                       ` Jingoo Han
2013-11-29 13:35                                         ` [PATCH v5 0/2] " Bjørn Erik Nilsen
2013-11-29 13:35                                           ` [PATCH v5 1/2] PCI: designware: Fix crash in dw_msi_teardown_irq Bjørn Erik Nilsen
2013-11-29 14:32                                             ` Marek Vasut
     [not found]                                               ` <cmu-lmtpd-25244-1385737839-23@frontend1.mail.m-online.net>
2013-11-29 15:36                                                 ` Marek Vasut
     [not found]                                                   ` <cmu-lmtpd-32360-1385742114-0@frontend1.mail.m-online.net>
2013-11-29 17:02                                                     ` Marek Vasut
     [not found]                                                       ` <cmu-lmtpd-8418-1385750273-5@frontend1.mail.m-online.net>
2013-12-02  8:10                                                         ` Marek Vasut [this message]
2013-11-29 13:35                                           ` [PATCH v5 2/2] PCI: designware: Remove redundant call to pci_write_config Bjørn Erik Nilsen
2013-12-05  1:52                                           ` [PATCH v5 0/2] Kernel oops from pci_disable_msi Jingoo Han
2013-12-05  2:18                                             ` Marek Vasut
2013-12-05  2:24                                               ` Jingoo Han
2013-12-05  4:07                                                 ` Mohit KUMAR DCG
2013-12-09 20:43                                           ` Bjorn Helgaas
     [not found]                                             ` <52a632f0.e42c980a.3d86.ffff8faeSMTPIN_ADDED_MISSING@mx.google.com>
2013-12-09 21:21                                               ` Bjorn Helgaas
     [not found]                                                 ` <52a63678.4902980a.6fd7.ffffa2b9SMTPIN_ADDED_MISSING@mx.google.com>
2013-12-09 22:27                                                   ` Bjorn Helgaas

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=201312020910.26538.marex@denx.de \
    --to=marex@denx.de \
    --cc=Eric.Nelson@boundarydevices.com \
    --cc=Mohit.KUMAR@st.com \
    --cc=ajay.khandelwal@st.com \
    --cc=ben@datarespons.no \
    --cc=bhelgaas@google.com \
    --cc=jg1.han@samsung.com \
    --cc=kishon@ti.com \
    --cc=linux-pci@vger.kernel.org \
    --cc=pratyush.anand@gmail.com \
    --cc=tharvey@gateworks.com \
    --cc=troy.kisky@boundarydevices.com \
    /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).