Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp1813741ybl; Sat, 1 Feb 2020 06:55:25 -0800 (PST) X-Google-Smtp-Source: APXvYqw0uJJPMgKvvWXUNmj3v7yz0OMZ2DtY551OIwkNi+oNzAdCn39odWbCQmuO0zvWCVmOTTGB X-Received: by 2002:a05:6830:50:: with SMTP id d16mr4547183otp.166.1580568925087; Sat, 01 Feb 2020 06:55:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580568925; cv=none; d=google.com; s=arc-20160816; b=EWg52TrUqWRQcFqaLQfuT4zdjaf4UHBik7l9Unsy8e3d4SuKQtO8Kl/NPIjL9teD3D nSAi8IIWPv+ggoAYXLpAZLUbySrE+eluCK/9q+yIsKwWor/vanV4hWfRAvAJv7BoN2A8 yPc9f+J/vpEAXxsajlGiMqcIL7fcyKTCX7kAB+7mM1CWRg9PreOGajiJESZk7sUvMSI2 iC6GtXeuUCcDO5SoGgthYWptedN78/LuRMFVgikakmPRq+xl9/th3DLrsB112rgSEM0T mcfJ+8hwWJXDT80ElGbYiyYXCCuL+he5XEZj5LTewZ6YiZAA1X6fEi4mTkdgYdfm0TBS CVoA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=0Dfdv+0PK3mslxxk3CI2MfzCNSIzsPvbEvSTURzTZDQ=; b=fJEpv9hcNFvo9ed1XoZopzpBvg/sWbKhuUNwke2YLLYwUxV85Sa7CsRTj1JxGiBBOq 15B7dyd0X2hiuBeg+t9YKJ82crOX4GpTK+s5+pvz/UaH5KCIkN5F/OceUUgmr+2D+76+ WtePby9zLjzw+R4zabUeow3Egd2iGz3ZYRRvJBLzTtFBS/hv7hR8EpUljiPYhv4hjq2L jNeo+DsKmiT0oh2obBwVmJ9V1LUSnWggMPHrIPGutfxlePon97w/6ujbhQCwPFKzoSE9 MC3kvPex7gM+1IGt7tZR9T+hG0LxeCTYyGnBxty/LKwDDcmgaR1yB0t0/Dbly2bYph6l WGFA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@c-s.fr header.s=mail header.b=VRbvmTl9; 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 f16si5554334oib.269.2020.02.01.06.55.11; Sat, 01 Feb 2020 06:55: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; dkim=pass header.i=@c-s.fr header.s=mail header.b=VRbvmTl9; 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 S1726679AbgBAOxQ (ORCPT + 99 others); Sat, 1 Feb 2020 09:53:16 -0500 Received: from pegase1.c-s.fr ([93.17.236.30]:64852 "EHLO pegase1.c-s.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726523AbgBAOxP (ORCPT ); Sat, 1 Feb 2020 09:53:15 -0500 Received: from localhost (mailhub1-int [192.168.12.234]) by localhost (Postfix) with ESMTP id 488xsh46Ztz9vBmX; Sat, 1 Feb 2020 15:53:12 +0100 (CET) Authentication-Results: localhost; dkim=pass reason="1024-bit key; insecure key" header.d=c-s.fr header.i=@c-s.fr header.b=VRbvmTl9; dkim-adsp=pass; dkim-atps=neutral X-Virus-Scanned: Debian amavisd-new at c-s.fr Received: from pegase1.c-s.fr ([192.168.12.234]) by localhost (pegase1.c-s.fr [192.168.12.234]) (amavisd-new, port 10024) with ESMTP id NHBcRM16WV_Q; Sat, 1 Feb 2020 15:53:12 +0100 (CET) Received: from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192]) by pegase1.c-s.fr (Postfix) with ESMTP id 488xsh2jncz9v0sP; Sat, 1 Feb 2020 15:53:12 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=c-s.fr; s=mail; t=1580568792; bh=0Dfdv+0PK3mslxxk3CI2MfzCNSIzsPvbEvSTURzTZDQ=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=VRbvmTl9Yn3vuNrio4yo5ArAFmNwjYiF+b7LGlgiCipFJYcxQVlaf5/wiXSoULmsU DXDbe31Lkg/qUQXqKQjatFXUjk1zF9pPQqaqrdiehlaFCXy3aytcZ5eM546lOWqKHC 5t2sZkTb1CiyQnxO+O3amOXNIK0c33aLv4gPotg4= Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id B960E8B78A; Sat, 1 Feb 2020 15:53:13 +0100 (CET) X-Virus-Scanned: amavisd-new at c-s.fr Received: from messagerie.si.c-s.fr ([127.0.0.1]) by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id 7ooRZZ9K5nFU; Sat, 1 Feb 2020 15:53:13 +0100 (CET) Received: from [192.168.4.90] (unknown [192.168.4.90]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 3F2BA8B752; Sat, 1 Feb 2020 15:53:13 +0100 (CET) Subject: Re: [PATCH] powerpc/32s: Don't flush all TLBs when flushing one page To: Segher Boessenkool Cc: Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org References: <20200131155150.GD22482@gate.crashing.org> <27cef66b-df5b-0baa-abac-5532e58bd055@c-s.fr> <20200131193833.GF22482@gate.crashing.org> <248a3cf3-1b5e-a6e1-ceec-0e3904d1cf51@c-s.fr> <20200201140629.GM22482@gate.crashing.org> From: Christophe Leroy Message-ID: <96671e01-6206-8952-a498-942b42e98ef0@c-s.fr> Date: Sat, 1 Feb 2020 15:53:12 +0100 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.4.2 MIME-Version: 1.0 In-Reply-To: <20200201140629.GM22482@gate.crashing.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: fr Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Le 01/02/2020 à 15:06, Segher Boessenkool a écrit : > On Sat, Feb 01, 2020 at 08:27:03AM +0100, Christophe Leroy wrote: >> Le 31/01/2020 à 20:38, Segher Boessenkool a écrit : >>> 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)? >> >> No, in end the low bits are set, that's a BIT OR with ~PAGE_MASK, so it >> sets all low bits to 1. > > Oh, wow, yes, I cannot read apparently. > > Maybe there are some ROUND_DOWN and ROUND_UP macros you could use? > Yes but my intention was to modify the existing code as less as possible. What do you think about version v2 of the patch ? Christophe