Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp505534iog; Fri, 17 Jun 2022 07:45:11 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sWsv/DPdduY9eEU5KfqFg6aPtNOFfuEqh0jIxuzsH+DsdK0ARuAjsuZJLcc1SIaY7tXVgv X-Received: by 2002:a05:6402:51ce:b0:42f:41c6:4d70 with SMTP id r14-20020a05640251ce00b0042f41c64d70mr13076129edd.335.1655477111269; Fri, 17 Jun 2022 07:45:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655477111; cv=none; d=google.com; s=arc-20160816; b=t7XDZxl5P4nLqdVZYo3HiT/GmlQXz2FaGMrx9/W1PRmeMMqflaDMGSWWaerO6A8LGO nCHA/ItqC46QAk1TOH1bYWW2j+WFEKMDgyqpGEjOVe/TWaCIPILkKgPpkKPUM3UVbwDe w4Jn1/p9qOqO9l6AF6Hq/387/rD5qE85Sp1I6fZ2qHZhhbbcvAEH/uE14DC9e71NJTn6 t1FWxwnAVVeIICT4F8jHs3iXf8o82A0Hg1Zs0RLsJg0xEmfnexMqop7E6Z7cg495TgPj JcWxubh2qbrZMlKt0xMSHElLh4fK25owAHV4lOt8d6esG9q33s3p7YiiVBB5p/+SW7dM eEUA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=n6Zz+aFxdEiHH1MPjSMAigtTz+Sr6l2rlt9fbJVef1U=; b=Kc4sU2r18QMya0/NMRv4Xwa7KdtS8/jQ18ACWTXH9dCIiunn5nFQPDM1aeO0N7mEFg C0vwaxqwGMMGBgjtVgNGKu8BRhObJDX/hNdJKoGO1j1ju8PU31Xk1z5vDD9j8u5NLCJ9 mZSwT1ULdwaHgyVzlo2C3u7uD82yOhEHIlunAiO77036S6z7y4qsvdyhASNfu7wmW3IM awW8fbMVXIr69Fy0BoTuZY82md0zMDNxi6aQUHVeqHuZb8PW2dz+bcwe3gSgOVZWFu4U 1qzx+ryLcyX7//t5DWoX4mLPgMv5kY0qtJfL90yy2U88SMBUhijOYFs1y+G9QjhA9P85 /wnw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b="mo/rwvHK"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hv21-20020a17090760d500b007118f3dd0afsi5597845ejc.710.2022.06.17.07.44.44; Fri, 17 Jun 2022 07:45:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b="mo/rwvHK"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1382576AbiFQOcL (ORCPT + 99 others); Fri, 17 Jun 2022 10:32:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37650 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231490AbiFQOcK (ORCPT ); Fri, 17 Jun 2022 10:32:10 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 715CB55351 for ; Fri, 17 Jun 2022 07:32:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.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; bh=n6Zz+aFxdEiHH1MPjSMAigtTz+Sr6l2rlt9fbJVef1U=; b=mo/rwvHK81c63F4hSpgHn0GBGR I0U0TcJKhamYbUi6saojJFb5N9Cng1/PBXNpxcL9rIlx9s1kiGUfh2J4PF1SVBas5dwpKMBSaMYqn kcwx5CZ+fUyM3Xf2WHWP/jFiVlvp0SbtAiS055gTLACXSPcl3DnAsV+zVrjeqYGci1Pawr6b+OamB ARdjcJ4i53XtOYQeTYaTPCvTwwmIOZ+8g11aszXC/Y1YfXqz5WELYFsW22qmFTCMBJp4j5l2v4Jsk lysg3z8KgYe+HTdvBxhvyrM524QQo+US1aW94I0tUNkZvKx85zj+8ZMzA857UhtE67GulW4PIRwQU UeObxO4w==; Received: from dhcp-077-249-017-003.chello.nl ([77.249.17.3] helo=worktop.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1o2Cxo-002tc3-Og; Fri, 17 Jun 2022 14:28:44 +0000 Received: by worktop.programming.kicks-ass.net (Postfix, from userid 1000) id 1CC059816B5; Fri, 17 Jun 2022 16:28:43 +0200 (CEST) Date: Fri, 17 Jun 2022 16:28:42 +0200 From: Peter Zijlstra To: "H.J. Lu" Cc: "Kirill A. Shutemov" , "Edgecombe, Rick P" , "Lutomirski, Andy" , "dave.hansen@linux.intel.com" , "linux-kernel@vger.kernel.org" , "linux-mm@kvack.org" , "kcc@google.com" , "andreyknvl@gmail.com" , "ak@linux.intel.com" , "dvyukov@google.com" , "x86@kernel.org" , "ryabinin.a.a@gmail.com" , "glider@google.com" Subject: Re: [PATCHv3 5/8] x86/uaccess: Provide untagged_addr() and remove tags before address check Message-ID: References: <20220610143527.22974-1-kirill.shutemov@linux.intel.com> <20220610143527.22974-6-kirill.shutemov@linux.intel.com> <20220616164440.vw7sqnof6grrmnvl@black.fi.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jun 17, 2022 at 07:22:57AM -0700, H.J. Lu wrote: > On Fri, Jun 17, 2022 at 4:36 AM Peter Zijlstra wrote: > > > > On Thu, Jun 16, 2022 at 07:44:40PM +0300, Kirill A. Shutemov wrote: > > > Any objection against this variant (was posted in the thread): > > > > > > #define untagged_addr(mm, addr) ({ \ > > > u64 __addr = (__force u64)(addr); \ > > > s64 sign = (s64)__addr >> 63; \ > > > __addr &= (mm)->context.untag_mask | sign; \ > > > (__force __typeof__(addr))__addr; \ > > > }) > > > > > > ? > > > > Yeah, I suppose that should work fine. > > Won't the sign bit be put at the wrong place? sign is either 0 or ~0, by or-ing ~0 into the mask, the masking becomes no-op.