Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp3798368ybl; Tue, 20 Aug 2019 02:23:48 -0700 (PDT) X-Google-Smtp-Source: APXvYqxVWLxQKtzWnco8zYVtet7DHAErGykBYN4B0Svpm+ONO8a/L4VHKh9LECNKiob81hEfdar8 X-Received: by 2002:a63:b60b:: with SMTP id j11mr12287670pgf.283.1566293028011; Tue, 20 Aug 2019 02:23:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566293028; cv=none; d=google.com; s=arc-20160816; b=EQagTBf9t7xu8DwIc1isl8/WWDeOzf8C/s03bqjo/N0u7T9DE4BS4Mhylv7EwWr8XU 5tbXihahYk0xMLkrJQFO5T5McUsExSmy7XenAsQEV4YbdnvBOY9Zegfprpwo4bq1fHV1 hCh8mgndr7WW24//cM0nXa27z+Ru85IOCVO/34siYwFtNKP5QGDYROUosOy3w3vyfNtS vUL23LFMO0I5qzsLumo1Nug6WIdc98R0TFGDkFS0eljVcHA7HnRCjfjSXykn5Hzdi+/m 8cpHTQCnMfDvaYqjII5olJ4CKiFD3I9Zd99BTV3HnsfU1mMu9pFPxqwnR4lhs9mjXe6/ Jf9w== 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:dkim-signature; bh=IyUaKgOebyYhp2BU70o/3uI2At7Di3BbhEDJYf6iFpo=; b=olFWxM4rMl0Q4obIieRoAIpuL9BGR5+vFhan7H1r2Uh33qInRenXnyo0Nm95MJUBpI 6+IqWhGTsr9N4xjeEaM4wq0ns8TA0HouQYcNTJwvq/gV1p8dGzGky2iO21kjPN1IsP/o t+d1B4dG21YHMBBaq5KkfNyFzsWmJa7PZ7spA76oGdQ2vUVQw48ch8Aqe4PKlaJTVY7c fHw39CP1rN7s9Y3Va4DWPhzLoCl2fxwfYeC+4R3zLJjEfXM242Pq/AQEBAfv1Hc8LFqh teI5OmGgJVnDHulKti56mpvlput8ynHKy1dKxL4bysfRBuRUYmERIJvHaWW3v9EVs8/s LmWw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=XlmGMQin; 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 o33si11667617pgb.381.2019.08.20.02.23.32; Tue, 20 Aug 2019 02:23:48 -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; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=XlmGMQin; 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 S1729464AbfHTJWP (ORCPT + 99 others); Tue, 20 Aug 2019 05:22:15 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:53074 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728545AbfHTJWO (ORCPT ); Tue, 20 Aug 2019 05:22:14 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=IyUaKgOebyYhp2BU70o/3uI2At7Di3BbhEDJYf6iFpo=; b=XlmGMQin9XmCPp0HWGckGUBx0 lxLyrnNSSTNsVCewgiv3w1gOtXJYdaP20JoRIEUrrIUDgNl9o7BRZPXibroqyMFc/1bTjfBfdF0+V vLCYpfO/L2xGy+s5WG4UrwEiT185UAULPN8As5HCBRnWNiB/AzSkN1ryiwK8Cf8XNLSJoJowK1EcK xYswk9zfJMQ5j37VnpjVhbXe27cJnn7SQVAenbB9xVNHOLh1oRcEhIKGhULr/TERu60wzqYFbs2Ym VSlz5N/ekjZP8kObTesLhpKVy/MsdiAPaF6LzckHTmjjK6HcM1bWwB8POsl2/CMLNAkG1DZKBokUC sE1UCBe1w==; Received: from hch by bombadil.infradead.org with local (Exim 4.92 #3 (Red Hat Linux)) id 1i00L9-0008NM-Ly; Tue, 20 Aug 2019 09:22:07 +0000 Date: Tue, 20 Aug 2019 02:22:07 -0700 From: "hch@infradead.org" To: Atish Patra Cc: "schwab@linux-m68k.org" , "linux-riscv@lists.infradead.org" , "paul.walmsley@sifive.com" , "aou@eecs.berkeley.edu" , "allison@lohutok.net" , "anup@brainfault.org" , "linux-kernel@vger.kernel.org" , "hch@infradead.org" , "palmer@sifive.com" Subject: Re: [v2 PATCH] RISC-V: Optimize tlb flush path. Message-ID: <20190820092207.GA26271@infradead.org> References: <20190820004735.18518-1-atish.patra@wdc.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.11.4 (2019-03-13) X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html 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: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