From: Seth Jennings <sjenning@linux.vnet.ibm.com>
To: Greg Kroah-Hartman <gregkh@suse.de>
Cc: cascardo@holoscopio.com, dan.magenheimer@oracle.com,
rdunlap@xenotime.net, devel@driverdev.osuosl.org,
linux-kernel@vger.kernel.org, linux-mm@kvack.org
Subject: Re: [PATCH] staging: zcache: fix highmem crash on 32-bit
Date: Tue, 23 Aug 2011 12:05:11 -0500 [thread overview]
Message-ID: <4E53DDC7.3040702@linux.vnet.ibm.com> (raw)
In-Reply-To: <1314115590-20942-1-git-send-email-sjenning@linux.vnet.ibm.com>
Please disregard, I sent this one out before on 8/10 :-/
Sorry for the noise.
I couldn't find the original post in the LKML archives,
so I thought I had never sent it. Turns out that I only
sent it to the driver project list.
On 08/23/2011 11:06 AM, Seth Jennings wrote:
> After commit 966b9016a1, zcache_put_page() was modified to pass
> page_address(page) instead of the actual page pointer. In
> combination with the function signature changes to tmem_put()
> and zcache_pampd_create(), zcache_pampd_create() tries to (re)derive
> the page structure from the virtual address. However, if the
> original page is a high memory page (or any unmapped page),
> this virt_to_page() fails because the page_address() in
> zcache_put_page() returned NULL.
>
> This patch changes zcache_put_page() and zcache_get_page() to pass
> the page structure instead of the page's virtual address, which
> may or may not exist.
>
> Signed-off-by: Seth Jennings <sjenning@linux.vnet.ibm.com>
> ---
> drivers/staging/zcache/zcache-main.c | 8 ++++----
> 1 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/staging/zcache/zcache-main.c b/drivers/staging/zcache/zcache-main.c
> index 855a5bb..a3f5162 100644
> --- a/drivers/staging/zcache/zcache-main.c
> +++ b/drivers/staging/zcache/zcache-main.c
> @@ -1158,7 +1158,7 @@ static void *zcache_pampd_create(char *data, size_t size, bool raw, int eph,
> size_t clen;
> int ret;
> unsigned long count;
> - struct page *page = virt_to_page(data);
> + struct page *page = (struct page *)(data);
> struct zcache_client *cli = pool->client;
> uint16_t client_id = get_client_id_from_client(cli);
> unsigned long zv_mean_zsize;
> @@ -1227,7 +1227,7 @@ static int zcache_pampd_get_data(char *data, size_t *bufsize, bool raw,
> int ret = 0;
>
> BUG_ON(is_ephemeral(pool));
> - zv_decompress(virt_to_page(data), pampd);
> + zv_decompress((struct page *)(data), pampd);
> return ret;
> }
>
> @@ -1539,7 +1539,7 @@ static int zcache_put_page(int cli_id, int pool_id, struct tmem_oid *oidp,
> goto out;
> if (!zcache_freeze && zcache_do_preload(pool) == 0) {
> /* preload does preempt_disable on success */
> - ret = tmem_put(pool, oidp, index, page_address(page),
> + ret = tmem_put(pool, oidp, index, (char *)(page),
> PAGE_SIZE, 0, is_ephemeral(pool));
> if (ret < 0) {
> if (is_ephemeral(pool))
> @@ -1572,7 +1572,7 @@ static int zcache_get_page(int cli_id, int pool_id, struct tmem_oid *oidp,
> pool = zcache_get_pool_by_id(cli_id, pool_id);
> if (likely(pool != NULL)) {
> if (atomic_read(&pool->obj_count) > 0)
> - ret = tmem_get(pool, oidp, index, page_address(page),
> + ret = tmem_get(pool, oidp, index, (char *)(page),
> &size, 0, is_ephemeral(pool));
> zcache_put_pool(pool);
> }
WARNING: multiple messages have this Message-ID (diff)
From: Seth Jennings <sjenning@linux.vnet.ibm.com>
To: Greg Kroah-Hartman <gregkh@suse.de>
Cc: cascardo@holoscopio.com, dan.magenheimer@oracle.com,
rdunlap@xenotime.net, devel@driverdev.osuosl.org,
linux-kernel@vger.kernel.org, linux-mm@kvack.org
Subject: Re: [PATCH] staging: zcache: fix highmem crash on 32-bit
Date: Tue, 23 Aug 2011 12:05:11 -0500 [thread overview]
Message-ID: <4E53DDC7.3040702@linux.vnet.ibm.com> (raw)
In-Reply-To: <1314115590-20942-1-git-send-email-sjenning@linux.vnet.ibm.com>
Please disregard, I sent this one out before on 8/10 :-/
Sorry for the noise.
I couldn't find the original post in the LKML archives,
so I thought I had never sent it. Turns out that I only
sent it to the driver project list.
On 08/23/2011 11:06 AM, Seth Jennings wrote:
> After commit 966b9016a1, zcache_put_page() was modified to pass
> page_address(page) instead of the actual page pointer. In
> combination with the function signature changes to tmem_put()
> and zcache_pampd_create(), zcache_pampd_create() tries to (re)derive
> the page structure from the virtual address. However, if the
> original page is a high memory page (or any unmapped page),
> this virt_to_page() fails because the page_address() in
> zcache_put_page() returned NULL.
>
> This patch changes zcache_put_page() and zcache_get_page() to pass
> the page structure instead of the page's virtual address, which
> may or may not exist.
>
> Signed-off-by: Seth Jennings <sjenning@linux.vnet.ibm.com>
> ---
> drivers/staging/zcache/zcache-main.c | 8 ++++----
> 1 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/staging/zcache/zcache-main.c b/drivers/staging/zcache/zcache-main.c
> index 855a5bb..a3f5162 100644
> --- a/drivers/staging/zcache/zcache-main.c
> +++ b/drivers/staging/zcache/zcache-main.c
> @@ -1158,7 +1158,7 @@ static void *zcache_pampd_create(char *data, size_t size, bool raw, int eph,
> size_t clen;
> int ret;
> unsigned long count;
> - struct page *page = virt_to_page(data);
> + struct page *page = (struct page *)(data);
> struct zcache_client *cli = pool->client;
> uint16_t client_id = get_client_id_from_client(cli);
> unsigned long zv_mean_zsize;
> @@ -1227,7 +1227,7 @@ static int zcache_pampd_get_data(char *data, size_t *bufsize, bool raw,
> int ret = 0;
>
> BUG_ON(is_ephemeral(pool));
> - zv_decompress(virt_to_page(data), pampd);
> + zv_decompress((struct page *)(data), pampd);
> return ret;
> }
>
> @@ -1539,7 +1539,7 @@ static int zcache_put_page(int cli_id, int pool_id, struct tmem_oid *oidp,
> goto out;
> if (!zcache_freeze && zcache_do_preload(pool) == 0) {
> /* preload does preempt_disable on success */
> - ret = tmem_put(pool, oidp, index, page_address(page),
> + ret = tmem_put(pool, oidp, index, (char *)(page),
> PAGE_SIZE, 0, is_ephemeral(pool));
> if (ret < 0) {
> if (is_ephemeral(pool))
> @@ -1572,7 +1572,7 @@ static int zcache_get_page(int cli_id, int pool_id, struct tmem_oid *oidp,
> pool = zcache_get_pool_by_id(cli_id, pool_id);
> if (likely(pool != NULL)) {
> if (atomic_read(&pool->obj_count) > 0)
> - ret = tmem_get(pool, oidp, index, page_address(page),
> + ret = tmem_get(pool, oidp, index, (char *)(page),
> &size, 0, is_ephemeral(pool));
> zcache_put_pool(pool);
> }
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2011-08-23 18:05 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-08-23 16:06 [PATCH] staging: zcache: fix highmem crash on 32-bit Seth Jennings
2011-08-23 16:06 ` Seth Jennings
2011-08-23 17:05 ` Seth Jennings [this message]
2011-08-23 17:05 ` Seth Jennings
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=4E53DDC7.3040702@linux.vnet.ibm.com \
--to=sjenning@linux.vnet.ibm.com \
--cc=cascardo@holoscopio.com \
--cc=dan.magenheimer@oracle.com \
--cc=devel@driverdev.osuosl.org \
--cc=gregkh@suse.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=rdunlap@xenotime.net \
/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.