Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp109031ybt; Thu, 25 Jun 2020 16:39:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw1bXKNChCcDnhQpAEYIpxEcDQYtrmaZQm3o4+f7TmZ8+RfGPJ2jrHOOTIxjLVnJBzz0Yor X-Received: by 2002:a17:907:7245:: with SMTP id ds5mr191938ejc.1.1593128385357; Thu, 25 Jun 2020 16:39:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593128385; cv=none; d=google.com; s=arc-20160816; b=pf8T9djrLIjFmT8oeWKQePjoY0GReVRGnhIaZrRHm4D41O3WjoHv2beS7vs9UJTVJq U2xJ5pIe2AZtS5FFqWiWfMRpgbJe0Gthb8gGrhEJyh7z77Cqey61b9CUrcyOxrmHOS5o 7HIj5AHNW6aCR8U2SMOVlcR1CXJ6+m+hD8X1jvELwDU2d1bKCR7VgUB4wKSmWOB/pIuP SBdvHJmMLbjNcRO4dJNBrakF6Vlq/LJv7DhAasdsoXl1xSVpbkmv64T+ONXAhj5sOu1+ 7yS96a/e2xTtuZuw6WIXuz1wtydNDbvFyOtvoxHp9ekKCfKO4tqTEPzAAXsXCB/LMOFK 4L3g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:to:from:cc:in-reply-to:subject:date:dkim-signature; bh=YwxJgs2ekm2F5i2bbq3bvR99tjvhSs3RBO886udVeFE=; b=YH5LIqQAp17fLtRjgjI2IUEXP9pbGx4eKD3VJlCZJIg4egFb68A44lXYQrcazbZIbp oDQuM+cG9ZG2hrKp1Yr1kR0c6lM9Q1k27BqXH27MWF2CYS6qnOZ9GbsJZ3fKiCupD6vt Vx0fN/oT4io6ID+XJ9lMWihM/rReyLMOEejQ/pRO2MXit3Bi5WElByIBUvnHERptZZJl vGbPhRsvV36ksiDZ8WazF7LNM42LP+vSk1kAvSauaU8FsvrCVcjtrVOH1KbqS51GSoaf o5YFqdaLM0eepLQ3qSxdKgtALt/V//dFyM1s5Hbw2/BJP7LsafX/lii/MCb/GNDKWFuE X6bg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@dabbelt-com.20150623.gappssmtp.com header.s=20150623 header.b=AaW0I7wf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c19si16182567ejk.253.2020.06.25.16.39.22; Thu, 25 Jun 2020 16:39:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@dabbelt-com.20150623.gappssmtp.com header.s=20150623 header.b=AaW0I7wf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2407139AbgFYV1x (ORCPT + 99 others); Thu, 25 Jun 2020 17:27:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55368 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2403774AbgFYV1w (ORCPT ); Thu, 25 Jun 2020 17:27:52 -0400 Received: from mail-pg1-x541.google.com (mail-pg1-x541.google.com [IPv6:2607:f8b0:4864:20::541]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9E249C08C5C1 for ; Thu, 25 Jun 2020 14:27:52 -0700 (PDT) Received: by mail-pg1-x541.google.com with SMTP id f3so3940949pgr.2 for ; Thu, 25 Jun 2020 14:27:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dabbelt-com.20150623.gappssmtp.com; s=20150623; h=date:subject:in-reply-to:cc:from:to:message-id:mime-version :content-transfer-encoding; bh=YwxJgs2ekm2F5i2bbq3bvR99tjvhSs3RBO886udVeFE=; b=AaW0I7wf4VZi0tWYgsg0VXtU1/5OGKDM1/Sk65n9jmsn2IHKE0FgxNJRUXhp2LNS5O VxEWngolyhwIiqJPDqTRL+0wV2tp8Lk2ANlwhpXuC6ha7JwE2aCr7+7ojqIx++AnnoBL 0lp82ylALuEFpFZLkRpDZsRyFetD4967ioBXlIWWukROBYsxAjquAShJp8VX+91+6uTD fL9zHCiRxJ5DJME5M77E3XFFnvdAPsV3FoyiFSkA0NDnONfIWKiB+tL2+MOQNanqjWQx FnKzlMURYcU9CGrPQy6PW9nZyRMvNZjdDF7uxzbDMqcSd4L94Vr2KH+717jxAE9Q4b+k mqmQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:subject:in-reply-to:cc:from:to:message-id :mime-version:content-transfer-encoding; bh=YwxJgs2ekm2F5i2bbq3bvR99tjvhSs3RBO886udVeFE=; b=U+F+9PJy9fNixJ6jCPaCALlsbj20H0UlpLOh0QzijgCmYOW1iKKq9t+dNItHcPX2ln sVME97c7GC1jrnLwFKNKmLUrKKyWnQpCj1c1QtpEy1bNn2NBG6fm9pmWo84cvEjstgb7 UT1vvkxhLXxBLKeyXTOVq9GvsuWQYvuB3+XUqMEjGEkEyUBn7nAZCRDOWNK7cUq9hlRz YHbBnkwAPfcPkK8xqYENQNnqdfsGYkjamzYjL/73WRXx0eU1gFUkUVD9s+KSs58qVN5u 3I5e93INdUss/0kp3LHL/oN+w4jfJplNJKW/fSgAEEjrqDoRZkU0TQUetZDIYvka1Tu2 9+mQ== X-Gm-Message-State: AOAM530Jy0efnx32fvibkCS47c7KzE6hJ6jUYrhbmZ2alCfYT/VeZGEI Jl+eFhEKdazycDCrbdB/+yIQVdUWFiDGPg== X-Received: by 2002:a62:8782:: with SMTP id i124mr35615630pfe.267.1593120471660; Thu, 25 Jun 2020 14:27:51 -0700 (PDT) Received: from localhost (76-210-143-223.lightspeed.sntcca.sbcglobal.net. [76.210.143.223]) by smtp.gmail.com with ESMTPSA id h2sm24673386pfb.175.2020.06.25.14.27.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Jun 2020 14:27:50 -0700 (PDT) Date: Thu, 25 Jun 2020 14:27:50 -0700 (PDT) X-Google-Original-Date: Thu, 25 Jun 2020 14:23:09 PDT (-0700) Subject: Re: [PATCH] RISC-V: Use a local variable instead of smp_processor_id() In-Reply-To: <20200622234725.92511-1-atish.patra@wdc.com> CC: linux-kernel@vger.kernel.org, greentime.hu@sifive.com, Atish Patra , aou@eecs.berkeley.edu, anup@brainfault.org, linux-riscv@lists.infradead.org, Paul Walmsley From: Palmer Dabbelt To: Atish Patra Message-ID: Mime-Version: 1.0 (MHng) Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 22 Jun 2020 16:47:25 PDT (-0700), Atish Patra wrote: > From: Greentime Hu > > Store the smp_processor_id() in a local variable to save some > pointer chasing. > > Signed-off-by: Greentime Hu > Signed-off-by: Atish Patra > --- > arch/riscv/kernel/smpboot.c | 7 ++++--- > 1 file changed, 4 insertions(+), 3 deletions(-) > > diff --git a/arch/riscv/kernel/smpboot.c b/arch/riscv/kernel/smpboot.c > index 4e9922790f6e..3e033e97dd08 100644 > --- a/arch/riscv/kernel/smpboot.c > +++ b/arch/riscv/kernel/smpboot.c > @@ -146,6 +146,7 @@ void __init smp_cpus_done(unsigned int max_cpus) > asmlinkage __visible void smp_callin(void) > { > struct mm_struct *mm = &init_mm; > + unsigned int curr_cpuid = smp_processor_id(); > > if (!IS_ENABLED(CONFIG_RISCV_SBI)) > clint_clear_ipi(cpuid_to_hartid_map(smp_processor_id())); > @@ -155,9 +156,9 @@ asmlinkage __visible void smp_callin(void) > current->active_mm = mm; > > trap_init(); > - notify_cpu_starting(smp_processor_id()); > - update_siblings_masks(smp_processor_id()); > - set_cpu_online(smp_processor_id(), 1); > + notify_cpu_starting(curr_cpuid); > + update_siblings_masks(curr_cpuid); > + set_cpu_online(curr_cpuid, 1); > /* > * Remote TLB flushes are ignored while the CPU is offline, so emit > * a local TLB flush right now just in case. Thanks. This is on for-next.