linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Guenter Roeck <linux@roeck-us.net>
To: Bjorn Helgaas <bhelgaas@google.com>
Cc: Rajat Jain <rajatjain@juniper.net>,
	Yinghai Lu <yinghai@kernel.org>,
	Rajat Jain <rajatjain.linux@gmail.com>,
	"linux-pci@vger.kernel.org" <linux-pci@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>,
	Alex Williamson <alex.williamson@redhat.com>,
	Yijing Wang <wangyijing@huawei.com>,
	Paul Bolle <pebolle@tiscali.nl>,
	Rajat Jain <rajatxjain@gmail.com>,
	Guenter Roeck <groeck@juniper.net>
Subject: Re: [PATCH v2 2/4] pciehp: Use link change notifications for hot-plug and removal
Date: Mon, 16 Dec 2013 09:39:07 -0800	[thread overview]
Message-ID: <20131216173907.GC1811@roeck-us.net> (raw)
In-Reply-To: <CAErSpo4grMgCBetm7DMmizWQS_peM5yYBwFS99K8jbXaEWGmEg@mail.gmail.com>

On Sun, Dec 15, 2013 at 05:18:26PM -0700, Bjorn Helgaas wrote:
> On Sun, Dec 15, 2013 at 4:24 PM, Rajat Jain <rajatjain@juniper.net> wrote:
> >> > >
> >> > >> Once again: the way I interpret this is: * Always enable Link events.
> >> > >> * Disable presence events if attention button is present.
> >> > >
> >> > > That sounds like a good plan to me.
> >> >
> >> > How about Diag_Reset from MPT2SAS and others?  link could up and down
> >> >
> >
> > I am assuming you are referring to
> >
> > static int _base_diag_reset(struct MPT2SAS_ADAPTER *ioc, int sleep_flag)
> >
> > Which as far as I could understand would cause link to go down and come up
> > again without the kernel knowing anything about it?  ...
> 
> > In general, I guess the question is when a link goes down and back up,
> > whether or not we want to treat it as a hot unplug followed by a hotplug. I
> > think there may be cases such as AER (or the one Yinghai mentions) where we
> > don't want to treat it as a hotplug (see note below). And there may be cases
> > that we definitely want to treat it as hotplug (need link events!).
> > Situation gets more complex since there may be pciehp slots downstream of a
> > link getting reset.
> >
> > It seems to me that we are saying that a mechanism is needed so that a
> > voluntary Link flap is NOT treated like a hotplug temporarily?  ...
> 
> > Notes: * it may not OK, if the kernel thinks the device is accessible when
> > it is really not.  What if during this downtime, someone tries to access the
> > device (say userspace)?  * How do we know after the link up, that the device
> > is really the same.  If during this reset, the device changed its
> > "character", say a different class?  I think a rescan should be mandated
> > after every such event.  * Do we need to unload and reload the driver after
> > the link reset, since it can be a different device?
> 
> I am quite dubious about the idea of a voluntary link flap.  If the link goes
> down and comes back up, I don't see how we can make any assumptions about what
> device is there.
> 
> I let Alex talk me into pciehp_reset_slot(), which disables presence detect
> interrupts while resetting a device, so we already have a bit of precedent for
> the idea.  But even in that case, the device could easily come out of reset as
> a different device, e.g., if the reset caused it to load updated firmware.
> 
> I would feel much better if we treated link down as a remove and did a rescan
> on the link up.
> 
Agreed. Question is if we might need some means for a driver to tell the PCIe
core about an upcoming "planned" link flap. pciehp_reset_slot() doesn't seem
to address the condition where a driver resets a connected chip by other means
than by calling pciehp_reset_slot(). Still not sure what happens when the
mpt2sas driver issues its diagnostic reset, to take Yinghai's example (or if
there would be a cleaner way to implement such a reset).

Guenter

  reply	other threads:[~2013-12-16 17:39 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-03 22:32 [PATCH v2 2/4] pciehp: Use link change notifications for hot-plug and removal Rajat Jain
2013-12-05  9:07 ` Yijing Wang
2013-12-06  3:19   ` Rajat Jain
2013-12-12 22:44 ` Bjorn Helgaas
2013-12-13  6:26   ` Yinghai Lu
2013-12-13 13:21     ` Bjorn Helgaas
2013-12-13 19:04       ` Rajat Jain
2013-12-13 21:14         ` Bjorn Helgaas
2013-12-14  1:58           ` Yinghai Lu
2013-12-14  3:39             ` Guenter Roeck
2013-12-15 23:24               ` Rajat Jain
2013-12-16  0:18                 ` Bjorn Helgaas
2013-12-16 17:39                   ` Guenter Roeck [this message]
2013-12-17  1:14                     ` Bjorn Helgaas
2013-12-17  2:36                       ` Guenter Roeck
2013-12-15 22:23           ` Rajat Jain

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=20131216173907.GC1811@roeck-us.net \
    --to=linux@roeck-us.net \
    --cc=alex.williamson@redhat.com \
    --cc=bhelgaas@google.com \
    --cc=groeck@juniper.net \
    --cc=kaneshige.kenji@jp.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=pebolle@tiscali.nl \
    --cc=rajatjain.linux@gmail.com \
    --cc=rajatjain@juniper.net \
    --cc=rajatxjain@gmail.com \
    --cc=wangyijing@huawei.com \
    --cc=yinghai@kernel.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).