public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jesse Barnes <jbarnes@virtuousgeek.org>
To: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>,
	linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] pciehp:  Handle interrupts that happen during initialization.
Date: Fri, 13 Feb 2009 11:29:08 -0800	[thread overview]
Message-ID: <200902131129.09523.jbarnes@virtuousgeek.org> (raw)
In-Reply-To: <49815BF6.7060402@jp.fujitsu.com>

Any update here, Eric?  Sounds like you're using hotplug in real environments 
with complex topologies (based on your earlier messages), so we're interested 
in what you're seeing here...

Thanks,
Jesse

On Wednesday, January 28, 2009 11:34 pm Kenji Kaneshige wrote:
> Hi,
>
> I don't understand what this patch is trying to fix. Could you
> please tell me more about the problem?
>
> And I have a worry. With this patch, the hotplug operation files
> under /sys/bus/pci/slots/*/ directory will be created before the
> interrupt is initialized. If hotplug operation is initiated (power
> on/off, change attention indicator and so on) by user before
> interrupt is initialized (though I think it's rare), command
> completion event could not be handled.
>
> Thanks,
> Kenji Kaneshige
>
> Eric W. Biederman wrote:
> > Move the enabling of interrupts after all of the data structures
> > are setup so that we can safely run the interrupt handler as
> > soon as it is registered.
> >
> > Signed-off-by: Eric W. Biederman <ebiederm@aristanetworks.com>
> > ---
> >  drivers/pci/hotplug/pciehp.h      |    2 ++
> >  drivers/pci/hotplug/pciehp_core.c |    7 +++++++
> >  drivers/pci/hotplug/pciehp_hpc.c  |   15 +++++++--------
> >  3 files changed, 16 insertions(+), 8 deletions(-)
> >
> > diff --git a/drivers/pci/hotplug/pciehp.h b/drivers/pci/hotplug/pciehp.h
> > index db85284..39ae375 100644
> > --- a/drivers/pci/hotplug/pciehp.h
> > +++ b/drivers/pci/hotplug/pciehp.h
> > @@ -111,6 +111,7 @@ struct controller {
> >  	int cmd_busy;
> >  	unsigned int no_cmd_complete:1;
> >  	unsigned int link_active_reporting:1;
> > +	unsigned int notification_enabled:1;
> >  };
> >
> >  #define INT_BUTTON_IGNORE		0
> > @@ -170,6 +171,7 @@ extern int pciehp_configure_device(struct slot
> > *p_slot); extern int pciehp_unconfigure_device(struct slot *p_slot);
> >  extern void pciehp_queue_pushbutton_work(struct work_struct *work);
> >  struct controller *pcie_init(struct pcie_device *dev);
> > +int pcie_init_notification(struct controller *ctrl);
> >  int pciehp_enable_slot(struct slot *p_slot);
> >  int pciehp_disable_slot(struct slot *p_slot);
> >  int pcie_enable_notification(struct controller *ctrl);
> > diff --git a/drivers/pci/hotplug/pciehp_core.c
> > b/drivers/pci/hotplug/pciehp_core.c index c248554..681e391 100644
> > --- a/drivers/pci/hotplug/pciehp_core.c
> > +++ b/drivers/pci/hotplug/pciehp_core.c
> > @@ -434,6 +434,13 @@ static int pciehp_probe(struct pcie_device *dev,
> > const struct pcie_port_service_ goto err_out_release_ctlr;
> >  	}
> >
> > +	/* Enable events after we have setup the data structures */
> > +	rc = pcie_init_notification(ctrl);
> > +	if (rc) {
> > +		ctrl_err(ctrl, "Notification initialization failed\n");
> > +		goto err_out_release_ctlr;
> > +	}
> > +
> >  	/* Check if slot is occupied */
> >  	t_slot = pciehp_find_slot(ctrl, ctrl->slot_device_offset);
> >  	t_slot->hpc_ops->get_adapter_status(t_slot, &value);
> > diff --git a/drivers/pci/hotplug/pciehp_hpc.c
> > b/drivers/pci/hotplug/pciehp_hpc.c index 71a8012..7a16c68 100644
> > --- a/drivers/pci/hotplug/pciehp_hpc.c
> > +++ b/drivers/pci/hotplug/pciehp_hpc.c
> > @@ -934,7 +934,7 @@ static void pcie_disable_notification(struct
> > controller *ctrl) ctrl_warn(ctrl, "Cannot disable software
> > notification\n");
> >  }
> >
> > -static int pcie_init_notification(struct controller *ctrl)
> > +int pcie_init_notification(struct controller *ctrl)
> >  {
> >  	if (pciehp_request_irq(ctrl))
> >  		return -1;
> > @@ -942,13 +942,17 @@ static int pcie_init_notification(struct controller
> > *ctrl) pciehp_free_irq(ctrl);
> >  		return -1;
> >  	}
> > +	ctrl->notification_enabled = 1;
> >  	return 0;
> >  }
> >
> >  static void pcie_shutdown_notification(struct controller *ctrl)
> >  {
> > -	pcie_disable_notification(ctrl);
> > -	pciehp_free_irq(ctrl);
> > +	if (ctrl->notification_enabled) {
> > +		pcie_disable_notification(ctrl);
> > +		pciehp_free_irq(ctrl);
> > +		ctrl->notification_enabled = 0;
> > +	}
> >  }
> >
> >  static int pcie_init_slot(struct controller *ctrl)
> > @@ -1110,13 +1114,8 @@ struct controller *pcie_init(struct pcie_device
> > *dev) if (pcie_init_slot(ctrl))
> >  		goto abort_ctrl;
> >
> > -	if (pcie_init_notification(ctrl))
> > -		goto abort_slot;
> > -
> >  	return ctrl;
> >
> > -abort_slot:
> > -	pcie_cleanup_slot(ctrl);
> >  abort_ctrl:
> >  	kfree(ctrl);
> >  abort:



-- 
Jesse Barnes, Intel Open Source Technology Center

  reply	other threads:[~2009-02-13 19:29 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-29  3:31 [PATCH] pciehp: Handle interrupts that happen during initialization Eric W. Biederman
2009-01-29  7:34 ` Kenji Kaneshige
2009-02-13 19:29   ` Jesse Barnes [this message]
2009-02-14  4:06     ` Eric W. Biederman
2009-02-14 12:53       ` Eric W. Biederman
2009-02-14 14:56         ` Eric W. Biederman
2009-02-16  8:02           ` Kenji Kaneshige
2009-02-17 23:17             ` Eric W. Biederman
2009-02-18  5:48               ` Kenji Kaneshige
2009-02-23 11:08                 ` Eric W. Biederman
2009-02-24 17:05                   ` Jesse Barnes
2009-02-24 17:08                   ` Jesse Barnes
2009-02-16  8:00       ` Kenji Kaneshige
2009-02-18  0:40         ` Eric W. Biederman
2009-02-18  7:12           ` Kenji Kaneshige
2009-02-18  8:47             ` Eric W. Biederman
2009-02-20  6:18               ` Kenji Kaneshige
2009-02-23 11:17               ` Eric W. Biederman
2009-02-24 17:38 ` Jesse Barnes

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=200902131129.09523.jbarnes@virtuousgeek.org \
    --to=jbarnes@virtuousgeek.org \
    --cc=ebiederm@xmission.com \
    --cc=kaneshige.kenji@jp.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.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