From: Nathan Fontenot <nfont@linux.vnet.ibm.com>
To: John Allen <jallen@linux.vnet.ibm.com>,
Michael Ellerman <mpe@ellerman.id.au>,
linuxppc-dev@lists.ozlabs.org
Cc: Michael Roth <mdroth@linux.vnet.ibm.com>
Subject: Re: [PATCH 1/3] powerpc/pseries: Add pseries hotplug workqueue
Date: Mon, 11 Jul 2016 10:48:57 -0500 [thread overview]
Message-ID: <5783BFE9.9090907@linux.vnet.ibm.com> (raw)
In-Reply-To: <f03894c6-edf7-9fcc-c817-6e0ee6234dd6@linux.vnet.ibm.com>
On 07/07/2016 10:00 AM, John Allen wrote:
> In support of PAPR changes to add a new hotplug interrupt, introduce a
> hotplug workqueue to avoid processing hotplug events in interrupt context.
> We will also take advantage of the queue on PowerVM to ensure hotplug
> events initiated from different sources (HMC and PRRN events) are handled
> and serialized properly.
>
> Signed-off-by: John Allen <jallen@linux.vnet.ibm.com>
> ---
> arch/powerpc/platforms/pseries/dlpar.c | 52 ++++++++++++++++++++++++++++++++
> 1 file changed, 52 insertions(+)
>
> diff --git a/arch/powerpc/platforms/pseries/dlpar.c b/arch/powerpc/platforms/pseries/dlpar.c
> index 2b93ae8..66a77d7 100644
> --- a/arch/powerpc/platforms/pseries/dlpar.c
> +++ b/arch/powerpc/platforms/pseries/dlpar.c
> @@ -27,6 +27,15 @@
> #include <asm/uaccess.h>
> #include <asm/rtas.h>
>
> +struct workqueue_struct *pseries_hp_wq;
> +
> +struct pseries_hp_work {
> + struct work_struct work;
> + struct pseries_hp_errorlog *errlog;
> + struct completion *hp_completion;
> + int *rc;
> +};
> +
> struct cc_workarea {
> __be32 drc_index;
> __be32 zero;
> @@ -368,10 +377,51 @@ static int handle_dlpar_errorlog(struct pseries_hp_errorlog *hp_elog)
> return rc;
> }
>
> +void pseries_hp_work_fn(struct work_struct *work)
> +{
> + struct pseries_hp_work *hp_work =
> + container_of(work, struct pseries_hp_work, work);
> +
> + if (hp_work->rc)
> + *(hp_work->rc) = handle_dlpar_errorlog(hp_work->errlog);
> + else
> + handle_dlpar_errorlog(hp_work->errlog);
> +
> + if (hp_work->hp_completion)
> + complete(hp_work->hp_completion);
> +
> + kfree(hp_work->errlog);
> + kfree((void *)work);
> +}
> +
> +void queue_hotplug_event(struct pseries_hp_errorlog *hp_errlog,
> + struct completion *hotplug_done, int *rc)
> +{
> + struct pseries_hp_work *work;
> + struct pseries_hp_errorlog *hp_errlog_copy;
> +
> + hp_errlog_copy = kmalloc(sizeof(struct pseries_hp_errorlog),
> + GFP_KERNEL);
> + memcpy(hp_errlog_copy, hp_errlog, sizeof(struct pseries_hp_errorlog));
> +
> + work = kmalloc(sizeof(struct pseries_hp_work), GFP_KERNEL);
> + if (work) {
> + INIT_WORK((struct work_struct *)work, pseries_hp_work_fn);
> + work->errlog = hp_errlog_copy;
> + work->hp_completion = hotplug_done;
> + work->rc = rc;
> + queue_work(pseries_hp_wq, (struct work_struct *)work);
> + } else {
> + *rc = -ENOMEM;
> + complete(hotplug_done);
> + }
> +}
> +
> static ssize_t dlpar_store(struct class *class, struct class_attribute *attr,
> const char *buf, size_t count)
> {
> struct pseries_hp_errorlog *hp_elog;
> + struct completion hotplug_done;
It may not matter but this looks it may fit better in patch 3/3.
Otherwise looks good.
Reviewed-by: Nathan Fontenot <nfont@linux.vnet.ibm.com>
> const char *arg;
> int rc;
>
> @@ -450,6 +500,8 @@ static CLASS_ATTR(dlpar, S_IWUSR, NULL, dlpar_store);
>
> static int __init pseries_dlpar_init(void)
> {
> + pseries_hp_wq = alloc_workqueue("pseries hotplug workqueue",
> + WQ_UNBOUND, 1);
> return sysfs_create_file(kernel_kobj, &class_attr_dlpar.attr);
> }
> machine_device_initcall(pseries, pseries_dlpar_init);
>
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/linuxppc-dev
>
next prev parent reply other threads:[~2016-07-11 15:49 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-07-07 14:57 [PATCH 0/3] powerpc/pseries: Add pseries hotplug queue and PowerVM/PowerKVM use cases John Allen
2016-07-07 15:00 ` [PATCH 1/3] powerpc/pseries: Add pseries hotplug workqueue John Allen
2016-07-11 15:48 ` Nathan Fontenot [this message]
2016-07-20 9:10 ` [1/3] " Michael Ellerman
2016-07-07 15:03 ` [PATCH 2/3] powerpc/pseries: Add support for hotplug interrupt source John Allen
2016-07-11 15:49 ` Nathan Fontenot
2016-07-07 15:05 ` [PATCH 3/3] powerpc/pseries: Use kernel hotplug queue for PowerVM hotplug events John Allen
2016-07-11 15:52 ` Nathan Fontenot
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=5783BFE9.9090907@linux.vnet.ibm.com \
--to=nfont@linux.vnet.ibm.com \
--cc=jallen@linux.vnet.ibm.com \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=mdroth@linux.vnet.ibm.com \
--cc=mpe@ellerman.id.au \
/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.