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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 39EF1C433EF for ; Fri, 17 Jun 2022 22:38:17 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B379C6B0071; Fri, 17 Jun 2022 18:38:16 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id AF1E26B0073; Fri, 17 Jun 2022 18:38:16 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 960216B0074; Fri, 17 Jun 2022 18:38:16 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 7FA716B0071 for ; Fri, 17 Jun 2022 18:38:16 -0400 (EDT) Received: from smtpin29.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 5435460AC2 for ; Fri, 17 Jun 2022 22:38:16 +0000 (UTC) X-FDA: 79589192592.29.107317F Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by imf19.hostedemail.com (Postfix) with ESMTP id 71FB91A0099 for ; Fri, 17 Jun 2022 22:38:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1655505495; x=1687041495; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=5N+38U0pt8pNFT2Qih+c9vIoK9kKJHt3QaF9gXIGyM0=; b=TpbPqc9P57SL4WRRnP+SJYsAMqDAJr7hel2xZ//2fjYysFF6FxQBMimI GyIcyVvi0+mBAKZ14JoeNm62NNlOXb79hjjGx8t/ogQJXy5/g7PaNN1WY JcyQ73qCEEWvZm32yaZBOwG1fGK6Y/aZUEYmORg+lJQ0xgusUqsoJ3zT0 A5tuMWARHshlswZUGVduUrGlFJZKlf3uug6aoofg48v0M2nv7VGJpAA7m AmbhtfiHnxQ0CwLhyJWT+faOLbcx7jni7AJ3hef7epJhhMAUmU1g7Jmvf RcQfoLM5hOPObJ61ofySv6dQorRcLfQ09MR2eQAxhZJwu/BF7IaE6P5j3 w==; X-IronPort-AV: E=McAfee;i="6400,9594,10380"; a="259422396" X-IronPort-AV: E=Sophos;i="5.92,306,1650956400"; d="scan'208";a="259422396" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Jun 2022 15:38:12 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.92,306,1650956400"; d="scan'208";a="584180487" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga007.jf.intel.com with ESMTP; 17 Jun 2022 15:38:08 -0700 Received: by black.fi.intel.com (Postfix, from userid 1000) id 61676132; Sat, 18 Jun 2022 01:38:13 +0300 (EEST) Date: Sat, 18 Jun 2022 01:38:13 +0300 From: "Kirill A. Shutemov" To: Alexander Potapenko Cc: Dave Hansen , Andy Lutomirski , Peter Zijlstra , the arch/x86 maintainers , Kostya Serebryany , Andrey Ryabinin , Andrey Konovalov , Dmitry Vyukov , "H . J . Lu" , Andi Kleen , Rick Edgecombe , Linux Memory Management List , LKML Subject: Re: [PATCHv3 3/8] mm: Pass down mm_struct to untagged_addr() Message-ID: <20220617223813.z4aozosytagbqv3a@black.fi.intel.com> References: <20220610143527.22974-1-kirill.shutemov@linux.intel.com> <20220610143527.22974-4-kirill.shutemov@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1655505495; a=rsa-sha256; cv=none; b=syLaZOOtcFGhYD5x4cEUuxM2Tijwvll0JQPzbA30J0BgqX2rwVJiCMl+J+/Y0LAXH7eaY0 xS6TNbpPPJYJny+FZKL5LGBAtVTNpgioJ6d+cIMxUwjbnv+W4eQF0H0egKSwJGlx+1CVUv Aue2iT0WAsLXE3yew6RojPhm9TXYUHA= ARC-Authentication-Results: i=1; imf19.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b=TpbPqc9P; spf=none (imf19.hostedemail.com: domain of kirill.shutemov@linux.intel.com has no SPF policy when checking 192.55.52.136) smtp.mailfrom=kirill.shutemov@linux.intel.com; dmarc=pass (policy=none) header.from=intel.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1655505495; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=dGb3sBcmfm7ZW1U6Fo1gmGjlRoHXFdAPGRKo0oPW50I=; b=cDRFKLVDUkxKxob5kxFzioYieg8Ce0M3844wmaK8yDuVvGoBXqVisRZZLC54PMd+4ymPLA U3kLooQ5Rgcgxlj2MdPGdNxAyeYAjCiB6nBHGtpt7VB6s+kSmYsuSABixaB0DnYHVvxv40 d8kFIoLZ5dwjp5bPGEt2RIxV6Dy4Mtg= X-Stat-Signature: 1oun89u1pcydpeuianj4ibwe9ptidzjd X-Rspamd-Queue-Id: 71FB91A0099 Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b=TpbPqc9P; spf=none (imf19.hostedemail.com: domain of kirill.shutemov@linux.intel.com has no SPF policy when checking 192.55.52.136) smtp.mailfrom=kirill.shutemov@linux.intel.com; dmarc=pass (policy=none) header.from=intel.com X-Rspamd-Server: rspam07 X-Rspam-User: X-HE-Tag: 1655505495-417562 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Fri, Jun 17, 2022 at 05:27:46PM +0200, Alexander Potapenko wrote: > On Fri, Jun 10, 2022 at 4:35 PM Kirill A. Shutemov > wrote: > > > > Intel Linear Address Masking (LAM) brings per-mm untagging rules. Pass > > down mm_struct to the untagging helper. It will help to apply untagging > > policy correctly. > > > > In most cases, current->mm is the one to use, but there are some > > exceptions, such as get_user_page_remote(). > > Wouldn't it be easier to keep using current->mm in untagged_addr(addr) > by default, and introduce a separate macro for the exceptions? I don't think it is a good idea. Explicit mm forces writer to consider what mm she wants to use in the particular case. > > +/* > > + * Architectures that support memory tagging (assigning tags to memory regions, > > + * embedding these tags into addresses that point to these memory regions, and > > + * checking that the memory and the pointer tags match on memory accesses) > > + * redefine this macro to strip tags from pointers. > > + * It's defined as noop for architectures that don't support memory tagging. > > + */ > > +#ifndef untagged_addr > > +#define untagged_addr(mm, addr) (addr) > > +#endif > The comment above should probably be extended to explain the effect of `mm`. Sure, will update. -- Kirill A. Shutemov