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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B9868ECAAD8 for ; Wed, 21 Sep 2022 16:59:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231586AbiIUQ6b (ORCPT ); Wed, 21 Sep 2022 12:58:31 -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 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.