From patchwork Thu Aug 30 20:05:46 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dave Jiang X-Patchwork-Id: 10582779 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 A5C1D174A for ; Thu, 30 Aug 2018 20:05:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9383B2C337 for ; Thu, 30 Aug 2018 20:05:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8765D2C3AB; Thu, 30 Aug 2018 20:05:50 +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 29FB62C337 for ; Thu, 30 Aug 2018 20:05:50 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 1D93A6B52FB; Thu, 30 Aug 2018 16:05:49 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 138F26B52FC; Thu, 30 Aug 2018 16:05:49 -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 F1AC76B52FE; Thu, 30 Aug 2018 16:05:48 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pg1-f197.google.com (mail-pg1-f197.google.com [209.85.215.197]) by kanga.kvack.org (Postfix) with ESMTP id AB1006B52FB for ; Thu, 30 Aug 2018 16:05:48 -0400 (EDT) Received: by mail-pg1-f197.google.com with SMTP id d132-v6so5527483pgc.22 for ; Thu, 30 Aug 2018 13:05:48 -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=toD7pGTKRHuHauPZVtzMEG3qFKD53NHT5gtDOMIpKPlES5Cr32nw4oYRFRhwWRwX8v AT8uh93wL6VIfKYalaEsFi+CcNlPU2JM4SEvNMepPmyc7pkOn/+Ufx3hLAPdy/tZ3ZM+ KSUiKN0BbItE4p+JNz43NJ/qIAarfnwSyydHAVvVPwOkl0xYXpees9UkTWFj7qXRVuG3 8j3kmR9dlKC0bYlo3fm2Pg237bGN7l+QZIyMcLne5dXzZDbC/asOwTn3s2d7SA1g9GFU MyuJWHjPJBGOgYRD3lMGIHKkpePub+DJuqsB+Ai/bUuTEEGF4REg4PoUmg83OJMBU4g7 xvLQ== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of dave.jiang@intel.com designates 134.134.136.100 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: APzg51AueOyqQCsXI+GytsWD2w4FK3eBn10esYszQw4mHxbZY4AZnORe 2bvyPx2+58TNezQHaKMzYilaBKqD+G5UoQPeGbsUT3CypLpVFq9aX7c5MjJ6xJmUVydUTnUAdI5 sUrPPsTebjFuZ6h3+CexEqfxgyQ/CrpnrG3QPVBFGClmizvBepmi9WfH8Itv8kVVqPA== X-Received: by 2002:a63:4663:: with SMTP id v35-v6mr11271673pgk.178.1535659548332; Thu, 30 Aug 2018 13:05:48 -0700 (PDT) X-Google-Smtp-Source: ANB0VdYrm8dz7Yn40dX4Fvh8DT24ybGMjeFjDk6+bwf0cDn1Y1doHZfbe4pSfDmEoVEiqdfLK5gx X-Received: by 2002:a63:4663:: with SMTP id v35-v6mr11271642pgk.178.1535659547621; Thu, 30 Aug 2018 13:05:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535659547; cv=none; d=google.com; s=arc-20160816; b=bOgl8U5Z41RHqf9/9gyWxB3jV+bCeqxPL8FiuDWG0slN5BhQ4JcVIG/8tqSwsAJcEq A21pLSyv+tDsQnVznDeSAVZez2X017GuUq/cHV8pcsfBEK/J5N5CsMdOWh1THD8Otb9g QKsLBYNdABd7r1rT93UFuO9dTcN3LWTXFW/FXvCwJa2ewMGEzXBstmvg9uZFcUfcS4Mo sY+rcMgSHUl6pkwdCCw8JF9TMZGyEVYjdZPKNJp21bv7CI/zP8qmFatFq12u9Ih/8Qs+ 7FKSZ7vnlSbJvHpPO+5Rb0bKCj1AGc09f+G3k80aCBgH/z9T6yvg5hD5Bs8QHBaVFYqP GmbQ== 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=JTUBBKDaVakx0/qJVlh+cP4DVyaFHrAUMjp+xZ1z3xtyZh/C1bUyB3A9AIxmZCdoMm YnkrNAIxqBnVGw+ZOw4Xurd6YFnyuohHFV4QgXj2q1+Gkaa0L5hPyPi3MZ6jH2nayD0m MxZExLln2cewoO8bS3AOVOj/gogMTuclGSgM4XbH1dOKE+POgeu0SCfEfqpd5+HCJyn/ r9wRMdOAKpdOS1pmOHRcAmfh6EZQcpWPTeyaM6RmmSUEWVBsitPtYqIcF8e9WiRU9Zb9 ESfaxVjwjo8kgPYJ1zhIFMpTNv8RDu0xSP78eroVQ4FLJ4Q+FKy09AmSk8tHJkmJ9a38 lY0w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of dave.jiang@intel.com designates 134.134.136.100 as permitted sender) smtp.mailfrom=dave.jiang@intel.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from mga07.intel.com (mga07.intel.com. [134.134.136.100]) by mx.google.com with ESMTPS id x6-v6si7260782pge.100.2018.08.30.13.05.47 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 30 Aug 2018 13:05:47 -0700 (PDT) Received-SPF: pass (google.com: domain of dave.jiang@intel.com designates 134.134.136.100 as permitted sender) client-ip=134.134.136.100; Authentication-Results: mx.google.com; spf=pass (google.com: domain of dave.jiang@intel.com designates 134.134.136.100 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 fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 30 Aug 2018 13:05:47 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.53,308,1531810800"; d="scan'208";a="84789355" Received: from djiang5-desk3.ch.intel.com ([143.182.136.93]) by fmsmga004.fm.intel.com with ESMTP; 30 Aug 2018 13:05:46 -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:05:46 -0700 Message-ID: <153565954666.35458.15832314745699968487.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 --- 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;