linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeremy Fitzhardinge <jeremy@goop.org>
To: Ingo Molnar <mingo@elte.hu>
Cc: LKML <linux-kernel@vger.kernel.org>,
	Isaku Yamahata <yamahata@valinux.co.jp>,
	Thomas Gleixner <tglx@linutronix.de>,
	"H. Peter Anvin" <hpa@zytor.com>,
	Mark McLoughlin <markmc@redhat.com>
Subject: Re: [PATCH 00 of 24] More Xen updates
Date: Fri, 04 Apr 2008 02:33:48 -0700	[thread overview]
Message-ID: <47F5F5FC.3090800@goop.org> (raw)
In-Reply-To: <20080404081034.GB30799@elte.hu>

[-- Attachment #1: Type: text/plain, Size: 919 bytes --]

Ingo Molnar wrote:
> * Jeremy Fitzhardinge <jeremy@goop.org> wrote:
>
>   
>> Hi Ingo,
>>
>> More patches.  There are three groups:
>>
>> - some code movements to make common code available to other
>>   architectures (namely, ia64)
>> - Xen device driver updates, including a new xen paravirt framebuffer driver,
>> - The Xen balloon driver (shrink only, so no dependency on memory hotplug yet)
>> - some "using smp_processor_id while preemptable" warning fixes,
>>   mostly as a result of the core kernel's tendency to do tlb flushes
>>   and update init_mm while preemptable,
>> - other little Xen cleanups
>>     
>
> thanks, applied for testing. The .25 Xen items we've got queued up are:
>
>  Subject: xen: refactor xen_{alloc,release}_{pte,pmd}()
>  Subject: xen: do not pin/unpin PMD pages
>  Subject: xen: clear PG_pinned in release_{pte,pmd}()
>   

Mark just posted another bugfix patch - attached.

    J



[-- Attachment #2: xen-Fix-grant-table-bug.patch --]
[-- Type: text/plain, Size: 3309 bytes --]

Subject: xen: Fix grant table bug

From: Michael Abd-El-Malek <mabdelmalek@cmu.edu>

A PV OS has two grant table data structures: the grant table itself
and a free list.  The free list is composed of an array of pages,
which grow dynamically as the guest OS requires more grants.  While
the grant table contains 8-byte entries, the free list contains 4-byte
entries.  So we have half as many pages in the free list than in the
grant table.

There was a bug in the free list allocation code. The free list was
indexed as if it was the same size as the grant table.  But it's only
half as large.  So memory got corrupted, and I was seeing crashes in
the slab allocator later on.

Taken from:

  http://xenbits.xensource.com/linux-2.6.18-xen.hg?rev/4018c0da3360

Signed-off-by: Michael Abd-El-Malek <mabdelmalek@cmu.edu>
Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
---
 drivers/xen/grant-table.c |   17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

===================================================================
--- a/drivers/xen/grant-table.c
+++ b/drivers/xen/grant-table.c
@@ -381,11 +381,15 @@ EXPORT_SYMBOL_GPL(gnttab_cancel_free_callback);
 static int grow_gnttab_list(unsigned int more_frames)
 {
 	unsigned int new_nr_grant_frames, extra_entries, i;
+	unsigned int nr_glist_frames, new_nr_glist_frames;
 
 	new_nr_grant_frames = nr_grant_frames + more_frames;
 	extra_entries       = more_frames * GREFS_PER_GRANT_FRAME;
 
-	for (i = nr_grant_frames; i < new_nr_grant_frames; i++) {
+	nr_glist_frames = (nr_grant_frames * GREFS_PER_GRANT_FRAME + RPP - 1) / RPP;
+	new_nr_glist_frames =
+		(new_nr_grant_frames * GREFS_PER_GRANT_FRAME + RPP - 1) / RPP;
+	for (i = nr_glist_frames; i < new_nr_glist_frames; i++) {
 		gnttab_list[i] = (grant_ref_t *)__get_free_page(GFP_ATOMIC);
 		if (!gnttab_list[i])
 			goto grow_nomem;
@@ -407,7 +411,7 @@ static int grow_gnttab_list(unsigned int more_frames)
 	return 0;
 
 grow_nomem:
-	for ( ; i >= nr_grant_frames; i--)
+	for ( ; i >= nr_glist_frames; i--)
 		free_page((unsigned long) gnttab_list[i]);
 	return -ENOMEM;
 }
@@ -530,7 +534,7 @@ static int gnttab_expand(unsigned int req_entries)
 static int __devinit gnttab_init(void)
 {
 	int i;
-	unsigned int max_nr_glist_frames;
+	unsigned int max_nr_glist_frames, nr_glist_frames;
 	unsigned int nr_init_grefs;
 
 	if (!is_running_on_xen())
@@ -543,15 +547,15 @@ static int __devinit gnttab_init(void)
 	 * grant reference free list on the current hypervisor.
 	 */
 	max_nr_glist_frames = (boot_max_nr_grant_frames *
-			       GREFS_PER_GRANT_FRAME /
-			       (PAGE_SIZE / sizeof(grant_ref_t)));
+			       GREFS_PER_GRANT_FRAME / RPP);
 
 	gnttab_list = kmalloc(max_nr_glist_frames * sizeof(grant_ref_t *),
 			      GFP_KERNEL);
 	if (gnttab_list == NULL)
 		return -ENOMEM;
 
-	for (i = 0; i < nr_grant_frames; i++) {
+	nr_glist_frames = (nr_grant_frames * GREFS_PER_GRANT_FRAME + RPP - 1) / RPP;
+	for (i = 0; i < nr_glist_frames; i++) {
 		gnttab_list[i] = (grant_ref_t *)__get_free_page(GFP_KERNEL);
 		if (gnttab_list[i] == NULL)
 			goto ini_nomem;
-- 



_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel


      reply	other threads:[~2008-04-04  9:35 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-02 17:53 [PATCH 00 of 24] More Xen updates Jeremy Fitzhardinge
2008-04-02 17:53 ` [PATCH 01 of 24] xen: add missing __HYPERVISOR_arch_[0-7] definisions which ia64 needs Jeremy Fitzhardinge
2008-04-02 17:53 ` [PATCH 02 of 24] xen: add missing VIRQ_ARCH_[0-7] definitions which ia64/xen needs Jeremy Fitzhardinge
2008-04-02 17:53 ` [PATCH 03 of 24] xen: add missing definitions for xen grant table " Jeremy Fitzhardinge
2008-04-02 17:53 ` [PATCH 04 of 24] xen: add missing definitions in include/xen/interface/vcpu.h " Jeremy Fitzhardinge
2008-04-02 17:53 ` [PATCH 05 of 24] xen: move features.c from arch/x86/xen/features.c to drivers/xen Jeremy Fitzhardinge
2008-04-02 17:53 ` [PATCH 06 of 24] xen: Move events.c to drivers/xen for IA64/Xen support Jeremy Fitzhardinge
2008-04-02 17:53 ` [PATCH 07 of 24] Xen: Make events.c portable for ia64/xen support Jeremy Fitzhardinge
2008-04-02 17:53 ` [PATCH 08 of 24] Re: [PATCH 08/12] xen: add resend_irq_on_evtchn() definition into events.c Jeremy Fitzhardinge
2008-04-02 17:53 ` [PATCH 09 of 24] xen: make include/xen/page.h portable moving those definitions under asm dir Jeremy Fitzhardinge
2008-04-02 17:53 ` [PATCH 10 of 24] xen: replace callers of alloc_vm_area()/free_vm_area() with xen_ prefixed one Jeremy Fitzhardinge
2008-04-02 17:54 ` [PATCH 11 of 24] xen: make grant table arch portable Jeremy Fitzhardinge
2008-04-02 17:54 ` [PATCH 12 of 24] xen: import arch generic part of xencomm Jeremy Fitzhardinge
2008-04-02 17:54 ` [PATCH 13 of 24] [PATCH] xen: Make xen-blkfront write its protocol ABI to xenstore Jeremy Fitzhardinge
2008-04-02 17:54 ` [PATCH 14 of 24] xen/blkfront: use bdget_disk Jeremy Fitzhardinge
2008-04-02 17:54 ` [PATCH 15 of 24] xen blkfront: Delay wait for block devices until after the disk is added Jeremy Fitzhardinge
2008-04-02 17:54 ` [PATCH 16 of 24] xen: Module autoprobing support for frontend drivers Jeremy Fitzhardinge
2008-04-02 17:54 ` [PATCH 17 of 24] xen: Add compatibility aliases " Jeremy Fitzhardinge
2008-04-02 17:54 ` [PATCH 18 of 24] xen pvfb: Para-virtual framebuffer, keyboard and pointer driver Jeremy Fitzhardinge
2008-04-02 17:54 ` [PATCH 19 of 24] x86: fix build problem in pud_populate without CONFIG_PARAVIRT Jeremy Fitzhardinge
2008-04-02 17:54 ` [PATCH 20 of 24] xen: disable preemption during tlb flush Jeremy Fitzhardinge
2008-04-02 17:54 ` [PATCH 21 of 24] xen: allow set_pte_at on init_mm to be lockless Jeremy Fitzhardinge
2008-04-02 17:54 ` [PATCH 22 of 24] xen: fold xen_sysexit into xen_iret Jeremy Fitzhardinge
2008-04-02 17:54 ` [PATCH 23 of 24] xen: allow compilation with non-flat memory Jeremy Fitzhardinge
2008-04-02 17:54 ` [PATCH 24 of 24] xen: add balloon driver Jeremy Fitzhardinge
2008-04-07  8:51   ` Isaku Yamahata
2008-04-07 19:01     ` Jeremy Fitzhardinge
2008-04-04  8:10 ` [PATCH 00 of 24] More Xen updates Ingo Molnar
2008-04-04  9:33   ` Jeremy Fitzhardinge [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=47F5F5FC.3090800@goop.org \
    --to=jeremy@goop.org \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=markmc@redhat.com \
    --cc=mingo@elte.hu \
    --cc=tglx@linutronix.de \
    --cc=yamahata@valinux.co.jp \
    /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).