Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp221668ybb; Thu, 19 Mar 2020 20:25:33 -0700 (PDT) X-Google-Smtp-Source: ADFU+vtOPFo6bW73dEHnjzAByhHHLfvE/vClzkHAEZAyObORuWAXbvh/xNbYHgSmoHghgNNdIP1+ X-Received: by 2002:a05:6830:1f54:: with SMTP id u20mr5168028oth.322.1584674733206; Thu, 19 Mar 2020 20:25:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584674733; cv=none; d=google.com; s=arc-20160816; b=DUO8WgN/wyGjtFB2Wbxh7c/6a5w579zMBQNLcVphBHCH/t5N63Y+tGAXk020mK1VhT yGecv3qb60aqxK0Dvb0+XGyQ1itNX97JB9KtySq/HnchkutFmL8H2lzQPcOTQhiqBnLG qHpPCU1Tkkx+bn6tO63B6+FR7oFhL7xs8GO6FT6WaF/BUi2a2y9Txvefc46HzszVTstq WX/UGKLZas+KaHbc72qr1ws7je3N7Rdqrq2oCZl84QFFqyNMmbFDT4eyUpYpXjsD9onp IunII41w1/zKfjMiBE+itZDh5zORZFFMy2T7OTZZvgq1fUprNbB/8CFCRUGUW4+tNfWM Tn7A== 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=BKY6X8XNQYR/mjyOOpQwuko49hwNGHYNnCx6jezmlVg=; b=CgVh8Dvxbs+Td18mo2JmlP1ZRADxuLBbLQPoNmwuoheeTWNKfllnz4n/MvUXO/SGcT 8Efa/dCYGdelrToyhy3Xcg2B5seyt+5APvZ4MGAxTIN9JGZ9hhs66I6XT5E/OJsfvzn8 GXogl8H6fwSnNdl3Wz7HifDYUNkkDGkIC24Pr8TYj18ONqffAyykFf0devkqg2y9rQuH k5sW/beePQbqmUolA5M/IOHQ73EUfxo/dNk+QCnKjFKSdWAFvUeOpABxrhZaWdHyKe8H 4IJytxCVHqpxKZDWt71PDhu6arzSTSioG1pX+V6xE/qFQaBFINJeWna2BYBvpLEI/HKM ta/g== 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 z65si2238277otb.197.2020.03.19.20.25.20; Thu, 19 Mar 2020 20:25:33 -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 S1726869AbgCTDX0 (ORCPT + 99 others); Thu, 19 Mar 2020 23:23:26 -0400 Received: from foss.arm.com ([217.140.110.172]:43734 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726596AbgCTDXZ (ORCPT ); Thu, 19 Mar 2020 23:23:25 -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 1AB811FB; Thu, 19 Mar 2020 20:23:25 -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 E8E883F85E; Thu, 19 Mar 2020 20:23:21 -0700 (PDT) Subject: Re: [PATCH] x86/mm: Make pud_present() check _PAGE_PROTNONE and _PAGE_PSE as well To: linux-mm@kvack.org Cc: Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , Dave Hansen , Andrew Morton , x86@kernel.org, linux-kernel@vger.kernel.org, "Kirill A. Shutemov" , Dan Williams References: <1584507679-11976-1-git-send-email-anshuman.khandual@arm.com> From: Anshuman Khandual Message-ID: Date: Fri, 20 Mar 2020 08:53:16 +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: <1584507679-11976-1-git-send-email-anshuman.khandual@arm.com> 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/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