From: Wupeng Ma <mawupeng1@huawei.com>
To: <akpm@linux-foundation.org>, <dave.hansen@linux.intel.com>,
<luto@kernel.org>, <peterz@infradead.org>
Cc: <linux-kernel@vger.kernel.org>, <x86@kernel.org>, <mawupeng1@huawei.com>
Subject: [PATCH -next 2/2] x86/mm/pat: Drop the unnecessary WARN_ON_ONCE if follow_phys fails
Date: Mon, 6 Mar 2023 16:43:16 +0800 [thread overview]
Message-ID: <20230306084316.2275757-3-mawupeng1@huawei.com> (raw)
In-Reply-To: <20230306084316.2275757-1-mawupeng1@huawei.com>
From: Ma Wupeng <mawupeng1@huawei.com>
Since there is no obvious reason to keep this WARN_ON_ONCE if follow_phys
fails in track_pfn_copy/untrack_pfn, Drop it.
Signed-off-by: Ma Wupeng <mawupeng1@huawei.com>
---
arch/x86/mm/pat/memtype.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/arch/x86/mm/pat/memtype.c b/arch/x86/mm/pat/memtype.c
index c138ea0b0e6e..8c7f9e6b76e6 100644
--- a/arch/x86/mm/pat/memtype.c
+++ b/arch/x86/mm/pat/memtype.c
@@ -992,10 +992,9 @@ int track_pfn_copy(struct vm_area_struct *vma)
* reserve the whole chunk covered by vma. We need the
* starting address and protection from pte.
*/
- if (follow_phys(vma, vma->vm_start, &prot, &paddr)) {
- WARN_ON_ONCE(1);
+ if (follow_phys(vma, vma->vm_start, &prot, &paddr))
return -EINVAL;
- }
+
pgprot = __pgprot(prot);
return reserve_pfn_range(paddr, vma_size, &pgprot, 1);
}
@@ -1079,10 +1078,8 @@ void untrack_pfn(struct vm_area_struct *vma, unsigned long pfn,
/* free the chunk starting from pfn or the whole chunk */
paddr = (resource_size_t)pfn << PAGE_SHIFT;
if (!paddr && !size) {
- if (follow_phys(vma, vma->vm_start, &prot, &paddr)) {
- WARN_ON_ONCE(1);
+ if (follow_phys(vma, vma->vm_start, &prot, &paddr))
return;
- }
size = vma->vm_end - vma->vm_start;
}
--
2.25.1
prev parent reply other threads:[~2023-03-06 8:43 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-06 8:43 [PATCH -next 0/2] Minor cleanup in PAT Wupeng Ma
2023-03-06 8:43 ` [PATCH -next 1/2] x86/mm/pat: Move follow_phys to pat-related file Wupeng Ma
2023-03-06 9:04 ` Borislav Petkov
2023-03-06 9:17 ` mawupeng
2023-03-06 8:43 ` Wupeng Ma [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230306084316.2275757-3-mawupeng1@huawei.com \
--to=mawupeng1@huawei.com \
--cc=akpm@linux-foundation.org \
--cc=dave.hansen@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@kernel.org \
--cc=peterz@infradead.org \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®