linux-um archives
 help / color / mirror / Atom feed
From: Blaisorblade <blaisorblade@yahoo.it>
To: Jason Lunz <lunz@falooley.org>
Cc: Jeff Dike <jdike@addtoit.com>,
	user-mode-linux-devel@lists.sourceforge.net,
	Jens Axboe <jens.axboe@oracle.com>
Subject: Re: [uml-devel] [UML] fix crash in block layer
Date: Fri, 16 Feb 2007 20:10:18 +0100	[thread overview]
Message-ID: <200702162010.18776.blaisorblade@yahoo.it> (raw)
In-Reply-To: <20070216170207.GC2427@metaxa.reflex>

On Friday 16 February 2007 18:02, Jason Lunz wrote:
> On Thu, Feb 15, 2007 at 08:29:28PM +0100, Blaisorblade wrote:
> > The following could be a suggestion, if max_low_pfn is not used between
> > the old and the new moment of assignment (and it seems it is not). This
> > is just an idea however:

> blk_queue_bounce_limit() calls init_emergency_isa_pool() to get dma-zone
> pages to use as bounce buffers when its caller passes a dma_addr limit
> that is less than max_low_pfn. The BLK_BOUNCE_ANY macro is supposed to
> mean "never bounce", and it's defined as:

> #define BLK_BOUNCE_ANY          ((u64)blk_max_pfn << PAGE_SHIFT)

> So it presumes that max_pfn >= max_low_pfn. uml's mem_init() is
> violating this assumption - when uml_reserved is subtracted from
> max_pfn, we end up with max_pfn < max_low_pfn, so BLK_BOUNCE_ANY has the
> opposite of the intended effect. blk_queue_bounce_limit therefore tries
> to create a mempool with zone-dma pages on a no-dma-zone arch and the
> kernel goes BUG().

Thanks for the explaination; but I meant that the meaning of those variables 
and the code to set them was convoluted.

> So I think your idea is correct. It passes my testing - I can still use
> lvm within uml. I have not tested CONFIG_HIGHMEM, but here's an 
> implementation against 2.6.20.

Do not worry for HIGHMEM - I doubt it builds currently; uml_reserved is also 
used for other stuff.

I've also verified that moving the assignment to max_low_pfn to later cannot 
possibly introduce bugs, as max_{low_,}pfn are not used by core kernel code.

> Jeff, please drop my other patch and use this one.

> Signed-off-by: Jason Lunz <lunz@falooley.org>
>
> ---
>  arch/um/kernel/mem.c |    3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
>
> Index: linux-2.6.20-uml/arch/um/kernel/mem.c
> ===================================================================
> --- linux-2.6.20-uml.orig/arch/um/kernel/mem.c
> +++ linux-2.6.20-uml/arch/um/kernel/mem.c
> @@ -63,8 +63,6 @@
>
>  void mem_init(void)
>  {
> -	max_low_pfn = (high_physmem - uml_physmem) >> PAGE_SHIFT;
> -
>          /* clear the zero-page */
>          memset((void *) empty_zero_page, 0, PAGE_SIZE);
>
> @@ -79,6 +77,7 @@
>
>  	/* this will put all low memory onto the freelists */
>  	totalram_pages = free_all_bootmem();
> +	max_low_pfn = totalram_pages;
>  #ifdef CONFIG_HIGHMEM
>  	totalhigh_pages = highmem >> PAGE_SHIFT;
>  	totalram_pages += totalhigh_pages;

-- 
Inform me of my mistakes, so I can add them to my list!
Paolo Giarrusso, aka Blaisorblade
http://www.user-mode-linux.org/~blaisorblade
Chiacchiera con i tuoi amici in tempo reale! 
 http://it.yahoo.com/mail_it/foot/*http://it.messenger.yahoo.com 


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel

  parent reply	other threads:[~2007-02-16 19:10 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20070215160001.GA6774@avocado.homenet>
2007-02-15 17:09 ` [uml-devel] [UML] fix crash in block layer Jeff Dike
2007-02-15 19:29   ` Blaisorblade
2007-02-16 17:02     ` Jason Lunz
2007-02-16 18:40       ` Jeff Dike
2007-02-19 22:28         ` Blaisorblade
2007-02-16 19:10       ` Blaisorblade [this message]
2007-02-09 22:01 Jason Lunz
  -- strict thread matches above, loose matches on Subject: below --
2007-02-09 21:30 Jason Lunz

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=200702162010.18776.blaisorblade@yahoo.it \
    --to=blaisorblade@yahoo.it \
    --cc=jdike@addtoit.com \
    --cc=jens.axboe@oracle.com \
    --cc=lunz@falooley.org \
    --cc=user-mode-linux-devel@lists.sourceforge.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox