Skip to contentSkip to conversation

ramzswap: remove ARM specific d-cache hack

PATCH Applied Nitin Gupta 4 participants 6 messages Dec 12, 2009 – Dec 18, 2009 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ramzswap: remove ARM specific d-cache hack

Remove d-cache hack in ramzswap driver that was needed to workaround a bug in ARM version of update_mmu_cache() which caused stale data in d-cache to be transferred to userspace. This bug was fixed by git commit:

	787b2faadc4356b6c2c71feb42fb944fece9a12f

This also brings down one entry in TODO file.

---
 drivers/staging/ramzswap/TODO           |    1 -
 drivers/staging/ramzswap/ramzswap_drv.c |   28 +++-------------------------
 2 files changed, 3 insertions(+), 26 deletions(-)
drivers/staging/ramzswap/TODO +0 -1
index bac40d6..8d64e28 100644
@@ -1,6 +1,5 @@
 TODO:
 	- Add support for swap notifiers
-	- Remove CONFIG_ARM hack
 
 Please send patches to Greg Kroah-Hartman <[email protected]> and
 Nitin Gupta <[email protected]>
drivers/staging/ramzswap/ramzswap_drv.c +3 -25
index b839f05..989fac5 100644
@@ -222,28 +222,6 @@ out:
 	return ret;
 }
 
-static void ramzswap_flush_dcache_page(struct page *page)
-{
-#ifdef CONFIG_ARM
-	int flag = 0;
-	/*
-	 * Ugly hack to get flush_dcache_page() work on ARM.
-	 * page_mapping(page) == NULL after clearing this swap cache flag.
-	 * Without clearing this flag, flush_dcache_page() will simply set
-	 * "PG_dcache_dirty" bit and return.
-	 */
-	if (PageSwapCache(page)) {
-		flag = 1;
-		ClearPageSwapCache(page);
-	}
-#endif
-	flush_dcache_page(page);
-#ifdef CONFIG_ARM
-	if (flag)
-		SetPageSwapCache(page);
-#endif
-}
-
 void ramzswap_ioctl_get_stats(struct ramzswap *rzs,
 			struct ramzswap_ioctl_stats *s)
 {
@@ -655,7 +633,7 @@ static int handle_zero_page(struct bio *bio)
 	memset(user_mem, 0, PAGE_SIZE);
 	kunmap_atomic(user_mem, KM_USER0);
 
-	ramzswap_flush_dcache_page(page);
+	flush_dcache_page(page);
 
 	set_bit(BIO_UPTODATE, &bio->bi_flags);
 	bio_endio(bio, 0);
@@ -679,7 +657,7 @@ static int handle_uncompressed_page(struct ramzswap *rzs, struct bio *bio)
 	kunmap_atomic(user_mem, KM_USER0);
 	kunmap_atomic(cmem, KM_USER1);
 
-	ramzswap_flush_dcache_page(page);
+	flush_dcache_page(page);
 
 	set_bit(BIO_UPTODATE, &bio->bi_flags);
 	bio_endio(bio, 0);
@@ -779,7 +757,7 @@ static int ramzswap_read(struct ramzswap *rzs, struct bio *bio)
 		goto out;
 	}
 
-	ramzswap_flush_dcache_page(page);
+	flush_dcache_page(page);
 
 	set_bit(BIO_UPTODATE, &bio->bi_flags);
 	bio_endio(bio, 0);
Acked-by on v1 1/1
#1 lore raw
Quoted 8 lines · Nitin Gupta

Remove d-cache hack in ramzswap driver that was needed to workaround a bug in ARM version of update_mmu_cache() which caused stale data in d-cache to be transferred to userspace. This bug was fixed by git commit:
       787b2faadc4356b6c2c71feb42fb944fece9a12f This also brings down one entry in TODO file.

Quoted 82 lines

---
 drivers/staging/ramzswap/TODO           |    1 - drivers/staging/ramzswap/ramzswap_drv.c |   28 +++-------------------------

 2 files changed, 3 insertions(+), 26 deletions(-)
drivers/staging/ramzswap/TODO +0 -0
index bac40d6..8d64e28 100644
@@ -1,6 +1,5 @@

 TODO:
       - Add support for swap notifiers
-       - Remove CONFIG_ARM hack

 Please send patches to Greg Kroah-Hartman <[email protected]> and Nitin Gupta <[email protected]>

drivers/staging/ramzswap/ramzswap_drv.c +3 -26
index b839f05..989fac5 100644
@@ -222,28 +222,6 @@ out:
        return ret;
  }
 
-static void ramzswap_flush_dcache_page(struct page *page)
-{
-#ifdef CONFIG_ARM
-       int flag = 0;
-       /*
-        * Ugly hack to get flush_dcache_page() work on ARM.
-        * page_mapping(page) == NULL after clearing this swap cache flag.
-        * Without clearing this flag, flush_dcache_page() will simply set
-        * "PG_dcache_dirty" bit and return.
-        */
-       if (PageSwapCache(page)) {
-               flag = 1;
-               ClearPageSwapCache(page);
-       }
-#endif
-       flush_dcache_page(page);
-#ifdef CONFIG_ARM
-       if (flag)
-               SetPageSwapCache(page);
-#endif
-}
-
  void ramzswap_ioctl_get_stats(struct ramzswap *rzs,
                        struct ramzswap_ioctl_stats *s)
  {
@@ -655,7 +633,7 @@ static int handle_zero_page(struct bio *bio)
        memset(user_mem, 0, PAGE_SIZE);
        kunmap_atomic(user_mem, KM_USER0);
 
-       ramzswap_flush_dcache_page(page);
+       flush_dcache_page(page);
 
        set_bit(BIO_UPTODATE, &bio->bi_flags);
        bio_endio(bio, 0);
@@ -679,7 +657,7 @@ static int handle_uncompressed_page(struct ramzswap *rzs, struct bio *bio)
        kunmap_atomic(user_mem, KM_USER0);
        kunmap_atomic(cmem, KM_USER1);
 
-       ramzswap_flush_dcache_page(page);
+       flush_dcache_page(page);
 
        set_bit(BIO_UPTODATE, &bio->bi_flags);
        bio_endio(bio, 0);
@@ -779,7 +757,7 @@ static int ramzswap_read(struct ramzswap *rzs, struct bio *bio)
                goto out;
        }
 
-       ramzswap_flush_dcache_page(page);
+       flush_dcache_page(page);
 
        set_bit(BIO_UPTODATE, &bio->bi_flags);
        bio_endio(bio, 0);
--

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

#2 lore raw
Quoted 11 lines · Pekka Enberg
Quoted 8 lines · Nitin Gupta

Remove d-cache hack in ramzswap driver that was needed to workaround a bug in ARM version of update_mmu_cache() which caused stale data in d-cache to be transferred to userspace. This bug was fixed by git commit:

       787b2faadc4356b6c2c71feb42fb944fece9a12f

This also brings down one entry in TODO file.

Thanks for review Pekka.
Now wondering when this patch will be committed to mainline.

Nitin

Quoted 84 lines
Quoted 83 lines
---
 drivers/staging/ramzswap/TODO           |    1 -
 drivers/staging/ramzswap/ramzswap_drv.c |   28 +++-------------------------
 2 files changed, 3 insertions(+), 26 deletions(-)
drivers/staging/ramzswap/TODO +0 -1
index bac40d6..8d64e28 100644
@@ -1,6 +1,5 @@
 TODO:
       - Add support for swap notifiers
-       - Remove CONFIG_ARM hack
 
 Please send patches to Greg Kroah-Hartman <[email protected]> and
 Nitin Gupta <[email protected]>
drivers/staging/ramzswap/ramzswap_drv.c +3 -26
index b839f05..989fac5 100644
@@ -222,28 +222,6 @@ out:
       return ret;
 }
 
-static void ramzswap_flush_dcache_page(struct page *page)
-{
-#ifdef CONFIG_ARM
-       int flag = 0;
-       /*
-        * Ugly hack to get flush_dcache_page() work on ARM.
-        * page_mapping(page) == NULL after clearing this swap cache flag.
-        * Without clearing this flag, flush_dcache_page() will simply set
-        * "PG_dcache_dirty" bit and return.
-        */
-       if (PageSwapCache(page)) {
-               flag = 1;
-               ClearPageSwapCache(page);
-       }
-#endif
-       flush_dcache_page(page);
-#ifdef CONFIG_ARM
-       if (flag)
-               SetPageSwapCache(page);
-#endif
-}
-
 void ramzswap_ioctl_get_stats(struct ramzswap *rzs,
                       struct ramzswap_ioctl_stats *s)
 {
@@ -655,7 +633,7 @@ static int handle_zero_page(struct bio *bio)
       memset(user_mem, 0, PAGE_SIZE);
       kunmap_atomic(user_mem, KM_USER0);
 
-       ramzswap_flush_dcache_page(page);
+       flush_dcache_page(page);
 
       set_bit(BIO_UPTODATE, &bio->bi_flags);
       bio_endio(bio, 0);
@@ -679,7 +657,7 @@ static int handle_uncompressed_page(struct ramzswap *rzs, struct bio *bio)
       kunmap_atomic(user_mem, KM_USER0);
       kunmap_atomic(cmem, KM_USER1);
 
-       ramzswap_flush_dcache_page(page);
+       flush_dcache_page(page);
 
       set_bit(BIO_UPTODATE, &bio->bi_flags);
       bio_endio(bio, 0);
@@ -779,7 +757,7 @@ static int ramzswap_read(struct ramzswap *rzs, struct bio *bio)
               goto out;
       }
 
-       ramzswap_flush_dcache_page(page);
+       flush_dcache_page(page);
 
       set_bit(BIO_UPTODATE, &bio->bi_flags);
       bio_endio(bio, 0);
--

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

#3 lore raw
Quoted 9 lines · Nitin Gupta
Quoted 8 lines · Pekka Enberg
Quoted 7 lines · Nitin Gupta

Remove d-cache hack in ramzswap driver that was needed to workaround a bug in ARM version of update_mmu_cache() which caused stale data in d-cache to be transferred to userspace. This bug was fixed by git commit:
       787b2faadc4356b6c2c71feb42fb944fece9a12f This also brings down one entry in TODO file.

Quoted 6 lines
Quoted 3 lines
Quoted 1 line

Thanks for review Pekka.
Now wondering when this patch will be committed to mainline.

I don't see any reason why this shouldn't go into .33 but that's really up to Greg.

Pekka

#4 lore raw
Quoted 12 lines · Pekka Enberg
Quoted 11 lines · Nitin Gupta
Quoted 10 lines · Pekka Enberg
Quoted 8 lines · Nitin Gupta

Remove d-cache hack in ramzswap driver that was needed to workaround a bug in ARM version of update_mmu_cache() which caused stale data in d-cache to be transferred to userspace. This bug was fixed by git commit:
? ? ? ?787b2faadc4356b6c2c71feb42fb944fece9a12f This also brings down one entry in TODO file.

Quoted 7 lines
Quoted 4 lines
Quoted 1 line

Thanks for review Pekka.
Now wondering when this patch will be committed to mainline.

I don't see any reason why this shouldn't go into .33 but that's really up to Greg.

It will end up there, thanks, I will queue it up in a few days to go there.

thanks,

greg k-h

#5 lore raw

patch staging-ramzswap-remove-arm-specific-d-cache-hack.patch added to gregkh-2.6 tree

In reply to Nitin Gupta

This is a note to let you know that I've just added the patch titled

Subject: Staging: ramzswap: remove ARM specific d-cache hack

to my gregkh-2.6 tree. Its filename is

staging-ramzswap-remove-arm-specific-d-cache-hack.patch

This tree can be found at
http://www.kernel.org/pub/linux/kernel/people/gregkh/gregkh-2.6/patches/

Quoted 1 line

From [email protected] Fri Dec 18 10:22:00 2009

From: Nitin Gupta <[email protected]>
Date: Sat, 12 Dec 2009 11:44:46 +0530
Subject: Staging: ramzswap: remove ARM specific d-cache hack
To: Greg KH <[email protected]>
Cc: Andrew Morton <[email protected]>, linux-kernel <[email protected]>
Message-ID: <[email protected]>

Remove d-cache hack in ramzswap driver that was needed to workaround a bug in ARM version of update_mmu_cache() which caused stale data in d-cache to be transferred to userspace. This bug was fixed by git commit:

	787b2faadc4356b6c2c71feb42fb944fece9a12f

This also brings down one entry in TODO file.

---
 drivers/staging/ramzswap/TODO           |    1 -
 drivers/staging/ramzswap/ramzswap_drv.c |   28 +++-------------------------
 2 files changed, 3 insertions(+), 26 deletions(-)
drivers/staging/ramzswap/ramzswap_drv.c +3 -25
@@ -222,28 +222,6 @@ out:
 	return ret;
 }
 
-static void ramzswap_flush_dcache_page(struct page *page)
-{
-#ifdef CONFIG_ARM
-	int flag = 0;
-	/*
-	 * Ugly hack to get flush_dcache_page() work on ARM.
-	 * page_mapping(page) == NULL after clearing this swap cache flag.
-	 * Without clearing this flag, flush_dcache_page() will simply set
-	 * "PG_dcache_dirty" bit and return.
-	 */
-	if (PageSwapCache(page)) {
-		flag = 1;
-		ClearPageSwapCache(page);
-	}
-#endif
-	flush_dcache_page(page);
-#ifdef CONFIG_ARM
-	if (flag)
-		SetPageSwapCache(page);
-#endif
-}
-
 void ramzswap_ioctl_get_stats(struct ramzswap *rzs,
 			struct ramzswap_ioctl_stats *s)
 {
@@ -655,7 +633,7 @@ static int handle_zero_page(struct bio *
 	memset(user_mem, 0, PAGE_SIZE);
 	kunmap_atomic(user_mem, KM_USER0);
 
-	ramzswap_flush_dcache_page(page);
+	flush_dcache_page(page);
 
 	set_bit(BIO_UPTODATE, &bio->bi_flags);
 	bio_endio(bio, 0);
@@ -679,7 +657,7 @@ static int handle_uncompressed_page(stru
 	kunmap_atomic(user_mem, KM_USER0);
 	kunmap_atomic(cmem, KM_USER1);
 
-	ramzswap_flush_dcache_page(page);
+	flush_dcache_page(page);
 
 	set_bit(BIO_UPTODATE, &bio->bi_flags);
 	bio_endio(bio, 0);
@@ -779,7 +757,7 @@ static int ramzswap_read(struct ramzswap
 		goto out;
 	}
 
-	ramzswap_flush_dcache_page(page);
+	flush_dcache_page(page);
 
 	set_bit(BIO_UPTODATE, &bio->bi_flags);
 	bio_endio(bio, 0);
drivers/staging/ramzswap/TODO +0 -1
@@ -1,6 +1,5 @@
 TODO:
 	- Add support for swap notifiers
-	- Remove CONFIG_ARM hack
 
 Please send patches to Greg Kroah-Hartman <[email protected]> and
 Nitin Gupta <[email protected]>