Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp683050ybb; Fri, 20 Mar 2020 06:25:04 -0700 (PDT) X-Google-Smtp-Source: ADFU+vuDInOb40nkXz6xllWUqFpr8mjSKufv7hc8K0bk2c7DmPh7rU98fERqdL9ud/AnwKnT6Su7 X-Received: by 2002:a9d:27c7:: with SMTP id c65mr6793102otb.318.1584710704181; Fri, 20 Mar 2020 06:25:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584710704; cv=none; d=google.com; s=arc-20160816; b=rKQJpqmEPqd3DAPfychMcKdugtLdQsPomnQL2HNzpV4bTUMMHZKOSgyn8cXQquOFsO 4tdNnONC/V+Xka7es2vtdvFFJWaWFfDxtxdLC0Uwcx99i4tMBOtIp516oVmakROIyKRz OgW+e4ZFkyPmzAugswWfHGE90ZVknd+gAbClZlri22M9LILxhoo2RWiZAr8MX9iNk28j +k/7shSlCG49uAu4bih1bA/J7suudW1fAbkC6sv11hN96wQkuBn49bLL7CbOmJLSiY+9 wuZmWap+FdGunfbE7r3r4g2oFyNjPax3WSuch1SfcRbkSchAYWKuSphXGJc5cOuw1qUW bO2A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=Ptm0Shgp0XBGNRrPVG46aQMVV6YaY5VsHWyuZUYm18M=; b=0TOgIynx7jxBkjaPD0s0L2s8MSfiPPEbfuK7VckxoX+jMjudbjwt88h1LjdaIrr2s7 7Y04GneNt6OlUNDbhmccMngPt+iMBMU5wTY0woYEkxBA/5ujKTiA2d9aEdzqFHXOI+Ow EK8ANZuJm4kcx2TlNHRBnCDJNrSIKrN7q+6CWtKn4OZRI00rtm5srem+4vBsX5UFlABy +QQuJhzaNxfeu8W4+b7vmQffbH0F3Un9224yyCxaqP7gnyuMhy6w3qTqtYOGNnBPfi2O FGyWByrN6oYhiFfV44F7Qm899xZBoeLLVcNp4ChcQDykYqR7oiuZt06KyDHp/JU9MMBC H4Nw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i12si3384244otk.39.2020.03.20.06.24.51; Fri, 20 Mar 2020 06:25:04 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727303AbgCTNXG (ORCPT + 99 others); Fri, 20 Mar 2020 09:23:06 -0400 Received: from foss.arm.com ([217.140.110.172]:48920 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727021AbgCTNXF (ORCPT ); Fri, 20 Mar 2020 09:23:05 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 098CC7FA; Fri, 20 Mar 2020 06:23:05 -0700 (PDT) Received: from [10.163.1.20] (unknown [10.163.1.20]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 849693F85E; Fri, 20 Mar 2020 06:23:01 -0700 (PDT) Subject: Re: [PATCH] x86/mm: Make pud_present() check _PAGE_PROTNONE and _PAGE_PSE as well To: "Kirill A. Shutemov" Cc: linux-mm@kvack.org, Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , Dave Hansen , Andrew Morton , x86@kernel.org, linux-kernel@vger.kernel.org, Dan Williams References: <1584507679-11976-1-git-send-email-anshuman.khandual@arm.com> <20200320114741.c62iolt2yzltnscf@box> From: Anshuman Khandual Message-ID: <2e7a04cf-80cb-58c1-7344-2f8422ed7d31@arm.com> Date: Fri, 20 Mar 2020 18:52:57 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <20200320114741.c62iolt2yzltnscf@box> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 03/20/2020 05:17 PM, Kirill A. Shutemov wrote: > On Fri, Mar 20, 2020 at 08:53:16AM +0530, Anshuman Khandual wrote: >> >> >> On 03/18/2020 10:31 AM, Anshuman Khandual wrote: >>> pud_present() should also check _PAGE_PROTNONE and _PAGE_PSE bits like in >>> case pmd_present(). This makes a PUD entry test positive for pud_present() >>> after getting invalidated with pud_mknotpresent(), hence standardizing the >>> semantics with PMD helpers. >>> >>> Cc: Thomas Gleixner >>> Cc: Ingo Molnar >>> Cc: Borislav Petkov >>> Cc: "H. Peter Anvin" >>> Cc: Dave Hansen >>> Cc: Andrew Morton >>> Cc: x86@kernel.org >>> Cc: linux-mm@kvack.org >>> Cc: linux-kernel@vger.kernel.org >>> Signed-off-by: Anshuman Khandual >>> --- >>> Even though pud_mknotpresent() is not used any where currently, there is >>> a discrepancy between PMD and PUD. >>> >>> WARN_ON(!pud_present(pud_mknotpresent(pud_mkhuge(pud)))) -> Fail >>> WARN_ON(!pmd_present(pmd_mknotpresent(pmd_mkhuge(pmd)))) -> Pass >>> >>> Though pud_mknotpresent() currently clears _PAGE_PROTNONE, pud_present() >>> does not check it. This change fixes both inconsistencies. >>> >>> This has been build and boot tested on x86. >> >> Adding Kirill and Dan. >> >> +Cc: Kirill A. Shutemov >> +Cc: Dan Williams > > Or we can just drop the pud_mknotpresent(). There's no users AFAICS and > only x86 provides it. Yes that will be an option but IMHO fixing pud_present() here might be a better choice because, (1) pud_mknotpresent() with fixed pud_present() might be required later (2) PMD & PUD will be exact same (THP is supported on either level) Nonetheless, I am happy to go either way.