From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-14.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 74714C433E6 for ; Tue, 2 Feb 2021 11:42:03 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3D0CE64EAC for ; Tue, 2 Feb 2021 11:42:03 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3D0CE64EAC Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:To:Subject:Message-ID:Date:From:In-Reply-To: References:MIME-Version:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=ITE3/nMJY+CdC1PCQND0UdIhoQf60IV33aT1k/SObmw=; b=JpJPJReNI61gxGG8LaSlPzcXc beSmgPlIl5O4VYE33b1h2FK2Gs4qmjrdwh8iV+pryzFEhB7BJSPI50TEwrJ+zHEviRmcavoIZf7aO 3hYaCApmQUqN0Z+/T5SJiZH20rGODQACwrT4+wSVLaM1Fm3/juGpf7FAE9L14pJEKjnAGc2N1RcxF /yDbXaQuFmVUwOwU8q8A+bY+abF4CVylxmqzT52N6XEYgu4Xp14cTwNX8LXYiOhJ0BB1tgDZdJN2R r+/boftwOpwIw3NX29nzL8qinsvVW/hYzs/o7qphmPFu2EPrg+6ztgktP+mrkGlWh/qs4+9rVNzcN umodr5rSA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1l6u3B-0006J2-IO; Tue, 02 Feb 2021 11:40:53 +0000 Received: from mail.kernel.org ([198.145.29.99]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1l6u38-0006IN-PA for linux-arm-kernel@lists.infradead.org; Tue, 02 Feb 2021 11:40:51 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id 5DCAD64ECF for ; Tue, 2 Feb 2021 11:40:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1612266048; bh=JNDsbE05EPJUTDRLqW494jLY6nMiaVu0sy8pk+w9fHQ=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=fkby8VL4klnUFQMCHCp7gnjL10Qz5LJE0lAIiMjI49SNNx63wFvKB5oiFYlcEm6cA ctanPVxGKPIjEnHkvZ06WnCufi0sDHWyAxXkh2R247n3LPVC66znFvQ1i37v0AC7zk +buWSYmk/GFiOJ5pERF1SrYrsyEuiLfkbjRIC/6GhX4nsOE76VU00hEE9lv2YBZFBi EH3zM8Bq9H43XyroWvZ4OTIe22/75tehJ4GzpW5yfv170rveCMVZEGiPe1PeKMVni7 A09nyvejK175VfcxK4ru46NEhG9KKnZvKrO1kAFam6MS4+XnOt+kjBH2cAsK44Tf5l G9ZUOap7eWPrA== Received: by mail-ot1-f52.google.com with SMTP id f6so19466567ots.9 for ; Tue, 02 Feb 2021 03:40:48 -0800 (PST) X-Gm-Message-State: AOAM532LcwHXfameop9c7gxLjLCUXZOmTCKE+Qov+Y2inj/cuuv+r0fN HLBVho9vAVw2W9h1ZSrk3+ThvGZloyKsyPlfWEQ= X-Google-Smtp-Source: ABdhPJxVX4EG2Fq+5OYDp1ItnEj30wdLaoABGp4zdkMq0jrPwJ2M2r63UPjNUkHVJZAYqwjWpFFjlZDUj43yTrATL9o= X-Received: by 2002:a05:6830:1158:: with SMTP id x24mr14443720otq.108.1612266047639; Tue, 02 Feb 2021 03:40:47 -0800 (PST) MIME-Version: 1.0 References: <20210201190634.22942-1-catalin.marinas@arm.com> <20210201190634.22942-3-catalin.marinas@arm.com> <20210202113609.GA26895@gaia> In-Reply-To: <20210202113609.GA26895@gaia> From: Ard Biesheuvel Date: Tue, 2 Feb 2021 12:40:36 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 2/2] arm64: Use simpler arithmetics for the linear map macros To: Catalin Marinas X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210202_064050_968661_61E75F94 X-CRM114-Status: GOOD ( 22.23 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , Will Deacon , Vincenzo Frascino , Linus Torvalds , Linux ARM Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Tue, 2 Feb 2021 at 12:36, Catalin Marinas wrote: > > On Tue, Feb 02, 2021 at 12:05:10AM +0100, Ard Biesheuvel wrote: > > On Mon, 1 Feb 2021 at 20:06, Catalin Marinas wrote: > > > Because of the tagged addresses, the __is_lm_address() and > > > __lm_to_phys() macros grew to some harder to understand bitwise > > > operations using PAGE_OFFSET. Since these macros only accept untagged > > > addresses, use a simple subtract operation. > > > > > > Signed-off-by: Catalin Marinas > > > Cc: Will Deacon > > > Cc: Ard Biesheuvel > > > Cc: Mark Rutland > > > --- > > > arch/arm64/include/asm/memory.h | 4 ++-- > > > 1 file changed, 2 insertions(+), 2 deletions(-) > > > > > > diff --git a/arch/arm64/include/asm/memory.h b/arch/arm64/include/asm/memory.h > > > index 3c1aaa522cbd..ff4732785c32 100644 > > > --- a/arch/arm64/include/asm/memory.h > > > +++ b/arch/arm64/include/asm/memory.h > > > @@ -251,9 +251,9 @@ static inline const void *__tag_set(const void *addr, u8 tag) > > > * lives in the [PAGE_OFFSET, PAGE_END) interval at the bottom of the > > > * kernel's TTBR1 address range. > > > */ > > > -#define __is_lm_address(addr) (((u64)(addr) ^ PAGE_OFFSET) < (PAGE_END - PAGE_OFFSET)) > > > +#define __is_lm_address(addr) (((u64)(addr) - PAGE_OFFSET) < (PAGE_END - PAGE_OFFSET)) > > > > Why still subtract PAGE_OFFSET on both sides of the comparison here? > > Not sure what you mean (Linus replied on the local variable aspect). > > With signed arithmetics, the above would be equivalent to addr < PAGE_END > but it wouldn't cover the addr < PAGE_OFFSET case. So we rely on the > unsigned wrap-around to detect this. > Never mind, I just got confused. These changes look fine. For the series, Acled-by: Ard Biesheuvel _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel