Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp1215548ybl; Tue, 13 Aug 2019 09:05:54 -0700 (PDT) X-Google-Smtp-Source: APXvYqyOPPSRtsMRI2O03G5YdKsw+NlxcCuXnR4yHIxTGrZhpiMAHHYJGaMD24wKuBeJTQuk6/Dr X-Received: by 2002:a17:902:a9c3:: with SMTP id b3mr7375415plr.179.1565712354035; Tue, 13 Aug 2019 09:05:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565712354; cv=none; d=google.com; s=arc-20160816; b=O07MQ1PFotUv4NFXeaYHE+li2dWjKPGP5L6slP8bgqEF62GvdIBqqLBiWUrUT/7Em2 ntc6QyTu7ztNZ8kcir7EtL8MGPv4NPiM+x+2VhG0GOF8045bbhyyOh+lk/uJeGWOe/WH f1FN3yeX1PkrMU3qyiWyioDBcwwrRh8dXf64ePwsiBbO6qVweB/fEj/ftrnwypaIt73N yDtMO1VF+eg4utVS/qT7FY1mnwI3PAJvlXquJftUeN5gxDf8CWFfVW3EBYxl0lE1jGpP rnslCXndsBmuss8bdzPO+9ql7GbyeZz+/0nKxYZemg0CIvMg/DwcPfsCHHu5e7uW+z4Z PNqw== 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=KSaal6YlN7wPFno+cbdIpqACxfsSyDYqcjwHpJgXWLQ=; b=tPA6AroDdeg3iUGjP2L+N5IYJHGt7Iod2orKa4aDWMJ8J77bFIURItsu5KoVfvDcPm fS2FIj+ynbjcKbNAAG1Zsw44MWDvXyzAKxXmVGesg916RPteT0MRk2VCcmEIAazA0FR4 ywTYdbl71+OIPJyrqkcLQf+O87XrjoXVUCfI4CbvYS2WY04g08+XGCFY3OKYtiKI0f+e musBPfoTi0qWSk2RiNwUrt8Ut8RwGbuEsWzQzf0PAUN6q6Nk2YWGZWybtD0hCJkFQrzi yEfVin+7jR6n+etDdno/rqkkKAtt5MueI8Ofz/QbNFHo1CnEQ590LubSKKi7dd+pE3GJ 0wfw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=qLqSPm9h; 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 k22si73592487pfk.90.2019.08.13.09.05.38; Tue, 13 Aug 2019 09:05:54 -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=qLqSPm9h; 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 S1729577AbfHMOac (ORCPT + 99 others); Tue, 13 Aug 2019 10:30:32 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:43712 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729304AbfHMOac (ORCPT ); Tue, 13 Aug 2019 10:30:32 -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=KSaal6YlN7wPFno+cbdIpqACxfsSyDYqcjwHpJgXWLQ=; b=qLqSPm9h565BOHuhfNAhNZ3T6 8IbwVyae2EnRhi7GEy8egxUKyDgVc8w1jOX6WqZ46CNH+Vjl8iRVm4hMON6gAnvCVgfezsmNE0ZHG p6LgsnWqlZQf+i533xf6fVWyifJmAYGsODHrN7FSgn3KpDzdu4BhWAd9F/Kvrte/59YiBOHq5FGIC hdfn1tuPP1fTro5E5XzXIw+XdrD2vxJjhmchCHDYn2lmKJm4ORX0FRGeToXq7AvX/qd+zc4kLZamB IAZ+EVO0J7iPW3BfCneMF+jPaUbB/buUStYWhqbdFjsBfb/jSMQsk+WAY9v1Mz8u6rDW9dbn9rETU zFXHShNJA==; Received: from hch by bombadil.infradead.org with local (Exim 4.92 #3 (Red Hat Linux)) id 1hxXoh-0003B5-FW; Tue, 13 Aug 2019 14:30:27 +0000 Date: Tue, 13 Aug 2019 07:30:27 -0700 From: "hch@infradead.org" To: Atish Patra Cc: "hch@infradead.org" , "aou@eecs.berkeley.edu" , "gregkh@linuxfoundation.org" , Anup Patel , "linux-kernel@vger.kernel.org" , "alexios.zavras@intel.com" , "palmer@sifive.com" , "paul.walmsley@sifive.com" , "linux-riscv@lists.infradead.org" , "allison@lohutok.net" Subject: Re: [PATCH] RISC-V: Issue a local tlb flush if possible. Message-ID: <20190813143027.GA31668@infradead.org> References: <20190810014309.20838-1-atish.patra@wdc.com> <20190812145631.GC26897@infradead.org> 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 13, 2019 at 12:15:15AM +0000, Atish Patra wrote: > I thought if it recieves an empty cpumask, then it should at least do a > local flush is the expected behavior. Are you saying that we should > just skip all and return ? How could we ever receive an empty cpu mask? I think it could only be empty without the current cpu. At least that is my reading of the callers and a few other implementations. > > if (!cpumask || cpumask_test_cpu(cpu, cpumask) { > > 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, cpumask); > > This will modify the original cpumask which is not correct. clear part > has to be done on hmask to avoid a copy. Indeed. But looking at the x86 tlbflush implementation it seems like we could use cpumask_any_but() to avoid having to modify the passed in cpumask.