From: Martin Schwidefsky <schwidefsky@de.ibm.com>
To: Hugh Dickins <hugh@veritas.com>
Cc: linux-kernel@vger.kernel.org, linux-s390@vger.kernel.org,
virtualization@lists.osdl.org, akpm@linux-foundation.org,
nickpiggin@yahoo.com.au, zach@vmware.com, frankeh@watson.ibm.com,
rusty@rustcorp.com.au, jeremy@goop.org, andrea@qumranet.com,
clameter@sgi.com, a.p.zijlstra@chello.nl
Subject: Re: [patch 0/6] Guest page hinting version 6.
Date: Tue, 06 May 2008 17:33:02 +0200 [thread overview]
Message-ID: <1210087982.31803.32.camel@localhost> (raw)
In-Reply-To: <Pine.LNX.4.64.0803131627450.17244@blonde.site>
On Thu, 2008-03-13 at 16:57 +0000, Hugh Dickins wrote:
> It's very encouraging to see Jeremy and Rusty weighing in. I hope
> Zach will too, and I've added Andrea: their support would count a lot.
> You have Nick on the list, good, I've added Christoph and Peter
> (if you do resend, linux-mm might prove more useful than linux-kernel).
>
> With support from rival virtualizers,
> I do think you've a good chance of getting in.
Traffic on the guest page hinting patches died down again. Until another
user shows up I guess that's it for the full version. In the meantime I
push the patch below which is the poor mans version that can be done
without common code change. It uses the arch_alloc_page/arch_free_page
hooks to do the stable/unused state transitions. Better than nothing ..
--
blue skies,
Martin.
"Reality continues to ruin my life." - Calvin.
---
Subject: [PATCH] guest page hinting light
From: Martin Schwidefsky <schwidefsky@de.ibm.com>
Use the existing arch_alloc_page/arch_free_page callbacks to do
the guest page state transitions between stable and unused.
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
---
arch/s390/Kconfig | 7 +++
arch/s390/mm/Makefile | 1
arch/s390/mm/init.c | 3 +
arch/s390/mm/page-states.c | 79 +++++++++++++++++++++++++++++++++++++++++++++
include/asm-s390/page.h | 11 ++++++
include/asm-s390/system.h | 6 +++
6 files changed, 107 insertions(+)
diff -urpN linux-2.6/arch/s390/Kconfig linux-2.6-patched/arch/s390/Kconfig
--- linux-2.6/arch/s390/Kconfig 2008-05-06 17:38:14.000000000 +0200
+++ linux-2.6-patched/arch/s390/Kconfig 2008-05-06 17:38:28.000000000 +0200
@@ -430,6 +430,13 @@ config CMM_IUCV
Select this option to enable the special message interface to
the cooperative memory management.
+config PAGE_STATES
+ bool "Unused page notification"
+ help
+ This enables the notification of unused pages to the
+ hypervisor. The ESSA instruction is used to do the states
+ changes between a page that has content and the unused state.
+
config VIRT_TIMER
bool "Virtual CPU timer support"
help
diff -urpN linux-2.6/arch/s390/mm/init.c linux-2.6-patched/arch/s390/mm/init.c
--- linux-2.6/arch/s390/mm/init.c 2008-05-06 17:38:14.000000000 +0200
+++ linux-2.6-patched/arch/s390/mm/init.c 2008-05-06 17:38:28.000000000 +0200
@@ -126,6 +126,9 @@ void __init mem_init(void)
/* clear the zero-page */
memset(empty_zero_page, 0, PAGE_SIZE);
+ /* Setup guest page hinting */
+ cmma_init();
+
/* this will put all low memory onto the freelists */
totalram_pages += free_all_bootmem();
diff -urpN linux-2.6/arch/s390/mm/Makefile linux-2.6-patched/arch/s390/mm/Makefile
--- linux-2.6/arch/s390/mm/Makefile 2008-05-06 17:38:14.000000000 +0200
+++ linux-2.6-patched/arch/s390/mm/Makefile 2008-05-06 17:38:28.000000000 +0200
@@ -5,3 +5,4 @@
obj-y := init.o fault.o extmem.o mmap.o vmem.o pgtable.o
obj-$(CONFIG_CMM) += cmm.o
obj-$(CONFIG_HUGETLB_PAGE) += hugetlbpage.o
+obj-$(CONFIG_PAGE_STATES) += page-states.o
diff -urpN linux-2.6/arch/s390/mm/page-states.c linux-2.6-patched/arch/s390/mm/page-states.c
--- linux-2.6/arch/s390/mm/page-states.c 1970-01-01 01:00:00.000000000 +0100
+++ linux-2.6-patched/arch/s390/mm/page-states.c 2008-05-06 17:38:28.000000000 +0200
@@ -0,0 +1,79 @@
+/*
+ * arch/s390/mm/page-states.c
+ *
+ * (C) Copyright IBM Corp. 2008
+ *
+ * Guest page hinting for unused pages.
+ *
+ * Author(s): Martin Schwidefsky <schwidefsky@de.ibm.com>
+ */
+
+#include <linux/kernel.h>
+#include <linux/errno.h>
+#include <linux/types.h>
+#include <linux/mm.h>
+#include <linux/init.h>
+
+#define ESSA_SET_STABLE 1
+#define ESSA_SET_UNUSED 2
+
+int cmma_flag;
+
+static int __init cmma(char *str)
+{
+ char *parm;
+ parm = strstrip(str);
+ if (strcmp(parm, "yes") == 0 || strcmp(parm, "on") == 0) {
+ cmma_flag = 1;
+ return 1;
+ }
+ cmma_flag = 0;
+ if (strcmp(parm, "no") == 0 || strcmp(parm, "off") == 0)
+ return 1;
+ return 0;
+}
+
+__setup("cmma=", cmma);
+
+void __init cmma_init(void)
+{
+ register unsigned long tmp asm("0") = 0;
+ register int rc asm("1") = -ENOSYS;
+
+ if (!cmma_flag)
+ return;
+ asm volatile(
+ " .insn rrf,0xb9ab0000,%1,%1,0,0\n"
+ "0: la %0,0\n"
+ "1:\n"
+ EX_TABLE(0b,1b)
+ : "+&d" (rc), "+&d" (tmp));
+ if (rc)
+ cmma_flag = 0;
+}
+
+void arch_free_page(struct page *page, int order)
+{
+ int i, rc;
+
+ if (!cmma_flag)
+ return;
+ for (i = 0; i < (1 << order); i++)
+ asm volatile(".insn rrf,0xb9ab0000,%0,%1,%2,0"
+ : "=&d" (rc)
+ : "a" ((page_to_pfn(page) + i) << PAGE_SHIFT),
+ "i" (ESSA_SET_UNUSED));
+}
+
+void arch_alloc_page(struct page *page, int order)
+{
+ int i, rc;
+
+ if (!cmma_flag)
+ return;
+ for (i = 0; i < (1 << order); i++)
+ asm volatile(".insn rrf,0xb9ab0000,%0,%1,%2,0"
+ : "=&d" (rc)
+ : "a" ((page_to_pfn(page) + i) << PAGE_SHIFT),
+ "i" (ESSA_SET_STABLE));
+}
diff -urpN linux-2.6/include/asm-s390/page.h linux-2.6-patched/include/asm-s390/page.h
--- linux-2.6/include/asm-s390/page.h 2008-05-06 17:38:17.000000000 +0200
+++ linux-2.6-patched/include/asm-s390/page.h 2008-05-06 17:38:28.000000000 +0200
@@ -125,6 +125,17 @@ page_get_storage_key(unsigned long addr)
return skey;
}
+#ifdef CONFIG_PAGE_STATES
+
+struct page;
+void arch_free_page(struct page *page, int order);
+void arch_alloc_page(struct page *page, int order);
+
+#define HAVE_ARCH_FREE_PAGE
+#define HAVE_ARCH_ALLOC_PAGE
+
+#endif
+
#endif /* !__ASSEMBLY__ */
/* to align the pointer to the (next) page boundary */
diff -urpN linux-2.6/include/asm-s390/system.h linux-2.6-patched/include/asm-s390/system.h
--- linux-2.6/include/asm-s390/system.h 2008-05-06 17:38:17.000000000 +0200
+++ linux-2.6-patched/include/asm-s390/system.h 2008-05-06 17:38:28.000000000 +0200
@@ -116,6 +116,12 @@ extern void pfault_fini(void);
#define pfault_fini() do { } while (0)
#endif /* CONFIG_PFAULT */
+#ifdef CONFIG_PAGE_STATES
+extern void cmma_init(void);
+#else
+#define cmma_init() do { } while (0)
+#endif
+
#define finish_arch_switch(prev) do { \
set_fs(current->thread.mm_segment); \
account_vtime(prev); \
next prev parent reply other threads:[~2008-05-06 15:33 UTC|newest]
Thread overview: 49+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-03-12 13:21 [patch 0/6] Guest page hinting version 6 Martin Schwidefsky
2008-03-12 13:21 ` [patch 1/6] Guest page hinting: core + volatile page cache Martin Schwidefsky
2008-03-12 23:12 ` Rusty Russell
2008-03-13 9:24 ` Martin Schwidefsky
2008-03-12 13:21 ` [patch 2/6] Guest page hinting: volatile swap cache Martin Schwidefsky
2008-03-12 13:21 ` [patch 3/6] Guest page hinting: mlocked pages Martin Schwidefsky
2008-03-12 23:27 ` Rusty Russell
2008-03-13 9:13 ` Martin Schwidefsky
2008-03-12 13:21 ` [patch 4/6] Guest page hinting: writable page table entries Martin Schwidefsky
2008-03-12 23:35 ` Rusty Russell
2008-03-13 9:11 ` Martin Schwidefsky
2008-03-12 13:21 ` [patch 5/6] Guest page hinting: minor fault optimization Martin Schwidefsky
2008-03-12 13:21 ` [patch 6/6] Guest page hinting: s390 support Martin Schwidefsky
2008-03-12 16:19 ` Jeremy Fitzhardinge
2008-03-12 16:28 ` Martin Schwidefsky
2008-03-12 16:44 ` Jeremy Fitzhardinge
2008-03-12 16:59 ` Martin Schwidefsky
2008-03-12 17:48 ` Jeremy Fitzhardinge
2008-03-12 20:04 ` Anthony Liguori
2008-03-12 20:45 ` Jeremy Fitzhardinge
2008-03-12 20:56 ` Anthony Liguori
2008-03-12 21:36 ` Jeremy Fitzhardinge
2008-03-13 9:45 ` Martin Schwidefsky
2008-03-13 16:07 ` Jeremy Fitzhardinge
2008-03-13 16:17 ` Jeremy Fitzhardinge
2008-03-13 16:55 ` Martin Schwidefsky
2008-03-13 17:05 ` Jeremy Fitzhardinge
2008-03-13 17:23 ` Martin Schwidefsky
2008-03-13 9:42 ` Martin Schwidefsky
2008-03-13 9:36 ` Martin Schwidefsky
2008-03-13 9:32 ` Martin Schwidefsky
2008-03-12 22:41 ` [patch 0/6] Guest page hinting version 6 Rusty Russell
2008-03-13 9:47 ` Martin Schwidefsky
2008-03-13 16:57 ` Hugh Dickins
2008-03-13 17:14 ` Martin Schwidefsky
2008-03-13 17:45 ` Zachary Amsden
2008-03-13 19:45 ` Andrea Arcangeli
2008-03-13 21:41 ` Zachary Amsden
2008-03-13 18:41 ` Jeremy Fitzhardinge
2008-03-13 18:55 ` Hugh Dickins
2008-03-13 19:53 ` Zachary Amsden
2008-03-14 18:30 ` Jeremy Fitzhardinge
2008-03-14 21:32 ` Zachary Amsden
2008-03-14 21:37 ` Jeremy Fitzhardinge
2008-03-17 9:21 ` Martin Schwidefsky
2008-05-06 15:33 ` Martin Schwidefsky [this message]
2008-05-06 19:46 ` Rik van Riel
2008-05-07 3:49 ` Zachary Amsden
2008-05-07 7:00 ` Martin Schwidefsky
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=1210087982.31803.32.camel@localhost \
--to=schwidefsky@de.ibm.com \
--cc=a.p.zijlstra@chello.nl \
--cc=akpm@linux-foundation.org \
--cc=andrea@qumranet.com \
--cc=clameter@sgi.com \
--cc=frankeh@watson.ibm.com \
--cc=hugh@veritas.com \
--cc=jeremy@goop.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-s390@vger.kernel.org \
--cc=nickpiggin@yahoo.com.au \
--cc=rusty@rustcorp.com.au \
--cc=virtualization@lists.osdl.org \
--cc=zach@vmware.com \
/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;
as well as URLs for NNTP newsgroup(s).