From patchwork Fri Apr 9 16:51:51 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Zack Rusin X-Patchwork-Id: 12194581 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 86FAAC433ED for ; Fri, 9 Apr 2021 16:51:56 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 1095D610CC for ; Fri, 9 Apr 2021 16:51:56 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1095D610CC Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=vmware.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 798246B006C; Fri, 9 Apr 2021 12:51:55 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 734AF6B0070; Fri, 9 Apr 2021 12:51:55 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5D62D6B0071; Fri, 9 Apr 2021 12:51:55 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0142.hostedemail.com [216.40.44.142]) by kanga.kvack.org (Postfix) with ESMTP id 3E8BD6B006C for ; Fri, 9 Apr 2021 12:51:55 -0400 (EDT) Received: from smtpin07.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id EA772A77E for ; Fri, 9 Apr 2021 16:51:54 +0000 (UTC) X-FDA: 78013420548.07.91890C6 Received: from EX13-EDG-OU-001.vmware.com (ex13-edg-ou-001.vmware.com [208.91.0.189]) by imf25.hostedemail.com (Postfix) with ESMTP id B09636000108 for ; Fri, 9 Apr 2021 16:51:52 +0000 (UTC) Received: from sc9-mailhost3.vmware.com (10.113.161.73) by EX13-EDG-OU-001.vmware.com (10.113.208.155) with Microsoft SMTP Server id 15.0.1156.6; Fri, 9 Apr 2021 09:51:48 -0700 Received: from vertex.localdomain (unknown [10.16.119.23]) by sc9-mailhost3.vmware.com (Postfix) with ESMTP id 4078520DB0; Fri, 9 Apr 2021 09:51:52 -0700 (PDT) From: Zack Rusin To: CC: Andrew Morton , =?utf-8?q?Thomas_Hellstr?= =?utf-8?q?=C3=B6m?= , Subject: [PATCH v2] mm/mapping_dirty_helpers: Guard hugepage pud's usage Date: Fri, 9 Apr 2021 12:51:51 -0400 Message-ID: <20210409165151.694574-1-zackr@vmware.com> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 Received-SPF: None (EX13-EDG-OU-001.vmware.com: zackr@vmware.com does not designate permitted sender hosts) X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: B09636000108 X-Stat-Signature: f5gstombxns4xp6dgqpcd9hsuo7fbnuj Received-SPF: none (vmware.com>: No applicable sender policy available) receiver=imf25; identity=mailfrom; envelope-from=""; helo=EX13-EDG-OU-001.vmware.com; client-ip=208.91.0.189 X-HE-DKIM-Result: none/none X-HE-Tag: 1617987112-759906 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: Mapping dirty helpers have, so far, been only used on X86, but a port of vmwgfx to ARM64 exposed a problem which results in a compilation error on ARM64 systems: mm/mapping_dirty_helpers.c: In function ‘wp_clean_pud_entry’: mm/mapping_dirty_helpers.c:172:32: error: implicit declaration of function ‘pud_dirty’; did you mean ‘pmd_dirty’? [-Werror=implicit-function-declaration] This is due to the fact that mapping_dirty_helpers code assumes that pud_dirty is always defined, which is not the case for architectures that don't define CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE_PUD. ARM64 arch is a little inconsistent when it comes to PUD hugepage helpers, e.g. it defines pud_young but not pud_dirty but regardless of that the core kernel code shouldn't assume that any of the PUD hugepage helpers are available unless CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE_PUD is defined. This prevents compilation errors whenever one of the drivers is ported to new architectures. Signed-off-by: Zack Rusin Cc: Andrew Morton Cc: Thomas Hellström (Intel) Cc: linux-mm@kvack.org Cc: linux-kernel@vger.kernel.org --- mm/mapping_dirty_helpers.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mm/mapping_dirty_helpers.c b/mm/mapping_dirty_helpers.c index b59054ef2e10..b890854ec761 100644 --- a/mm/mapping_dirty_helpers.c +++ b/mm/mapping_dirty_helpers.c @@ -165,10 +165,12 @@ static int wp_clean_pud_entry(pud_t *pud, unsigned long addr, unsigned long end, return 0; } +#ifdef CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE_PUD /* Huge pud */ walk->action = ACTION_CONTINUE; if (pud_trans_huge(pudval) || pud_devmap(pudval)) WARN_ON(pud_write(pudval) || pud_dirty(pudval)); +#endif return 0; }