ARM: cache coherence problem in guestcopy.c
Quoted 8 lines · Ian Campbell
Quoted 5 lines · Jaeyong Yoo
Quoted 4 lines
Quoted 2 lines
We were also speculating that we probably want some DMBs in context_switch_{from,to} as well as at
return_to_guest.Actually, I just learned ReOrder Buffer, and it looks like so.
Does this patch help with the issue you are seeing?
I tried the combinations and it does not work. I think my problem maybe stem from a different reason. Since this problem happens while
we try to migrate domU, something really weird may happen.
Actually, one of my colleage told me that this problem I'm having has been magically disappeared while he tried with copying more vcpu registers and lots of printks places to places. At this moment, I'm not sure that this is the common problem in xen or the problem due to poor migration, but I'm more believing that maybe it is due to the poor migration. Since I'm keep investigating tihs issue, I will tell you if anything turns out.
Quoted 4 lines
I think in theory it should *BUT* (and it's a big But)...
... it doesn't work for me on an issue I've been seeing booting dom0 on the Foundation model. However doing the dmb in
map_domain_page()*twice*
BTW, did you put barriers in map_domain_page? since the patch below looks like in unmap_domain_page.
Quoted 48 lines
does work for me. In fact doing a dmb+nop works too. This is inexplicable to me. It may be a model bug or it may (more likely) be indicative of some other underlying issue. I also tried
dsb()instead ofdmb()and that doesn't make a difference.Anyway, I'm interested about its behaviour on real hardware.
These are doing full system barriers. I think in reality only a "dmb nsh" should be needed for this use case, since we only care about the local processor. I didn't want to go there when the supposedly more obvious case wasn't doing as I expected!
Ian.
xen/arch/arm/mm.c +14
-0@@ -218,6 +218,13 @@ void *map_domain_page(unsigned long mfn)local_irq_save (flags); +/* +* Ensure that any previous writes which occurred via another +* mapping, specifically the guest's own mapping have been +* completed such that they are visible via this mapping. +*/ +dmb (); +/* The map is laid out as an open-addressed hash table where each * entry is a 2MB superpage pte. We use the available bits of each * PTE as a reference count; when the refcount is zero the slot can @@ -286,6 +297,13 @@ void unmap_domain_page(const void *va) map[slot].pt.avail--; +/* +* Ensure that any writes which occurred via this mapping have been +* completed such that they are visible via other virtual +* mappings, specifically the guest's own mapping. +*/ +dmb (); +local_irq_restore (flags); }
Quoted 10 lines · Jaeyong Yoo
Quoted 8 lines · Ian Campbell
Quoted 5 lines · Jaeyong Yoo
Quoted 4 lines
Quoted 2 lines
We were also speculating that we probably want some DMBs in context_switch_{from,to} as well as at
return_to_guest.Actually, I just learned ReOrder Buffer, and it looks like so.
Does this patch help with the issue you are seeing?
I tried the combinations and it does not work.
Thanks, this is useful to know. It may be that our analysis is simply flawed and something else it at work in both cases.
Quoted 7 lines
I think my problem maybe stem
from a different reason. Since this problem happens while we try to migrate domU, something really weird may happen.Actually, one of my colleage told me that this problem I'm having has been magically disappeared while he tried with copying more vcpu registers and lots of printks places to places.
printks change all sorts of things, like timing, their own use of barriers (e.g. in the serial driver) and simply adding more code which increases the gap in the instruction stream between memory accesses which might require a barrier such that the unwanted ordering no longer happens.
Quoted 4 lines
At this moment, I'm not sure that this is the
common problem in xen or the problem due to poor migration, but I'm more believing that maybe it is due to the poor migration. Since I'm keep investigating tihs issue, I will tell you if anything turns out.
Thanks.
Quoted 8 lines
Quoted 5 lines
I think in theory it should *BUT* (and it's a big But)...
... it doesn't work for me on an issue I've been seeing booting dom0 on the Foundation model. However doing the dmb in
map_domain_page()*twice*BTW, did you put barriers in
map_domain_page? since the patch below looks like inunmap_domain_page.
The first hunk is map_domain_page.
Quoted 11 lines
Quoted 11 lines
does work for me. In fact doing a dmb+nop works too. This is inexplicable to me. It may be a model bug or it may (more likely) be indicative of some other underlying issue. I also tried
dsb()instead ofdmb()and that doesn't make a difference.Anyway, I'm interested about its behaviour on real hardware.
These are doing full system barriers. I think in reality only a "dmb nsh" should be needed for this use case, since we only care about the local processor. I didn't want to go there when the supposedly more obvious case wasn't doing as I expected!
Quoted 10 lines · Jaeyong Yoo
Quoted 8 lines · Ian Campbell
Quoted 5 lines · Jaeyong Yoo
Quoted 4 lines
Quoted 2 lines
We were also speculating that we probably want some DMBs in context_switch_{from,to} as well as at
return_to_guest.Actually, I just learned ReOrder Buffer, and it looks like so.
Does this patch help with the issue you are seeing?
I tried the combinations and it does not work.
As an experiment can you try the same patch with dsb instead of dmb throughout?
Could you also try the patch from my series "xen: arm: map normal memory as inner shareable, reduce scope of various barriers" in <[email protected]>, speaking with ARM they reminded me that Xen currently uses Outer-shareable mappings while Linux uses Inner-, which is more than likely the root cause of the issue you are seeing. You probably want the dmb() patch as well to avoid speculative fetches.
Ian.
Quoted 6 lines · Ian Campbell
Quoted 5 lines · Jaeyong Yoo
Quoted 5 lines · Ian Campbell
Quoted 4 lines · Jaeyong Yoo
Quoted 3 lines
Quoted 2 lines
We were also speculating that we probably want some DMBs in context_switch_{from,to} as well as at
return_to_guest.
Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
Quoted 1 line
Quoted 1 line
Actually, I just learned ReOrder Buffer, and it looks like so.
Does this patch help with the issue you are seeing?
I tried the combinations and it does not work.
As an experiment can you try the same patch with dsb instead of dmb throughout?
I tried several ways to recreate the problem I was having, but I failed. I was having
that problem with some printks place to place, and sadly, I don't remember the printk positions.
I'm sorry.
Jaeyong
Quoted 16 lines
Could you also try the patch from my series "xen: arm: map normal memory as inner shareable, reduce scope of various barriers" in <[email protected]>, speaking with ARM they reminded me that Xen currently uses Outer-shareable mappings while Linux uses Inner-, which is more than likely the root cause of the issue you are seeing. You probably want the
dmb()patch as well to avoid speculative fetches.Ian.
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Quoted 7 lines
I tried several ways to recreate the problem I was having, but I failed. I was having
that problem with some printks place to place, and sadly, I don't remember the printk positions.
I'm sorry.Jaeyong
BTW, [email protected] is my personal email and [email protected] is my work-email.
For posting patches, I use my work-email.
It is quite confusing. Sorry :)
Jaeyong/Thomas
Quoted 13 lines · Sengul Thomas
Quoted 12 lines · Ian Campbell
Quoted 10 lines · Jaeyong Yoo
Quoted 8 lines · Ian Campbell
Quoted 5 lines · Jaeyong Yoo
Quoted 4 lines
Quoted 2 lines
We were also speculating that we probably want some DMBs in context_switch_{from,to} as well as at
return_to_guest.Actually, I just learned ReOrder Buffer, and it looks like so.
Does this patch help with the issue you are seeing?
I tried the combinations and it does not work.
Quoted 8 lines
Quoted 2 lines
As an experiment can you try the same patch with dsb instead of dmb throughout?
I tried several ways to recreate the problem I was having, but I failed. I was having
that problem with some printks place to place, and sadly, I don't remember the printk positions.
I'm sorry.
Oh yes, I'd forgotten that you weren't able to reproduce any more.
Oh well, I think the switch to Inner-shareable mappings in Xen is likely to remove the issue and I think the justification for the dmb patch in (un)map_domain_page is pretty good. So hopefully this issue will just go away for good once we apply those (and if not we can always reinvestigate).
Quoted 19 lines
Jaeyong
Quoted 16 lines
Could you also try the patch from my series "xen: arm: map normal memory as inner shareable, reduce scope of various barriers" in <[email protected]>, speaking with ARM they reminded me that Xen currently uses Outer-shareable mappings while Linux uses Inner-, which is more than likely the root cause of the issue you are seeing. You probably want the
dmb()patch as well to avoid speculative fetches.Ian.
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Quoted 5 lines
Oh well, I think the switch to Inner-shareable mappings in Xen is likely to remove the issue and I think the justification for the dmb patch in (un)map_domain_page is pretty good. So hopefully this issue will just go away for good once we apply those. (and if not we can always reinvestigate).
Of course yes. If I ran into the similar bug, I will try the patches.
Jaeyong