Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp3174961rwi; Fri, 28 Oct 2022 17:16:09 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6jUNF/5deubGFwRMI79nWRhQCmFaETRmQ3p7oWNcfDBXbYKXaaOzn7+AW7ikqkDy7D6suP X-Received: by 2002:a17:907:d10:b0:79a:a1fe:8be5 with SMTP id gn16-20020a1709070d1000b0079aa1fe8be5mr1710525ejc.125.1667002569561; Fri, 28 Oct 2022 17:16:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667002569; cv=none; d=google.com; s=arc-20160816; b=zYnfQK0oNzbJjDkSBMja/ZsxFBCMVPMhDJV/n6VJwAewXoC3Z5r5flakq8jQlziJw/ 5MYqGVv+wQ10W417A4bKFZDPMryZIGZ2tGUavPftyIH9A9vm7e841UCVXC1n+49NY9Lp i8cESYqUDRrAUGoe2wVoIyfdebbMisIlqOz2UwHhqCeUs2Uxv5VPmAGkRyfyl0UqfgXV eBsYM7+o+u0rEANRuu9uHDNg5/4c7gjOPbZCk6fZSYzzFxJXCo/VTLrWm1ncT6vPulNs 1tuYE5czXlDtr0sS3pE9rgc99TC3C34bE80uaEdZFt0YsZGc0rv5gpY5tVR1sME/sEK7 pFyA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=vdbgZ8+Fu6n0HK4tgOaOYq43eN2AjNjj/Lhga+VAiyM=; b=FhhRtUtTkW76i7PMyFiqZivLtEdYuKIKDnG98+/T+s4L+9k9G7I/pxi5bqd6dLkWXU PnVQhccPTIGw2UKSLnkFrE5EUBW657PGBm8ARxRv6JGrVtNzbfjMu0x43y/suypEx5y9 86SADHdMarFWq9xQEsMR4NurJkJBInsFKnO+gTYr4qApgVM6k1r89q9nXG/v+Xsm3Qy3 aEKmjyU7e8+9SoaOVfgWb/ZwYUxbDWt8d4ZN706NyNAxPrXDKdGEgw1pbIgyx2YOkSuF jI3yar7pfd17fgtosTHGylcRKr+QRG1BjzQAM3VfRuDlokTdHeRBaILlRc9ax0Goelsx apeg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@rivosinc-com.20210112.gappssmtp.com header.s=20210112 header.b=aMw3oUjE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f19-20020a0564021e9300b0046151310d6dsi88137edf.498.2022.10.28.17.15.39; Fri, 28 Oct 2022 17:16:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@rivosinc-com.20210112.gappssmtp.com header.s=20210112 header.b=aMw3oUjE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229696AbiJ1XTq (ORCPT + 99 others); Fri, 28 Oct 2022 19:19:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59824 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229658AbiJ1XTm (ORCPT ); Fri, 28 Oct 2022 19:19:42 -0400 Received: from mail-pg1-x533.google.com (mail-pg1-x533.google.com [IPv6:2607:f8b0:4864:20::533]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5B6C1FD35 for ; Fri, 28 Oct 2022 16:19:41 -0700 (PDT) Received: by mail-pg1-x533.google.com with SMTP id f9so6080721pgj.2 for ; Fri, 28 Oct 2022 16:19:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=vdbgZ8+Fu6n0HK4tgOaOYq43eN2AjNjj/Lhga+VAiyM=; b=aMw3oUjEz8KxyX5NRy8i43+HJNi8jXjsGtcRnti8nSdP4d/D/7x/NYETkIaL+23EEd 37AA/MvumskK4g5anPHvbmKTEazSBxU8xWFpbfzNfVoHL8XP0rk5+6xe+EiYp19r4lgg 3E2+1UsnCFUXhBv/6PElhfyEisP2ddRRJSTJQBGQiJch9HkvDg9XowGTYV86BxzccqYz woDM+lrq8UDV+DZZ021IjdtLqgVhH6v9U57om+imUTcuJkGHkuke/Q/IBc/q3cH2Vblp rbMzYHQKFrzrAiJ7g5Rku+VyVCcvidbHmCvRJM8e14ayWyUZFgykrPs9tabdGTJCZyeb IAZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=vdbgZ8+Fu6n0HK4tgOaOYq43eN2AjNjj/Lhga+VAiyM=; b=5L0UciDwA9JSw+SzINCy2vtn9ML2XsuqTGx6/S7CAHiTgLBeXxoeu5T84rrV+W/hls 5udyafOEcG7wtKQcmp0WY799kT8JpwriSHEndEUOfg2ZowPEl9fKfQc6N4Woh2BALxHA SIgwnYfdOV2vCKYTF1z+r9JitBICao6wXBes/UOqCHpbMpZ4kA4CNPYlb9SiHtw0WHCn LEfRugqi6PE2mv/CGeSTaCZyWEOI7mzKYAC/NeghwHv/1cuXD2u8cBdsO4YWtYw/VNrs mjQUZxmapXdBmSnuvtncgeEBBMurFlXhAPCA+vYgCgnFVUeOIPCA8OlfjaYCiKg50drH ZdoQ== X-Gm-Message-State: ACrzQf39qTC5VqgVHayQ1OtqWH/H/kynfnzpxEhrEjrz8h+g1e9QQ3X+ 8QmXR5f/SdMiOXDCIisUNUCBGw8Cu4EeCA== X-Received: by 2002:a63:69c2:0:b0:46a:eeb1:e784 with SMTP id e185-20020a6369c2000000b0046aeeb1e784mr1617170pgc.589.1666999180528; Fri, 28 Oct 2022 16:19:40 -0700 (PDT) Received: from rivos-atish.hq.rivosinc.com ([50.221.140.188]) by smtp.gmail.com with ESMTPSA id jb5-20020a170903258500b00176ea6ce0efsm1335plb.109.2022.10.28.16.19.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Oct 2022 16:19:40 -0700 (PDT) From: Atish Patra To: linux-kernel@vger.kernel.org Cc: Atish Patra , Albert Ou , Atish Patra , Anup Patel , Damien Le Moal , devicetree@vger.kernel.org, Jisheng Zhang , Krzysztof Kozlowski , linux-riscv@lists.infradead.org, Palmer Dabbelt , Paul Walmsley , Rob Herring Subject: [PATCH] RISC-V: Do not issue remote fences until smp is available Date: Fri, 28 Oct 2022 16:19:29 -0700 Message-Id: <20221028231929.347918-1-atishp@rivosinc.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org It is useless to issue remote fences if there is a single core available. It becomes a bottleneck for sbi based rfences where we will be making those ECALLs for no reason. Early code patching because of static calls end up in this path. Signed-off-by: Atish Patra --- arch/riscv/mm/cacheflush.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/arch/riscv/mm/cacheflush.c b/arch/riscv/mm/cacheflush.c index f10cb47eac3a..7fafc8c26505 100644 --- a/arch/riscv/mm/cacheflush.c +++ b/arch/riscv/mm/cacheflush.c @@ -19,6 +19,10 @@ void flush_icache_all(void) { local_flush_icache_all(); + /* No need to issue remote fence if only 1 cpu is online */ + if (num_online_cpus() == 1) + return; + if (IS_ENABLED(CONFIG_RISCV_SBI) && !riscv_use_ipi_for_rfence()) sbi_remote_fence_i(NULL); else -- 2.34.1