Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp5649748rwb; Wed, 21 Sep 2022 10:26:02 -0700 (PDT) X-Google-Smtp-Source: AMsMyM62QzwcRfZ5D1cq1uD9ngbLWLIhTAUc68uVMHxZKFDt/8aGHbwp97BdYsDEkanInXvpcBns X-Received: by 2002:a17:907:7e84:b0:781:c792:3f80 with SMTP id qb4-20020a1709077e8400b00781c7923f80mr7025444ejc.439.1663781162334; Wed, 21 Sep 2022 10:26:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663781162; cv=none; d=google.com; s=arc-20160816; b=0tjqkFVsMpRZ6pYio9EerP2Vs+lDC2QpwX28t/I33iF1pp1TJolp3/CR6KQynZH61a pkQuhum5cgzGDa2Jpc/KVeI6rtJ5IKByd0YO8V4ZkS6RLHERu5AiNosW3V3mr9qtQO7Q kcjapvzbgjlZ+TZq+p4DDdlDo9wjIS8oJ5qXSbp9eBB/Ne/K7p9jXILS6/IymmGE9yym Eylz3WUA3PVzc1a05uyrBhHyXyjGocurEKjLoRoZLGbo4jmc2IX5AinXqTnIMRaxM9MU pZI1EMs1lvhb3SIdoL6AaUtwSEIUVlxwiLoBuBp755pCWovj0DZj4F//vxGmpGLFzU8E ktWQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=J21iBuTA+2/91xI2WPlfOAbxyXnnD/10Lq7+gBAEcZM=; b=cNiAIHJzMmU3ZC3O+sWOP2CT3zKB5kXOzOgQx4Qafh9QDNTcZ78MuN1zyilDS2HQ3G INx2A3wb4IsWvXqNaM70WRbbxP7KiEvep0TMdPcSr1T3q3dXJaUV6e0GLAONqn5NOmIi I/qVat3nt/NK5Xdc//Noo7Z8qlpUGyL6TCk7ZevZrTZ7FBVAnK9ta9eQ+m3Oi831wrbg K0jxrNORDnb6igoZANtzCgikHLgZInbfIYH77By7FJJC1oYEFFG5+wYv05B2a+8kSTIb cZmR1evJkl5OjalCDrXxAkqgrAU5gWafytjRWXMGf9p6BThy86I4/4ewPcUPR6yD5FQR 0bhA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=IEUw5nnv; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m7-20020a509987000000b004512f3e3e03si2793372edb.146.2022.09.21.10.25.35; Wed, 21 Sep 2022 10:26:02 -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=@intel.com header.s=Intel header.b=IEUw5nnv; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230110AbiIUQ63 (ORCPT + 99 others); Wed, 21 Sep 2022 12:58:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45198 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230483AbiIUQ6O (ORCPT ); Wed, 21 Sep 2022 12:58:14 -0400 Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 730B8E65 for ; Wed, 21 Sep 2022 09:57:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1663779471; x=1695315471; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=KfeL1caenfC1WwBXXSUs1g5r/dvpabVdylm3CpznaYo=; b=IEUw5nnv0Lovu41xLWicKZGeodXV4zmmokViQk0XPE+IZv9Br0lhzYHk smwVct5GKExiE9MSdwFYz+ZZF5sIpkkl8j3R4YL6lhf+QShgdtX3g3J7X NpZnmJNJI8nlvjeBHN95YPU1xYXKSJehI6LVTqBQojY6HmGNPat4JSwfc dzTCipwpCJ96FB31twrJJYENUhvNSxD81IJbIp6uBOVfvfoj4C9/fFEsi fgRuYxepsVtMZf/9yiynpPkqC3Ixd2ur1oyEBUPllbfe+pYVQ/+/ff4iO 4wgqI6fyFYtAjEadWcgwzmZJGmuZ0Tk6HzZ6I1d7XZStJfYvzAMU2V47s g==; X-IronPort-AV: E=McAfee;i="6500,9779,10477"; a="386349243" X-IronPort-AV: E=Sophos;i="5.93,333,1654585200"; d="scan'208";a="386349243" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Sep 2022 09:57:50 -0700 X-IronPort-AV: E=Sophos;i="5.93,333,1654585200"; d="scan'208";a="723291831" Received: from nchaplot-mobl1.amr.corp.intel.com (HELO [10.209.89.231]) ([10.209.89.231]) by fmsmga002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Sep 2022 09:57:48 -0700 Message-ID: <562dec4d-a39f-b517-58a3-45f691a2d10a@intel.com> Date: Wed, 21 Sep 2022 09:57:47 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.11.0 Subject: Re: [PATCHv8 00/11] Linear Address Masking enabling Content-Language: en-US To: "Kirill A. Shutemov" , Jacob Pan Cc: Ashok Raj , "Kirill A. Shutemov" , Ashok Raj , Dave Hansen , Andy Lutomirski , Peter Zijlstra , x86@kernel.org, Kostya Serebryany , Andrey Ryabinin , Andrey Konovalov , Alexander Potapenko , Taras Madan , Dmitry Vyukov , "H . J . Lu" , Andi Kleen , Rick Edgecombe , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Jason Gunthorpe , Joerg Roedel References: <20220904003952.fheisiloilxh3mpo@box.shutemov.name> <20220912224930.ukakmmwumchyacqc@box.shutemov.name> <20220914144518.46rhhyh7zmxieozs@box.shutemov.name> <20220914151818.uupzpyd333qnnmlt@box.shutemov.name> <20220914154532.mmxfsr7eadgnxt3s@box.shutemov.name> <20220914165116.24f82d74@jacob-builder> <20220915090135.fpeokbokkdljv7rw@box.shutemov.name> <20220915172858.pl62a5w3m5binxrk@box.shutemov.name> From: Dave Hansen In-Reply-To: <20220915172858.pl62a5w3m5binxrk@box.shutemov.name> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-8.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A, RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_NONE 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 9/15/22 10:28, Kirill A. Shutemov wrote:> + /* Serialize against address tagging enabling * > + if (mmap_write_lock_killable(mm)) > + return -EINTR; > + > + if (!arch_can_alloc_pasid(mm)) { > + mmap_write_unlock(mm); > + return -EBUSY; > + } Shouldn't this actually be some kind of *device* check? The question here is whether the gunk in the mm's address space is compatible with the device. * Can the device walk the page tables in use under the mm? * Does the device interpret addresses the same way as the CPUs using the mm? The page table format is, right now, wholly determined at boot at the latest. But, it probably wouldn't hurt to pretend like it _might_ change at runtime. The address interpretation part is, of course, what LAM changes. It's also arguable that it includes features like protection keys. I can totally see a case where folks might want to be careful and disallow device access to an mm where pkeys are in use.