Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp1025924iob; Fri, 13 May 2022 20:07:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzrMfG+jS+sEW3V237P7QIjWzJeB1VYTBLCEbipnILfgDVEspsGkYGWJUL0UePe0tnkK2LI X-Received: by 2002:a5d:4dcc:0:b0:20a:ddaa:1c30 with SMTP id f12-20020a5d4dcc000000b0020addaa1c30mr5836054wru.419.1652497676817; Fri, 13 May 2022 20:07:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652497676; cv=none; d=google.com; s=arc-20160816; b=D9vW/fi9HS5HUWFcI6KdDUSplAmg999qDdeWkPOf3k6znex7SFR8sy8O7Ir3QQdac/ UJLxSxX+bFpbFCsscfmluvsfVgY3f9gaYhvYWmTBRnwbFXdBzCTF6VAIAY19lULb5O5u 9/nTCtOe247dkF7OfIjjSux6Pf/GZ1O7x2KQEruQ3n/9e7nWm874Q9AxwihERWnCY7wN EijFQRQBau7yHu7KoXkBgL2o3OXxq8wmaBq5C3tCczUlkqhFFb3dTEa/jok2MiUo6qfv S8G9RQ7mtD5X0b6V5uSosi9rVIA0oPfzOV1TcW5iZzjklltgX0dlnfy2xqm32i0Bzivo lq8g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=gpFifAJhn2fkzu2KfCg6kS1UbaC1L5yV1K7SjmH2CrA=; b=HPamTUcROCNsoG1oq2TAyLFfmUqL1d9ur9c3mQIdOakKKxVfML550SOfGA352mx6Ur de+5tJhWPLtX1UXEvUNWKCTyW7w1SJK1t7s6+rjIWNW47a5xANcqmyJdEwWqQmzHqtmG awLFmlG7uQWQDIUQYOV40eRYPCvvJSHrBmsVWpSzUq43T4bkXYgCpo5gyd77HYC5afgN dbW1iMzxN9jSiAvCeR0JrpHvflfxq52Jlnem+Hy6s6KbFTuH7MNliWG7KDZHduPFNPM8 CxiYJ67LE9Y5UB7XUq0UxnTmFaSvsEgba5nl3YzfQdz2yrlJEk95jJThMR+eMpTvL9ej BA9Q== ARC-Authentication-Results: i=1; mx.google.com; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id c5-20020adfef45000000b0020cda04ae4dsi3483343wrp.977.2022.05.13.20.07.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 May 2022 20:07:56 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 8DA203BC5A8; Fri, 13 May 2022 16:49:02 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1352693AbiELKiL (ORCPT + 99 others); Thu, 12 May 2022 06:38:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46390 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240318AbiELKh6 (ORCPT ); Thu, 12 May 2022 06:37:58 -0400 Received: from outbound-smtp02.blacknight.com (outbound-smtp02.blacknight.com [81.17.249.8]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1ADB75BE45 for ; Thu, 12 May 2022 03:37:52 -0700 (PDT) Received: from mail.blacknight.com (pemlinmail01.blacknight.ie [81.17.254.10]) by outbound-smtp02.blacknight.com (Postfix) with ESMTPS id 85F1FBB1DC for ; Thu, 12 May 2022 11:37:51 +0100 (IST) Received: (qmail 9959 invoked from network); 12 May 2022 10:37:51 -0000 Received: from unknown (HELO techsingularity.net) (mgorman@techsingularity.net@[84.203.198.246]) by 81.17.254.9 with ESMTPSA (AES256-SHA encrypted, authenticated); 12 May 2022 10:37:51 -0000 Date: Thu, 12 May 2022 11:37:48 +0100 From: Mel Gorman To: Hyeonggon Yoo <42.hyeyoo@gmail.com> Cc: Dave Hansen , Tom Lendacky , Rick Edgecombe , Dave Hansen , Andy Lutomirski , Peter Zijlstra , Thomas Gleixner , Ingo Molnar , Borislav Petkov , x86@kernel.org, "H. Peter Anvin" , "Kirill A. Shutemov" , Tianyu Lan , "Aneesh Kumar K.V" , linux-kernel@vger.kernel.org, linux-mm@kvack.org, vbabka@suse.cz, akpm@linux-foundation.org, willy@infradead.org Subject: Re: Is _PAGE_PROTNONE set only for user mappings? Message-ID: <20220512103748.GH3441@techsingularity.net> References: <20220506051940.156952-1-42.hyeyoo@gmail.com> <56f89895-601e-44c9-bda4-5fae6782e27e@amd.com> <5fe161cb-6c55-6c4d-c208-16c77e115d3f@amd.com> <8c2735ac-0335-6e2a-8341-8266d5d13c30@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 Wed, May 11, 2022 at 02:20:45PM +0900, Hyeonggon Yoo wrote: > > pgprot_t vm_get_page_prot(unsigned long vm_flags) > > { > > pgprot_t ret = __pgprot(pgprot_val(protection_map[vm_flags & > > (VM_READ|VM_WRITE|VM_EXEC|VM_SHARED)]) | > > pgprot_val(arch_vm_get_page_prot(vm_flags))); > > > > return arch_filter_pgprot(ret); > > } > > EXPORT_SYMBOL(vm_get_page_prot); > > I guess it's only set for processes' VMA if no caller is abusing > vm_get_page_prot() for kernel mappings. > > But yeah, just quick guessing does not make us convinced. > Let's Cc people working on mm. > > If kernel never uses _PAGE_PROTNONE for kernel mappings, it's just okay > not to clear _PAGE_GLOBAL at first in __change_page_attr() if it's not user address, > because no user will confuse _PAGE_GLOBAL as _PAGE_PROTNONE if it's kernel > address. right? > I'm not aware of a case where _PAGE_BIT_PROTNONE is used for a kernel address expecting PROT_NONE semantics instead of the global bit. NUMA Balancing is not going to accidentally treat a kernel address as if it's a NUMA hinting fault. By the time a fault is determining if a PTE access is a numa hinting fault or accesssing a PROT_NONE region, it has been established that it is a userspace address backed by a valid VMA. -- Mel Gorman SUSE Labs