From patchwork Mon Nov 15 08:01:17 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Xu X-Patchwork-Id: 12618867 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 16BEEC433F5 for ; Mon, 15 Nov 2021 08:01:37 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id BB88663218 for ; Mon, 15 Nov 2021 08:01:36 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org BB88663218 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 5C4D16B0080; Mon, 15 Nov 2021 03:01:36 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 574ED6B008C; Mon, 15 Nov 2021 03:01:36 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 43CD26B0092; Mon, 15 Nov 2021 03:01:36 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0132.hostedemail.com [216.40.44.132]) by kanga.kvack.org (Postfix) with ESMTP id 377066B0080 for ; Mon, 15 Nov 2021 03:01:36 -0500 (EST) Received: from smtpin22.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id ED8EA180E936C for ; Mon, 15 Nov 2021 08:01:35 +0000 (UTC) X-FDA: 78810420150.22.ED534B5 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf24.hostedemail.com (Postfix) with ESMTP id 57F39B0000B2 for ; Mon, 15 Nov 2021 08:01:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1636963294; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Jyv1lzZ4mkTvzdL9kLWgnj86vlKE/ygyLYqVdoUf6Sw=; b=FgTdnSIUWXS7rBbFCD6/d+2d1s7UE05APElQO8ThoHBEBoeY7CfgkFdX7r/gONQ2Hxf2fN oTocpUF9s3z6Xx+mZpG58theCGgj9ufnMkVvDIHXYnRUhDYe1tOKEOwD9cPTjgrd2wuq2E WnahCi08eH26DddWAhQX2gkvZlUh7aU= Received: from mail-pg1-f200.google.com (mail-pg1-f200.google.com [209.85.215.200]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-81-oszmBop8NmG5tPiRXIR6Sg-1; Mon, 15 Nov 2021 03:01:34 -0500 X-MC-Unique: oszmBop8NmG5tPiRXIR6Sg-1 Received: by mail-pg1-f200.google.com with SMTP id k8-20020a6555c8000000b002e32ed2a021so5008869pgs.1 for ; Mon, 15 Nov 2021 00:01:33 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Jyv1lzZ4mkTvzdL9kLWgnj86vlKE/ygyLYqVdoUf6Sw=; b=p+RC6H3kAYnm8R2nauVB0+yqN+Pq6ubPj334VM8jybf4uHodgn/f5xckxhhFEOEKLb WtL+7ahkAXTq23NaGKdxwji/c4Zp1vvXKvnB3dG5NK6uEdep9AK6PzwfgHqaKd6gL7KF Xm7QiGA1pzUCz3xoZ4le+qTfT4Bdu7DGqxgo38cGgX48KbrZLm2CotYYIxPYBGd4MNCq uIHhLT/97+iRQGoZZ95WbbIWJIzyAU1ew64QPBExoa1lB9bCBJynePV1ZftFT47TS5Ll BBP3BSjegMUR2mhIWqoFAa1De7yWF+yoGn69a5zcVDL+2+lKo4ufqgpiXSS4Ssf4u5jH v3fA== X-Gm-Message-State: AOAM531/8Js9gWDGF+T/IkOLvZA/pjz49dBrdmsJ3nc6wEJlqIgjFiSl uwyNQYM56CdR4CtBOvayOAzeB9g8DqJe7v+gSkQCmuydF9VGL86WYCHZQf9Z3vvID/7W2EH4UGd +aFLKkFVmX2S/h8JyThLiMxvbe/6+nQT/4LRcMoHSHw9RXaKldRZAreiDL13S X-Received: by 2002:a17:902:e294:b0:143:86a8:c56d with SMTP id o20-20020a170902e29400b0014386a8c56dmr33185967plc.22.1636963292228; Mon, 15 Nov 2021 00:01:32 -0800 (PST) X-Google-Smtp-Source: ABdhPJwMIv+3cF09VX35C/GmVeDIlebJd1GQRnqQzuF2YhF3HKAjwkxGT6acz2QFRWDpRQuvSoQbMw== X-Received: by 2002:a17:902:e294:b0:143:86a8:c56d with SMTP id o20-20020a170902e29400b0014386a8c56dmr33185912plc.22.1636963291897; Mon, 15 Nov 2021 00:01:31 -0800 (PST) Received: from localhost.localdomain ([94.177.118.89]) by smtp.gmail.com with ESMTPSA id p20sm14708877pfw.96.2021.11.15.00.01.23 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 15 Nov 2021 00:01:31 -0800 (PST) From: Peter Xu To: linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: Nadav Amit , peterx@redhat.com, Alistair Popple , Andrew Morton , Mike Kravetz , Mike Rapoport , Matthew Wilcox , Jerome Glisse , Axel Rasmussen , "Kirill A . Shutemov" , David Hildenbrand , Andrea Arcangeli , Hugh Dickins Subject: [PATCH v6 11/23] mm/hugetlb: Introduce huge pte version of uffd-wp helpers Date: Mon, 15 Nov 2021 16:01:17 +0800 Message-Id: <20211115080117.74699-1-peterx@redhat.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20211115075522.73795-1-peterx@redhat.com> References: <20211115075522.73795-1-peterx@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Authentication-Results: imf24.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=FgTdnSIU; spf=none (imf24.hostedemail.com: domain of peterx@redhat.com has no SPF policy when checking 170.10.129.124) smtp.mailfrom=peterx@redhat.com; dmarc=pass (policy=none) header.from=redhat.com X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 57F39B0000B2 X-Stat-Signature: upjdo8d4adepdzx5ed8ey33t4rahai9i X-HE-Tag: 1636963295-583483 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: They will be used in the follow up patches to either check/set/clear uffd-wp bit of a huge pte. So far it reuses all the small pte helpers. Archs can overwrite these versions when necessary (with __HAVE_ARCH_HUGE_PTE_UFFD_WP* macros) in the future. Signed-off-by: Peter Xu --- arch/s390/include/asm/hugetlb.h | 15 +++++++++++++++ include/asm-generic/hugetlb.h | 15 +++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/arch/s390/include/asm/hugetlb.h b/arch/s390/include/asm/hugetlb.h index 60f9241e5e4a..19c4b4431d27 100644 --- a/arch/s390/include/asm/hugetlb.h +++ b/arch/s390/include/asm/hugetlb.h @@ -115,6 +115,21 @@ static inline pte_t huge_pte_modify(pte_t pte, pgprot_t newprot) return pte_modify(pte, newprot); } +static inline pte_t huge_pte_mkuffd_wp(pte_t pte) +{ + return pte; +} + +static inline pte_t huge_pte_clear_uffd_wp(pte_t pte) +{ + return pte; +} + +static inline int huge_pte_uffd_wp(pte_t pte) +{ + return 0; +} + static inline bool gigantic_page_runtime_supported(void) { return true; diff --git a/include/asm-generic/hugetlb.h b/include/asm-generic/hugetlb.h index f39cad20ffc6..896f341f614d 100644 --- a/include/asm-generic/hugetlb.h +++ b/include/asm-generic/hugetlb.h @@ -35,6 +35,21 @@ static inline pte_t huge_pte_modify(pte_t pte, pgprot_t newprot) return pte_modify(pte, newprot); } +static inline pte_t huge_pte_mkuffd_wp(pte_t pte) +{ + return pte_mkuffd_wp(pte); +} + +static inline pte_t huge_pte_clear_uffd_wp(pte_t pte) +{ + return pte_clear_uffd_wp(pte); +} + +static inline int huge_pte_uffd_wp(pte_t pte) +{ + return pte_uffd_wp(pte); +} + #ifndef __HAVE_ARCH_HUGE_PTE_CLEAR static inline void huge_pte_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep, unsigned long sz)