From patchwork Thu Aug 30 20:06:13 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dave Jiang X-Patchwork-Id: 10582783 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8040D174C for ; Thu, 30 Aug 2018 20:06:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6FD5E2C227 for ; Thu, 30 Aug 2018 20:06:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 63BC52C3B4; Thu, 30 Aug 2018 20:06:17 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DFFCA2C227 for ; Thu, 30 Aug 2018 20:06:16 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 13B906B52FF; Thu, 30 Aug 2018 16:06:16 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 0C3BF6B5301; Thu, 30 Aug 2018 16:06:16 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id EA6436B5302; Thu, 30 Aug 2018 16:06:15 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pf1-f197.google.com (mail-pf1-f197.google.com [209.85.210.197]) by kanga.kvack.org (Postfix) with ESMTP id A54B76B52FF for ; Thu, 30 Aug 2018 16:06:15 -0400 (EDT) Received: by mail-pf1-f197.google.com with SMTP id x85-v6so5336933pfe.13 for ; Thu, 30 Aug 2018 13:06:15 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:subject:from :to:cc:date:message-id:user-agent:mime-version :content-transfer-encoding; bh=HeRtcsP22BQl1laSQ/utjZ8EectCX//smZ/sXZVvwZM=; b=qFVRNVRwEV+y+T2xTGnpBuXaRu0ABGrwlH5qJIexy0Or+q/s3bTGlAP7nzpnFdKsDx mC9ELV07hgRQoEkt8HeSxvELaLgBJ2koayNFtaAUSNEgzN96srVW2XgE9kS/+rMXhd1W YR1Wzk7ajn6ikVLO6V2cTqyB/aNIPkGJrOn9qh2gEgQB1echdAqzfeohC8ksG1edxpI5 /jXRxaC+k06JmjJDZGm/y8tjrxLrpyRf0YgI/gdaRhCCaaFepc73mfVAJ/qDWS93cq7E Xj6guwVjS1NI/Il3LoUGLvOCb1YjlHhMJ8gWgZarKUhBYaPeFWeSI//YOWC10rZM0Kmo Y3QQ== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of dave.jiang@intel.com designates 192.55.52.88 as permitted sender) smtp.mailfrom=dave.jiang@intel.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com X-Gm-Message-State: APzg51D9sPFRYK7O5/Y9MafLW29EdBuJH3hnn8YUX9FTuxvD3ngjl5dE zXERf9pQK4/UmvGDiPh9GSPE5gTUAfJ7V5bU19RYIkuISvsNaIB7ViJCVA1PAL30VOA69CGADwx 1fW81xiKDBYpGlS6O/3Y9Vkh6LctJnBUqxhy+7OucA7VVoVm691w8Eim1RBNL/A6f8A== X-Received: by 2002:a63:2022:: with SMTP id g34-v6mr6841844pgg.235.1535659575376; Thu, 30 Aug 2018 13:06:15 -0700 (PDT) X-Google-Smtp-Source: ANB0VdaYphCg549vhJ9V0v0FHwK8Z41jjdYo7aJiPnUvH0Mx7kGgAzPo9eb+kCKuWMoY115f9D2t X-Received: by 2002:a63:2022:: with SMTP id g34-v6mr6841794pgg.235.1535659574714; Thu, 30 Aug 2018 13:06:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535659574; cv=none; d=google.com; s=arc-20160816; b=mgBvvJHXIUOt5G5+uM/XSWlXCHR8n0IRhXHSAvbK2UTUe2cRv1hfmwO+MSQR5fmjCC jOj/x7wwK49uGWyRnSQOXscnV62lZxW6Nw2gKyPObxIdvcBk0QyhbuNVZHf/5Neuejt5 DxUVniVYw5gTTs5nHcaI112i3mVkiTb1h7+mzieRr3SnRdrFlsgjLP2su/5B1s7t1rGt s3d+3YgvFvyJig5sENHkMKLFn/Hzv0oY1peTfQOU8M8lS2ahnzllVGGNP8s9RL4TnocE WWgLHNSU0qA86jGDDFEP62nbDHM9yw75uL5WAFhoq0HeWmV3+FFNmYdIIBY8NF0CnVcs vGfg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:user-agent:message-id:date :cc:to:from:subject:arc-authentication-results; bh=HeRtcsP22BQl1laSQ/utjZ8EectCX//smZ/sXZVvwZM=; b=DsBI0Jx7omVVikUjEmsPV2d0zm22YFt6eQYKFECXirOtDCh5M6yETbLkYm5JA2xnHv Eov6qabseeBr0JRMqlAtWnF8/ng8zy6Gu5ar1kwk2ab4ZzIXi5O7obslaFplQvKGFFyA xWzHQOLyTlu8xqJaP4AHc8QHXjfFZZ4LKMxbaZqwBIve1WsUmw3TNau3IJLQFtjku2LV zcuIaefmE/adFo9UsKGqJGNl0ZceHTsCYngBhCUsyaxmkrrDjHVV6U10r9cmklFhIoEd KhFo2GSg7C5ayxKZg0aAs7N5R5d9DZQZjCwlhguiKQlRHwG9xToL1kJ6KsTheBw6vLmR LN5g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of dave.jiang@intel.com designates 192.55.52.88 as permitted sender) smtp.mailfrom=dave.jiang@intel.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from mga01.intel.com (mga01.intel.com. [192.55.52.88]) by mx.google.com with ESMTPS id j5-v6si5045598pgg.293.2018.08.30.13.06.14 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 30 Aug 2018 13:06:14 -0700 (PDT) Received-SPF: pass (google.com: domain of dave.jiang@intel.com designates 192.55.52.88 as permitted sender) client-ip=192.55.52.88; Authentication-Results: mx.google.com; spf=pass (google.com: domain of dave.jiang@intel.com designates 192.55.52.88 as permitted sender) smtp.mailfrom=dave.jiang@intel.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 30 Aug 2018 13:06:14 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.53,308,1531810800"; d="scan'208";a="69417237" Received: from djiang5-desk3.ch.intel.com ([143.182.136.93]) by orsmga008.jf.intel.com with ESMTP; 30 Aug 2018 13:06:13 -0700 Subject: [PATCH] mm: fix BUG_ON() in vmf_insert_pfn_pud() from VM_MIXEDMAP removal From: Dave Jiang To: akpm@linux-foundation.org Cc: linux-mm@kvack.org, linux-nvdimm@lists.01.org, dan.j.williams@intel.com, vishal.l.verma@intel.com, jack@suse.com Date: Thu, 30 Aug 2018 13:06:13 -0700 Message-ID: <153565957352.35524.1005746906902065126.stgit@djiang5-desk3.ch.intel.com> User-Agent: StGit/unknown-version MIME-Version: 1.0 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: X-Virus-Scanned: ClamAV using ClamSMTP It looks like I missed the PUD path when doing VM_MIXEDMAP removal. This can be triggered by: 1. Boot with memmap=4G!8G 2. build ndctl with destructive flag on 3. make TESTS=device-dax check [ +0.000675] kernel BUG at mm/huge_memory.c:824! Applying the same change that was applied to vmf_insert_pfn_pmd() in the original patch. Fixes: e1fb4a08649 ("dax: remove VM_MIXEDMAP for fsdax and device dax") Reported-by: Vishal Verma Signed-off-by: Dave Jiang Acked-by: Jeff Moyer Tested-by: Vishal Verma Reviewed-by: Jan Kara --- mm/huge_memory.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mm/huge_memory.c b/mm/huge_memory.c index c3bc7e9c9a2a..533f9b00147d 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c @@ -821,11 +821,11 @@ vm_fault_t vmf_insert_pfn_pud(struct vm_area_struct *vma, unsigned long addr, * but we need to be consistent with PTEs and architectures that * can't support a 'special' bit. */ - BUG_ON(!(vma->vm_flags & (VM_PFNMAP|VM_MIXEDMAP))); + BUG_ON(!(vma->vm_flags & (VM_PFNMAP|VM_MIXEDMAP)) && + !pfn_t_devmap(pfn)); BUG_ON((vma->vm_flags & (VM_PFNMAP|VM_MIXEDMAP)) == (VM_PFNMAP|VM_MIXEDMAP)); BUG_ON((vma->vm_flags & VM_PFNMAP) && is_cow_mapping(vma->vm_flags)); - BUG_ON(!pfn_t_devmap(pfn)); if (addr < vma->vm_start || addr >= vma->vm_end) return VM_FAULT_SIGBUS;