All of lore.kernel.org
 help / color / mirror / Atom feed
* crash in page_list_* macro
@ 2009-02-12  3:42 Dan Magenheimer
  2009-02-12  8:38 ` Keir Fraser
  2009-02-12  9:11 ` Jan Beulich
  0 siblings, 2 replies; 4+ messages in thread
From: Dan Magenheimer @ 2009-02-12  3:42 UTC (permalink / raw)
  To: Xen-Devel (E-mail)

I can't make heads nor tails (pun intended) of how to use
the new page_list_* macros.  I have created a page_list
but at some point when I try to do a page_list_remove_head()
on the list (which, yes, had been initialized -- statically),
the list has been corrupted (causing a bad pointer dereference).

Is the memory where the list header is stored overloaded and
sometimes overwritten for other purposes?  Note all pages
on my page_list have been gotten via pi=alloc_domheap_pages(0,0,0).
Next I use va=page_to_virt(pi), use the page for awhile,
use pi=virt_to_page(va) and put it on the page_list, then
later when I page_list_remove_head(my_page_list), the
list pointers are apparently corrupt.

Any ideas?

Thanks,
Dan

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: crash in page_list_* macro
  2009-02-12  3:42 crash in page_list_* macro Dan Magenheimer
@ 2009-02-12  8:38 ` Keir Fraser
  2009-02-12  9:11 ` Jan Beulich
  1 sibling, 0 replies; 4+ messages in thread
From: Keir Fraser @ 2009-02-12  8:38 UTC (permalink / raw)
  To: Dan Magenheimer, Xen-Devel (E-mail)

On 12/02/2009 03:42, "Dan Magenheimer" <dan.magenheimer@oracle.com> wrote:

> Is the memory where the list header is stored overloaded and
> sometimes overwritten for other purposes?  Note all pages
> on my page_list have been gotten via pi=alloc_domheap_pages(0,0,0).
> Next I use va=page_to_virt(pi), use the page for awhile,
> use pi=virt_to_page(va) and put it on the page_list, then
> later when I page_list_remove_head(my_page_list), the
> list pointers are apparently corrupt.

So long as you allocate anonymous domheap memory, or xenheap memory, the
page_list fields should belong to you. The list structure is pretty simple
and I can't see anything wrong with the macros. An empty list is noted by
NULL head/tail pointers, otherwise point at head/tail pages within which
next/prev pointers are 32-bit MFNs. The head and tail pages do not point at
the page_list_head but instead contain ~0 sentinel next/prev link values.

 -- Keir

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: crash in page_list_* macro
  2009-02-12  3:42 crash in page_list_* macro Dan Magenheimer
  2009-02-12  8:38 ` Keir Fraser
@ 2009-02-12  9:11 ` Jan Beulich
  2009-02-13  0:12   ` Dan Magenheimer
  1 sibling, 1 reply; 4+ messages in thread
From: Jan Beulich @ 2009-02-12  9:11 UTC (permalink / raw)
  To: Dan Magenheimer; +Cc: Xen-Devel (E-mail)

>>> Dan Magenheimer <dan.magenheimer@oracle.com> 12.02.09 04:42 >>>
>Is the memory where the list header is stored overloaded and
>sometimes overwritten for other purposes?  Note all pages

The list headers are not overloaded in any way. The list entries do have
an overlay union field, used only by shadow code (so your code would
need to make use of it explicitly, which I doubt).

So according to your description of how you use the page I can't see any
potential for corruption.

Jan

^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: crash in page_list_* macro
  2009-02-12  9:11 ` Jan Beulich
@ 2009-02-13  0:12   ` Dan Magenheimer
  0 siblings, 0 replies; 4+ messages in thread
From: Dan Magenheimer @ 2009-02-13  0:12 UTC (permalink / raw)
  To: Jan Beulich, Keir Fraser, Xen-Devel (E-mail)

Thanks for the replies.

It seems it's not a good idea to put a page into a page_list
when it's already there (among thousands of other list
entries). :-} :-}  That resulted in all sorts of
interesting symptoms!  Took me all day to track down my
problem, but I think I nailed it.

Dan

> > Is the memory where the list header is stored overloaded and
> > sometimes overwritten for other purposes?  Note all pages
> > on my page_list have been gotten via pi=alloc_domheap_pages(0,0,0).
> > Next I use va=page_to_virt(pi), use the page for awhile,
> > use pi=virt_to_page(va) and put it on the page_list, then
> > later when I page_list_remove_head(my_page_list), the
> > list pointers are apparently corrupt.
> 
> So long as you allocate anonymous domheap memory, or xenheap 
> memory, the
> page_list fields should belong to you. The list structure is 
> pretty simple
> and I can't see anything wrong with the macros. An empty list 
> is noted by
> NULL head/tail pointers, otherwise point at head/tail pages 
> within which
> next/prev pointers are 32-bit MFNs. The head and tail pages 
> do not point at
> the page_list_head but instead contain ~0 sentinel next/prev 
> link values.
> 
>  -- Keir

> >>> Dan Magenheimer <dan.magenheimer@oracle.com> 12.02.09 04:42 >>>
> >Is the memory where the list header is stored overloaded and
> >sometimes overwritten for other purposes?  Note all pages
> 
> The list headers are not overloaded in any way. The list 
> entries do have
> an overlay union field, used only by shadow code (so your code would
> need to make use of it explicitly, which I doubt).
> 
> So according to your description of how you use the page I 
> can't see any
> potential for corruption.
> 
> Jan

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2009-02-13  0:12 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-02-12  3:42 crash in page_list_* macro Dan Magenheimer
2009-02-12  8:38 ` Keir Fraser
2009-02-12  9:11 ` Jan Beulich
2009-02-13  0:12   ` Dan Magenheimer

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.