Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp1243723ybl; Fri, 9 Aug 2019 23:40:40 -0700 (PDT) X-Google-Smtp-Source: APXvYqwL1BDOXGy0sqwYE/51D1yiOWphTnKl+DboGhWbE+AZi/weXTeHcHS1IEMf4RdJmt5uSzIo X-Received: by 2002:a63:dd17:: with SMTP id t23mr20175257pgg.295.1565419239837; Fri, 09 Aug 2019 23:40:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565419239; cv=none; d=google.com; s=arc-20160816; b=hUIe8cQ11oX12q/LlbgvBoq/jWFdXVJs6N/jiedAhNDKEFVlO4xSxQmoAG/D2dJI0q m8WzR4QpDXo03TVXwMYW92V81EkBP/ogS8Q6+7rEmAm9RG/+yEtLTS/qPkr9Gd0v8fAp +aLNOREdRaYUi+b6aQRBuMF76w6NVK7q/Av/ZRUnoozQ0/LXrqWAoXfMRRUGw3XxI1CV oUthM+PvwvS86Cqb/Diua1Py5F2D202BAhCO9DZWObfzOsomi0wj6z54Gr+OOxrYXK8K XLQ7nlyyK6b1cg+oZRh02Uoe9v7SOARyT1cfwJfi4FXCju8U6zhHfkbdd0rf5t6+6I7Q yG9Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:message-id :in-reply-to:date:references:subject:cc:to:from; bh=iShIWbx/1LJOYQKn534ZcTjgOh9geqnCHQcSulB9AlE=; b=vVTBhT3L8SLwcaJEs5A9Ko3uUX/m/098wxRaynyq8upA97Xz9GNHCGHVfNqzySLkrz NXd2dGP/rU181DQy5EVUtsP3wJK3hPdXv2h/e78gQi3nV+bjtG1BQsQHh4jjYy+NJJUa /VLEVn/+mI4hW/lH2FzngJF+dtK5YHG14FwLuSMpSzafXhMfvrUcUtoJO+MSyDc1woYw 8tfnTWcXxAxJ8L7aXjsTwEBikpziW3wR8RkoJtacA/oiJjjRZApRgCZms7YvnUKednVK oexYChBbuVoIg9WU6idUjaV3yTWwIhHnp/+62exLLwrFztypfmRwmHfil3NK+vap4WbS xlpg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h30si3389456pjb.45.2019.08.09.23.39.07; Fri, 09 Aug 2019 23:40:39 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725927AbfHJGhd (ORCPT + 99 others); Sat, 10 Aug 2019 02:37:33 -0400 Received: from mail-out.m-online.net ([212.18.0.9]:40063 "EHLO mail-out.m-online.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725372AbfHJGhd (ORCPT ); Sat, 10 Aug 2019 02:37:33 -0400 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 Cc: linux-kernel@vger.kernel.org, Albert Ou , Alexios Zavras , Greg Kroah-Hartman , Palmer Dabbelt , Anup Patel , Paul Walmsley , linux-riscv@lists.infradead.org, Allison Randal 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 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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."