qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] translate-all: fix locking of TBs whose two pag


From: Emilio G. Cota
Subject: Re: [Qemu-devel] [PATCH] translate-all: fix locking of TBs whose two pages share the same physical page
Date: Wed, 27 Jun 2018 12:47:57 -0400
User-agent: Mutt/1.5.24 (2015-08-30)

On Tue, Jun 26, 2018 at 19:28:19 -0700, Richard Henderson wrote:
> On 06/25/2018 09:31 AM, Emilio G. Cota wrote:
> > +    } else if (page1 == page2) {
> > +        page_lock(p1);
> > +        if (ret_p2) {
> > +            *ret_p2 = p1;
> 
> I think you should set NULL here...
> 
> > @@ -1623,7 +1641,7 @@ tb_link_page(TranslationBlock *tb, tb_page_addr_t 
> > phys_pc,
> >          tb = existing_tb;
> >      }
> >  
> > -    if (p2) {
> > +    if (p2 && p2 != p) {
> >          page_unlock(p2);
> 
> ... so that you need no change here.
> Otherwise it looks good.

I did that initially. However, note that if we do that then
the second page is not added to the list of pages for this
TB (via tb_page_add), which breaks the provided test case.

    page_lock_pair(&p, phys_pc, &p2, phys_page2, 1);
    tb_page_add(p, tb, 0, phys_pc & TARGET_PAGE_MASK);
    if (p2) {
        tb_page_add(p2, tb, 1, phys_page2);
    } else {
        tb->page_addr[1] = -1;
    }

Regardless of whether p1 and p2 point to the same physical page,
the fact that the TB goes across two virtual pages should be
preserved, and in this case tb_page_add must be called twice.

Thanks,

                Emilio



reply via email to

[Prev in Thread] Current Thread [Next in Thread]