From: Janosch Frank <frankja@linux.ibm.com>
To: linux-s390@vger.kernel.org, kvm@vger.kernel.org
Subject: [RFC 13/14] s390/mm: Pull pmd invalid check in gmap_pmd_op_walk
Date: Wed, 19 Sep 2018 08:48:01 +0000 [thread overview]
Message-ID: <20180919084802.183381-14-frankja@linux.ibm.com> (raw)
Not yet sure if I'll keep this.
The walk should only walk and not check I, but then it looks way
nicer.
Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
---
arch/s390/mm/gmap.c | 17 +++++++----------
1 file changed, 7 insertions(+), 10 deletions(-)
diff --git a/arch/s390/mm/gmap.c b/arch/s390/mm/gmap.c
index 0220a32aa2b9..8d5ce51637eb 100644
--- a/arch/s390/mm/gmap.c
+++ b/arch/s390/mm/gmap.c
@@ -952,7 +952,8 @@ static inline pmd_t *gmap_pmd_op_walk(struct gmap *gmap, unsigned long gaddr,
}
pmdp = (pmd_t *) gmap_table_walk(gmap, gaddr, 1);
- if (!pmdp || pmd_none(*pmdp)) {
+ if (!pmdp || pmd_none(*pmdp) ||
+ pmd_val(*pmdp) & _SEGMENT_ENTRY_INVALID) {
if (*ptl)
spin_unlock(*ptl);
pmdp = NULL;
@@ -1161,7 +1162,7 @@ static int gmap_protect_range(struct gmap *gmap, unsigned long gaddr,
return vmaddr;
vmaddr |= gaddr & ~PMD_MASK;
pmdp = gmap_pmd_op_walk(gmap, gaddr, vmaddr, &ptl_pmd);
- if (pmdp && !(pmd_val(*pmdp) & _SEGMENT_ENTRY_INVALID)) {
+ if (pmdp) {
if (!pmd_large(*pmdp)) {
ptep = gmap_pte_from_pmd(gmap, pmdp, gaddr,
&ptl_pte);
@@ -1266,7 +1267,7 @@ int gmap_read_table(struct gmap *gmap, unsigned long gaddr, unsigned long *val)
if (IS_ERR_VALUE(vmaddr))
return vmaddr;
pmdp = gmap_pmd_op_walk(gmap, gaddr, vmaddr, &ptl_pmd);
- if (pmdp && !(pmd_val(*pmdp) & _SEGMENT_ENTRY_INVALID)) {
+ if (pmdp) {
if (!pmd_large(*pmdp)) {
ptep = gmap_pte_from_pmd(gmap, pmdp, vmaddr, &ptl_pte);
if (ptep) {
@@ -1380,7 +1381,7 @@ static int gmap_protect_rmap(struct gmap *sg, unsigned long raddr,
return vmaddr;
vmaddr |= paddr & ~PMD_MASK;
pmdp = gmap_pmd_op_walk(parent, paddr, vmaddr, &ptl_pmd);
- if (pmdp && !(pmd_val(*pmdp) & _SEGMENT_ENTRY_INVALID)) {
+ if (pmdp) {
if (!pmd_large(*pmdp)) {
ptl_pte = NULL;
ptep = gmap_pte_from_pmd(parent, pmdp, paddr,
@@ -2362,8 +2363,7 @@ int gmap_shadow_segment(struct gmap *sg, unsigned long saddr, pmd_t pmd)
break;
}
spmd = *spmdp;
- if (!(pmd_val(spmd) & _SEGMENT_ENTRY_INVALID) &&
- !((pmd_val(spmd) & _SEGMENT_ENTRY_PROTECT) &&
+ if (!((pmd_val(spmd) & _SEGMENT_ENTRY_PROTECT) &&
!(pmd_val(pmd) & _SEGMENT_ENTRY_PROTECT))) {
pmd_val(*spmdp) |= _SEGMENT_ENTRY_GMAP_VSIE;
@@ -2436,7 +2436,7 @@ int gmap_shadow_page(struct gmap *sg, unsigned long saddr, pte_t pte)
break;
rc = -EAGAIN;
spmdp = gmap_pmd_op_walk(parent, paddr, vmaddr, &ptl_pmd);
- if (spmdp && !(pmd_val(*spmdp) & _SEGMENT_ENTRY_INVALID)) {
+ if (spmdp) {
/* Get page table pointer */
tptep = (pte_t *) gmap_table_walk(sg, saddr, 0);
if (!tptep) {
@@ -2869,9 +2869,6 @@ EXPORT_SYMBOL_GPL(gmap_pmdp_idte_global);
bool gmap_test_and_clear_dirty_pmd(struct gmap *gmap, pmd_t *pmdp,
unsigned long gaddr, unsigned long vmaddr)
{
- if (pmd_val(*pmdp) & _SEGMENT_ENTRY_INVALID)
- return false;
-
/* Already protected memory, which did not change is clean */
if (pmd_val(*pmdp) & _SEGMENT_ENTRY_PROTECT &&
!(pmd_val(*pmdp) & _SEGMENT_ENTRY_GMAP_UC))
--
2.14.3
next reply other threads:[~2018-09-19 8:48 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-19 8:48 Janosch Frank [this message]
2018-10-16 8:59 ` [RFC 13/14] s390/mm: Pull pmd invalid check in gmap_pmd_op_walk David Hildenbrand
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=20180919084802.183381-14-frankja@linux.ibm.com \
--to=frankja@linux.ibm.com \
--cc=kvm@vger.kernel.org \
--cc=linux-s390@vger.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.