Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp211483ybl; Tue, 20 Aug 2019 18:32:00 -0700 (PDT) X-Google-Smtp-Source: APXvYqyc/ydNgvjP2wKgPSoYe8r+84lwn+t4igxmv0mjU2ft7UYYnksK8i7JrZjgz8Ml+p5yLmfb X-Received: by 2002:a65:4808:: with SMTP id h8mr26967886pgs.22.1566351120257; Tue, 20 Aug 2019 18:32:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566351120; cv=none; d=google.com; s=arc-20160816; b=XK8ondW5jh93CIykQ7PgMr8Jhv8JvO29eayo9aLxWzjUpkvJE4uC8ddWW15GDWIawB f8lZyW7+V1kR8RT6oGrclUIoTLhMmEaFdCNtT5LFxWdCZXGMbXN2j9Vfjsy5zIUCKvmW HBsQsPUB3/VkqN3b2I1f+O1jDlWQzjwvHWCR8E5nOJy6Z/WDdJ7PLuR3xoazWoIV4gfs GkXeGVWZRM3r3T0WIjrHaPY11bS2UgqKSs+Jwo8yww/hjm7WsW9t7DoXIaHq5opKwgB9 wZr0WBcdNHfqaSwhIMuHeNqKmA7GqNa45Jplr+YsO3RJGFfwHyCzi0gLo8o1+qHR2GvD u3dw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=LlDMRM7nA63LHNRryI566UKoDJl3168ngfJ2K3AdmR8=; b=SEjHoXk7DFkTFPhXxf2AOSnOwezfs/StVLOG2FvH+ZuSLTDbFkMuyo1GoGBUEefP/0 CzQLMf2cbxvWYTXclKdQuE5VyHNj0rYJCY5nRS/f6tC/ZOk4A0ol+1X4pXqPWzxUN4rf DpQT5WxyyeRV1pTpKfbimJgzm4J4PV1ntZN+5ZO86EQ13UlwD1W1LvYRrIgnxw7wSZgc Tv/Qb4E+9Noybp+5MTiXgRWngV8rUwlLtbWtuYyYHd3LTaOV+5f0cM31SHfbR3Gb1UQc hkYQBi8kggWvhs0v/9AWj4PbFXV8ywf6ManT6Bum7h6j/72Wu5tdUzZ5tHeAD1afdWn3 zeWQ== 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 k16si13065555pgl.592.2019.08.20.18.31.45; Tue, 20 Aug 2019 18:32:00 -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 S1726980AbfHUBaj (ORCPT + 99 others); Tue, 20 Aug 2019 21:30:39 -0400 Received: from 59-120-53-16.HINET-IP.hinet.net ([59.120.53.16]:25685 "EHLO ATCSQR.andestech.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726307AbfHUBaj (ORCPT ); Tue, 20 Aug 2019 21:30:39 -0400 Received: from mail.andestech.com (atcpcs16.andestech.com [10.0.1.222]) by ATCSQR.andestech.com with ESMTP id x7L1HIrU040654; Wed, 21 Aug 2019 09:17:18 +0800 (GMT-8) (envelope-from alankao@andestech.com) Received: from andestech.com (10.0.15.65) by ATCPCS16.andestech.com (10.0.1.222) with Microsoft SMTP Server id 14.3.123.3; Wed, 21 Aug 2019 09:29:22 +0800 Date: Wed, 21 Aug 2019 09:29:22 +0800 From: Alan Kao To: Atish Patra CC: "hch@infradead.org" , "aou@eecs.berkeley.edu" , "anup@brainfault.org" , "palmer@sifive.com" , "linux-kernel@vger.kernel.org" , "schwab@linux-m68k.org" , "paul.walmsley@sifive.com" , "linux-riscv@lists.infradead.org" , "allison@lohutok.net" Subject: Re: [v2 PATCH] RISC-V: Optimize tlb flush path. Message-ID: <20190821012921.GA30187@andestech.com> References: <20190820004735.18518-1-atish.patra@wdc.com> <20190820092207.GA26271@infradead.org> <76467815b464709f4c899444c957d921ebac87db.camel@wdc.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <76467815b464709f4c899444c957d921ebac87db.camel@wdc.com> User-Agent: Mutt/1.5.24 (2015-08-30) X-Originating-IP: [10.0.15.65] X-DNSRBL: X-MAIL: ATCSQR.andestech.com x7L1HIrU040654 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Aug 20, 2019 at 08:28:36PM +0000, Atish Patra wrote: > On Tue, 2019-08-20 at 02:22 -0700, hch@infradead.org wrote: > > On Tue, Aug 20, 2019 at 08:42:19AM +0000, Atish Patra wrote: > > > cmask NULL is pretty common case and we would be unnecessarily > > > executing bunch of instructions everytime while not saving much. > > > Kernel > > > still have to make an SBI call and OpenSBI is doing a local flush > > > anyways. > > > > > > Looking at the code again, I think we can just use cpumask_weight > > > and > > > do local tlb flush only if local cpu is the only cpu present. > > > > > > Otherwise, it will just fall through and call > > > sbi_remote_sfence_vma(). > > > > Maybe it is just time to split the different cases at a higher level. > > The idea to multiple everything onto a single function always seemed > > odd to me. > > > > FYI, here is what I do for the IPI based tlbflush for the native S- > > mode > > clint prototype, which seems much easier to understand: > > > > http://git.infradead.org/users/hch/riscv.git/commitdiff/ea4067ae61e20fcfcf46a6f6bd1cc25710ce3afe > > This does seem a lot cleaner to me. We can reuse some of the code for > this patch as well. Based on NATIVE_CLINT configuration, it will send > an IPI or SBI call. IMHO, this approach should be avoided because CLINT is compatible to but not mandatory in the privileged spec. In other words, it is possible that a Linux-capable RISC-V platform does not contain a CLINT component but rely on some other mechanism to deal with SW/timer interrupts. > > I can rebase my patch on top of yours and I can send it together or you > can include in your series. > > Let me know your preference. > > -- > Regards, > Atish Best, Alan