Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp984665ybl; Fri, 31 Jan 2020 11:40:25 -0800 (PST) X-Google-Smtp-Source: APXvYqwa96AVKQQ+cSlSBwY5VlNLPY1uPfOPuDNXrXWd99hX6WfJedN37IuyVmnrnP+uJ9xP/AHR X-Received: by 2002:a05:6808:a8e:: with SMTP id q14mr7207682oij.173.1580499625165; Fri, 31 Jan 2020 11:40:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580499625; cv=none; d=google.com; s=arc-20160816; b=t9tSfNByu/33jlmV7Vaj91Y+/YVshG0bVDsMUvQyxIJlb9rQlhq0J9u8BqpaAaA/X6 nDeBc9XOjGFIXfQuqXQuleVt439qwbBJHNveWoOvD3PHlD91bE4iJgkHrr9ZhuwExLs0 0j3CqSLCMeS/JamU1nsVnQyZ0imPoOdU1vNuCfcp22QHkZzU4f6zAwAVn7O5DMxpKIF9 5VbqCUV3z3Rh1KsnmFn+UJyGFAw7+MiNTuLT3T3SLna+hPdawSiQ5VY5q3AAVzAFWbPl ieFPJ6NCd2c0rIFRqgo9iEya7Q1kCavWbzw+I8si6sa7ghUoxy9a94W2YhV72LEY2Dt5 88+A== 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-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=d5brIpcr5BRHFH03qjgkx46m9JpcQKRkWWdTpaAAiR0=; b=OLIQtlRFJvPxajXB5ohjhAAvBtMwPXqRksNf5i2baKDTpb6SNxIu5A1fihgtMyrl+w nwQkIeqgcYBprNylBRk0HXSDFsmU+WFd7g4prMBbap4SgMpzjlLNNFRBFCmhhICAVO8m oWdQDYdWUbpuMLKD3345Ddv41sLrpf/Ee01qT9CpXqEbmgSEuW2h4VKNVM6+wqSPQJXB 2rsU1h1ZbJoykTFKxZPdfIR/ixuFDLm62sxNYdzfZ89idsnv4JeHVVwfD0zX4vTVnvdA 8VX9FpuEN48B//O1rKiSO+43Orx5pImqN5Hr3mjHLDPBVB2VmdPFNukvnd1XhLYoJ8C7 g6dA== 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 a7si4921388otp.11.2020.01.31.11.40.11; Fri, 31 Jan 2020 11:40:25 -0800 (PST) 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 S1726643AbgAaTjD (ORCPT + 99 others); Fri, 31 Jan 2020 14:39:03 -0500 Received: from gate.crashing.org ([63.228.1.57]:58945 "EHLO gate.crashing.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726001AbgAaTjD (ORCPT ); Fri, 31 Jan 2020 14:39:03 -0500 Received: from gate.crashing.org (localhost.localdomain [127.0.0.1]) by gate.crashing.org (8.14.1/8.14.1) with ESMTP id 00VJcZbS006329; Fri, 31 Jan 2020 13:38:35 -0600 Received: (from segher@localhost) by gate.crashing.org (8.14.1/8.14.1/Submit) id 00VJcXRI006321; Fri, 31 Jan 2020 13:38:33 -0600 X-Authentication-Warning: gate.crashing.org: segher set sender to segher@kernel.crashing.org using -f Date: Fri, 31 Jan 2020 13:38:33 -0600 From: Segher Boessenkool To: Christophe Leroy Cc: Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] powerpc/32s: Don't flush all TLBs when flushing one page Message-ID: <20200131193833.GF22482@gate.crashing.org> References: <20200131155150.GD22482@gate.crashing.org> <27cef66b-df5b-0baa-abac-5532e58bd055@c-s.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <27cef66b-df5b-0baa-abac-5532e58bd055@c-s.fr> User-Agent: Mutt/1.4.2.3i Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jan 31, 2020 at 05:15:20PM +0100, Christophe Leroy wrote: > Le 31/01/2020 ? 16:51, Segher Boessenkool a ?crit?: > >On Fri, Jan 31, 2020 at 03:37:34PM +0000, Christophe Leroy wrote: > >>When the range is a single page, do a page flush instead. > > > >>+ start &= PAGE_MASK; > >>+ end = (end - 1) | ~PAGE_MASK; > >> if (!Hash) { > >>- _tlbia(); > >>+ if (end - start == PAGE_SIZE) > >>+ _tlbie(start); > >>+ else > >>+ _tlbia(); > >> return; > >> } > > > >For just one page, you get end - start == 0 actually? > > Oops, good catch. > > Indeed you don't get PAGE_SIZE but (PAGE_SIZE - 1) for just one page. You have all low bits masked off in both start and end, so you get zero. You could make the condion read "if (start == end)? Maybe a nicer way to describe what you do is "if start and end are on the same memory page, flush that page." Segher