All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: Bjorn Helgaas <helgaas@kernel.org>
Cc: Tonghao Zhang <xiangxia.m.yue@gmail.com>,
	linux-pci@vger.kernel.org, Christoph Hellwig <hch@lst.de>
Subject: Re: kernel panic becase pci register more than once
Date: Thu, 20 Sep 2018 08:40:55 +0200	[thread overview]
Message-ID: <20180920064055.GH12913@lst.de> (raw)
In-Reply-To: <20180917191503.GA54859@bhelgaas-glaptop.roam.corp.google.com>

On Mon, Sep 17, 2018 at 02:15:03PM -0500, Bjorn Helgaas wrote:
> A WARN_ON() shouldn't cause the kernel to panic.  Do you mean that it
> causes a backtrace?  I think that's the intended behavior, because
> calling this twice would be a driver bug, and we want to find and fix
> those bugs.
> 
> > diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c
> > index f2ef896..324840f 100644
> > --- a/drivers/pci/msi.c
> > +++ b/drivers/pci/msi.c
> > @@ -958,7 +958,9 @@ static int __pci_enable_msix(struct pci_dev *dev,
> > struct msix_entry *entries,
> >                         }
> >                 }
> >         }
> > -       WARN_ON(!!dev->msix_enabled);
> > +
> > +       if (dev->msix_enabled)
> > +               return -EINVAL;

This is a grave driver bug, so we should keep a trace.  Then again
handling even grave driver bugs more gracefull is a good idea, so I'd
vote for:

	if (WARN_ON_ONCE(dev->msix_enabled))
		return -EINVAL;

      parent reply	other threads:[~2018-09-20  6:40 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-09  8:26 kernel panic becase pci register more than once Tonghao Zhang
2018-09-17 19:15 ` Bjorn Helgaas
2018-09-18  2:00   ` Tonghao Zhang
2018-09-18 13:46     ` Bjorn Helgaas
2018-09-20  6:40   ` Christoph Hellwig [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=20180920064055.GH12913@lst.de \
    --to=hch@lst.de \
    --cc=helgaas@kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=xiangxia.m.yue@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.