From mboxrd@z Thu Jan 1 00:00:00 1970 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=-0.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED autolearn=no 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 D8885C433FF for ; Sat, 10 Aug 2019 06:37:45 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 AB46420B7C for ; Sat, 10 Aug 2019 06:37:45 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="jIngrVOG" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org AB46420B7C Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linux-m68k.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-riscv-bounces+infradead-linux-riscv=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:In-Reply-To: Date:References:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=0ahLoLJMD+mv/2UdaKwuOsKrtNnTY2iPVmFONtdPew8=; b=jIngrVOGEwEiLy 4qiuVHVrmlLpHgVdME11pnrafJ87/RXFKuRME0SmIZBSu9kZzYsPJmDtjPac7V+nyz4m49zzyoKJq e4eW7om52CWCuLaaWUKRIPmfoGSd+FJ2enAVekyTBAojAtjo+x0ps5d4KUyLcYXbhxlBXkhiY+2d2 0bGTNqfBbD/ThqQJEzeVt6AMiN1m8qZcumnTyUHD+Qbt3AY+zzwRjbOrDJIdYq6iDu+PqaNoJ1oyz z6ikNQJsTTU4xdcjFJcDc/iNoPmN3Z2mYOxhJjlyCV0+uiC7qCLe9ZhLzFrOiLj2YavU7kb1TYsya qcCgsFSaPX+XJXr9Avpw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hwL0U-0003ho-6c; Sat, 10 Aug 2019 06:37:38 +0000 Received: from mail-out.m-online.net ([212.18.0.9]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hwL0Q-0003hS-Et for linux-riscv@lists.infradead.org; Sat, 10 Aug 2019 06:37:36 +0000 Received: from frontend01.mail.m-online.net (unknown [192.168.8.182]) by mail-out.m-online.net (Postfix) with ESMTP id 465C8S5vmhz1rJCf; Sat, 10 Aug 2019 08:37:28 +0200 (CEST) Received: from localhost (dynscan1.mnet-online.de [192.168.6.70]) by mail.m-online.net (Postfix) with ESMTP id 465C8R6rLvz1qqkr; Sat, 10 Aug 2019 08:37:27 +0200 (CEST) X-Virus-Scanned: amavisd-new at mnet-online.de Received: from mail.mnet-online.de ([192.168.8.182]) by localhost (dynscan1.mail.m-online.net [192.168.6.70]) (amavisd-new, port 10024) with ESMTP id rgO-e_q9Of7V; Sat, 10 Aug 2019 08:37:26 +0200 (CEST) X-Auth-Info: MGf3vtvDZUlt9nH4JPNPyfNH0Crfs9J8zNlWOKuASYmkGDQGdc/2upzcT0jPFvb5 Received: from linux.local (ppp-46-244-179-104.dynamic.mnet-online.de [46.244.179.104]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.mnet-online.de (Postfix) with ESMTPSA; Sat, 10 Aug 2019 08:37:26 +0200 (CEST) Received: by linux.local (Postfix, from userid 501) id 88AD01E5386; Sat, 10 Aug 2019 08:37:21 +0200 (CEST) From: Andreas Schwab To: Atish Patra Subject: Re: [PATCH] RISC-V: Issue a local tlb flush if possible. References: <20190810014309.20838-1-atish.patra@wdc.com> X-Yow: Do I hear th' SPINNING of various WHIRRING, ROUND, and WARM WHIRLOMATICS?! Date: Sat, 10 Aug 2019 08:37:21 +0200 In-Reply-To: <20190810014309.20838-1-atish.patra@wdc.com> (Atish Patra's message of "Fri, 9 Aug 2019 18:43:09 -0700") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.2.90 (gnu/linux) MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190809_233734_648155_ACF7B508 X-CRM114-Status: GOOD ( 10.90 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Albert Ou , Greg Kroah-Hartman , Anup Patel , linux-kernel@vger.kernel.org, Alexios Zavras , Palmer Dabbelt , Paul Walmsley , linux-riscv@lists.infradead.org, Allison Randal Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-riscv" Errors-To: linux-riscv-bounces+infradead-linux-riscv=archiver.kernel.org@lists.infradead.org On Aug 09 2019, Atish Patra wrote: > @@ -46,14 +47,38 @@ static inline void remote_sfence_vma(struct cpumask *cmask, unsigned long start, > unsigned long size) > { > struct cpumask hmask; > + struct cpumask tmask; > + int cpuid = smp_processor_id(); > > cpumask_clear(&hmask); > - riscv_cpuid_to_hartid_mask(cmask, &hmask); > - sbi_remote_sfence_vma(hmask.bits, start, size); > + cpumask_clear(&tmask); > + > + if (cmask) > + cpumask_copy(&tmask, cmask); > + else > + cpumask_copy(&tmask, cpu_online_mask); > + > + if (cpumask_test_cpu(cpuid, &tmask)) { > + /* Save trap cost by issuing a local tlb flush here */ > + if ((start == 0 && size == -1) || (size > PAGE_SIZE)) > + local_flush_tlb_all(); > + else if (size == PAGE_SIZE) > + local_flush_tlb_page(start); > + cpumask_clear_cpu(cpuid, &tmask); > + } else if (cpumask_empty(&tmask)) { > + /* cpumask is empty. So just do a local flush */ > + local_flush_tlb_all(); > + return; > + } > + > + if (!cpumask_empty(&tmask)) { > + riscv_cpuid_to_hartid_mask(&tmask, &hmask); > + sbi_remote_sfence_vma(hmask.bits, start, size); > + } > } I think it's becoming too big to be inline. Andreas. -- Andreas Schwab, schwab@linux-m68k.org GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1 "And now for something completely different." _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv