Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.3 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,NICE_REPLY_A,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5AAFFC433DF for ; Wed, 29 Jul 2020 23:33:53 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 270FC2074B for ; Wed, 29 Jul 2020 23:33:53 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="IUvKk44X"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="d5epd9Dt" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 270FC2074B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Type: Content-Transfer-Encoding:Cc:Reply-To:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:Date: Message-ID:From:References:To:Subject:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=AYT79Z2whfCj7IozmNK03T0lI5Tc4zFMjuA5nPTtQno=; b=IUvKk44Xo46vDx 2fnTkaGvVZEQkNCFITTGJC0UM2KDPuZBYF7zg+VP1BO0010FIqlVQyvYBDlt4uczRPkMv2UXRnl/V JkPfpcJnympySkoSNAnqKrzW9JOSQHUHnmm35UUpdItd9zsHVlYylcn0kGeJutnQ617AtxtY7kv9R 2BOVGJvFU/7EKxllpSQ4W/Lw6nzjj4eoDTdkvyFEsWOaFqvNCvQEakc27LCE9kwerOc/B0VMGb58k /9tLjelfm4cErm8Wh8/1Cc0pNr0xqXPPZ/7za7Gcpql6XJfSIyiRI3SShrSPs297hZQBA/4bFbFGg NIbL878ctysmx8/0YDJQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1k0vYK-0004VY-6k; Wed, 29 Jul 2020 23:32:04 +0000 Received: from us-smtp-2.mimecast.com ([205.139.110.61] helo=us-smtp-delivery-1.mimecast.com) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1k0vYI-0004V3-Ft for linux-arm-kernel@lists.infradead.org; Wed, 29 Jul 2020 23:32:03 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1596065520; h=from:from:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=rPusAvU0HbYtco9g12peJLYn0+5PakOdDYtZsxvCQLI=; b=d5epd9DtmTchmGcyW12PAtAXUfDK1jD7VB1ByQ9gkoOJlfRx6V99Vff6lmaORXeCVeJzH7 E3/6B+e0nJGFEpAxhtehvn048d+1su7AJlCcrwTM8DQZLQnn1sbEyK0nCALQ45QjDu5pGw vExoZ22KCtLv1COgnkulw3Y1RZUaEt4= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-192-HIxhUkfXOTyQW8S6-NmbJw-1; Wed, 29 Jul 2020 19:31:56 -0400 X-MC-Unique: HIxhUkfXOTyQW8S6-NmbJw-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 6638280183C; Wed, 29 Jul 2020 23:31:55 +0000 (UTC) Received: from [10.64.54.54] (vpn2-54-54.bne.redhat.com [10.64.54.54]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E3DBA10013D0; Wed, 29 Jul 2020 23:31:52 +0000 (UTC) Subject: Re: [PATCH v3 11/15] drivers/firmware/sdei: Introduce sdei_do_local_call() To: Jonathan Cameron References: <20200728025955.144913-1-gshan@redhat.com> <20200728025955.144913-12-gshan@redhat.com> <20200728163225.00004a00@Huawei.com> From: Gavin Shan Message-ID: Date: Thu, 30 Jul 2020 09:31:49 +1000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.2.0 MIME-Version: 1.0 In-Reply-To: <20200728163225.00004a00@Huawei.com> Content-Language: en-US X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200729_193202_579141_5A4B57A6 X-CRM114-Status: GOOD ( 24.78 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Gavin Shan 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 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi Jonathan, On 7/29/20 1:32 AM, Jonathan Cameron wrote: > On Tue, 28 Jul 2020 12:59:51 +1000 > Gavin Shan 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 > > 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? > Yeah, it's true it's only called on local CPU, but it was derived from sdei_do_cross_call() because they are sharing same function prototype :) > Still I'm not that bothered hence if everyone else is happy it's > fine by me. > > Reviewed-by: Jonathan Cameron > Thanks, I will pick it up and put to v4. >> --- >> 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); Thanks, Gavin _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel