From: Jonathan Cameron <Jonathan.Cameron@Huawei.com>
To: Gavin Shan <gshan@redhat.com>
Cc: mark.rutland@arm.com, catalin.marinas@arm.com,
james.morse@arm.com, shan.gavin@gmail.com, will@kernel.org,
linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v3 11/15] drivers/firmware/sdei: Introduce sdei_do_local_call()
Date: Tue, 28 Jul 2020 16:32:25 +0100 [thread overview]
Message-ID: <20200728163225.00004a00@Huawei.com> (raw)
In-Reply-To: <20200728025955.144913-12-gshan@redhat.com>
On Tue, 28 Jul 2020 12:59:51 +1000
Gavin Shan <gshan@redhat.com> wrote:
> During the CPU hotplug, the private events are registered, enabled
> or unregistered on the specific CPU. It repeats the same steps:
> initializing cross call argument, make function call on local CPU,
> check the returned error.
>
> This introduces sdei_do_local_call() to cover the first steps. The
> other benefit is to make CROSSCALL_INIT and struct sdei_crosscall_args
> are only visible to sddi_do_{cross, local}_call().
>
> Signed-off-by: Gavin Shan <gshan@redhat.com>
Hi Gavin,
I'm not totally convinced with the use of smp_call_func_t here.
It sort of feels a little confusing as type naming goes. It gets
used in similar places as smp_call_func_t would be, but not
really smp paths perhaps?
Still I'm not that bothered hence if everyone else is happy it's
fine by me.
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> ---
> v3: Use smp_call_func_t for @fn argument in sdei_do_local_call()
> ---
> drivers/firmware/arm_sdei.c | 41 ++++++++++++++++++++++---------------
> 1 file changed, 25 insertions(+), 16 deletions(-)
>
> diff --git a/drivers/firmware/arm_sdei.c b/drivers/firmware/arm_sdei.c
> index 5560c8880631..7f4309039513 100644
> --- a/drivers/firmware/arm_sdei.c
> +++ b/drivers/firmware/arm_sdei.c
> @@ -85,6 +85,17 @@ struct sdei_crosscall_args {
> atomic_set(&arg.errors, 0); \
> } while (0)
>
> +static inline int sdei_do_local_call(smp_call_func_t fn,
> + struct sdei_event *event)
> +{
> + struct sdei_crosscall_args arg;
> +
> + CROSSCALL_INIT(arg, event);
> + fn(&arg);
> +
> + return arg.first_error;
> +}
> +
> static inline int sdei_do_cross_call(smp_call_func_t fn,
> struct sdei_event *event)
> {
> @@ -677,7 +688,7 @@ static int sdei_reregister_shared(void)
> static int sdei_cpuhp_down(unsigned int cpu)
> {
> struct sdei_event *event;
> - struct sdei_crosscall_args arg;
> + int err;
>
> /* un-register private events */
> spin_lock(&sdei_list_lock);
> @@ -685,12 +696,11 @@ static int sdei_cpuhp_down(unsigned int cpu)
> if (event->type == SDEI_EVENT_TYPE_SHARED)
> continue;
>
> - CROSSCALL_INIT(arg, event);
> - /* call the cross-call function locally... */
> - _local_event_unregister(&arg);
> - if (arg.first_error)
> + err = sdei_do_local_call(_local_event_unregister, event);
> + if (err) {
> pr_err("Failed to unregister event %u: %d\n",
> - event->event_num, arg.first_error);
> + event->event_num, err);
> + }
> }
> spin_unlock(&sdei_list_lock);
>
> @@ -700,7 +710,7 @@ static int sdei_cpuhp_down(unsigned int cpu)
> static int sdei_cpuhp_up(unsigned int cpu)
> {
> struct sdei_event *event;
> - struct sdei_crosscall_args arg;
> + int err;
>
> /* re-register/enable private events */
> spin_lock(&sdei_list_lock);
> @@ -709,20 +719,19 @@ static int sdei_cpuhp_up(unsigned int cpu)
> continue;
>
> if (event->reregister) {
> - CROSSCALL_INIT(arg, event);
> - /* call the cross-call function locally... */
> - _local_event_register(&arg);
> - if (arg.first_error)
> + err = sdei_do_local_call(_local_event_register, event);
> + if (err) {
> pr_err("Failed to re-register event %u: %d\n",
> - event->event_num, arg.first_error);
> + event->event_num, err);
> + }
> }
>
> if (event->reenable) {
> - CROSSCALL_INIT(arg, event);
> - _local_event_enable(&arg);
> - if (arg.first_error)
> + err = sdei_do_local_call(_local_event_enable, event);
> + if (err) {
> pr_err("Failed to re-enable event %u: %d\n",
> - event->event_num, arg.first_error);
> + event->event_num, err);
> + }
> }
> }
> spin_unlock(&sdei_list_lock);
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2020-07-28 15:35 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-28 2:59 [PATCH v3 00/15] Refactor SDEI client driver Gavin Shan
2020-07-28 2:59 ` [PATCH v3 01/15] drivers/firmware/sdei: Remove sdei_is_err() Gavin Shan
2020-07-28 2:59 ` [PATCH v3 02/15] drivers/firmware/sdei: Common block for failing path in sdei_event_create() Gavin Shan
2020-07-28 2:59 ` [PATCH v3 03/15] drivers/firmware/sdei: Retrieve event number from event instance Gavin Shan
2020-07-28 2:59 ` [PATCH v3 04/15] drivers/firmware/sdei: Avoid nested statements in sdei_init() Gavin Shan
2020-07-28 2:59 ` [PATCH v3 05/15] drivers/firmware/sdei: Unregister driver on error " Gavin Shan
2020-07-28 2:59 ` [PATCH v3 06/15] drivers/firmware/sdei: Remove duplicate check in sdei_get_conduit() Gavin Shan
2020-07-28 2:59 ` [PATCH v3 07/15] drivers/firmware/sdei: Remove Drop redundant error message in sdei_probe() Gavin Shan
2020-07-28 2:59 ` [PATCH v3 08/15] drivers/firmware/sdei: Remove while loop in sdei_event_register() Gavin Shan
2020-07-28 2:59 ` [PATCH v3 09/15] drivers/firmware/sdei: Remove while loop in sdei_event_unregister() Gavin Shan
2020-07-28 2:59 ` [PATCH v3 10/15] drivers/firmware/sdei: Cleanup on cross call function Gavin Shan
2020-07-28 2:59 ` [PATCH v3 11/15] drivers/firmware/sdei: Introduce sdei_do_local_call() Gavin Shan
2020-07-28 15:32 ` Jonathan Cameron [this message]
2020-07-29 23:31 ` Gavin Shan
2020-07-28 2:59 ` [PATCH v3 12/15] drivers/firmware/sdei: Remove _sdei_event_register() Gavin Shan
2020-07-28 2:59 ` [PATCH v3 13/15] drivers/firmware/sdei: Remove _sdei_event_unregister() Gavin Shan
2020-07-28 2:59 ` [PATCH v3 14/15] drivers/firmware/sdei: Expose struct sdei_event Gavin Shan
2020-07-28 15:48 ` Jonathan Cameron
2020-07-30 0:34 ` Gavin Shan
2020-07-28 2:59 ` [PATCH v3 15/15] drivers/firmware/sdei: Identify event by " Gavin Shan
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=20200728163225.00004a00@Huawei.com \
--to=jonathan.cameron@huawei.com \
--cc=catalin.marinas@arm.com \
--cc=gshan@redhat.com \
--cc=james.morse@arm.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=mark.rutland@arm.com \
--cc=shan.gavin@gmail.com \
--cc=will@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).