All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PULL] Memory core regression fixes
@ 2012-03-19  9:40 Avi Kivity
  2012-03-19 17:15 ` Avi Kivity
  2012-03-19 18:12 ` Anthony Liguori
  0 siblings, 2 replies; 5+ messages in thread
From: Avi Kivity @ 2012-03-19  9:40 UTC (permalink / raw)
  To: qemu-devel, Anthony Liguori, Blue Swirl

The last memory core pull introduced a couple of regressions; here are
the fixes.

Please pull from:

  git://git.kernel.org/pub/scm/virt/kvm/qemu-kvm.git memory/urgent

----------------------------------------------------------------
Avi Kivity (2):
      exec: fix write tlb entry misused as iotlb
      memory: check for watchpoints when getting code ram_addr

 exec.c |   14 ++++++++++----
 1 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/exec.c b/exec.c
index be392e2..a3818ff 100644
--- a/exec.c
+++ b/exec.c
@@ -2031,14 +2031,19 @@ static void tlb_unprotect_code_phys(CPUArchState
*env, ram_addr_t ram_addr,
     cpu_physical_memory_set_dirty_flags(ram_addr, CODE_DIRTY_FLAG);
 }
 
+static bool tlb_is_dirty_ram(CPUTLBEntry *tlbe)
+{
+    return (tlbe->addr_write &
(TLB_INVALID_MASK|TLB_MMIO|TLB_NOTDIRTY)) == 0;
+}
+
 static inline void tlb_reset_dirty_range(CPUTLBEntry *tlb_entry,
                                          unsigned long start, unsigned
long length)
 {
     unsigned long addr;
-    if ((tlb_entry->addr_write & ~TARGET_PAGE_MASK) ==
io_mem_ram.ram_addr) {
+    if (tlb_is_dirty_ram(tlb_entry)) {
         addr = (tlb_entry->addr_write & TARGET_PAGE_MASK) +
tlb_entry->addend;
         if ((addr - start) < length) {
-            tlb_entry->addr_write = (tlb_entry->addr_write &
TARGET_PAGE_MASK) | TLB_NOTDIRTY;
+            tlb_entry->addr_write |= TLB_NOTDIRTY;
         }
     }
 }
@@ -2091,7 +2096,7 @@ static inline void tlb_update_dirty(CPUTLBEntry
*tlb_entry)
     ram_addr_t ram_addr;
     void *p;
 
-    if ((tlb_entry->addr_write & ~TARGET_PAGE_MASK) ==
io_mem_ram.ram_addr) {
+    if (tlb_is_dirty_ram(tlb_entry)) {
         p = (void *)(unsigned long)((tlb_entry->addr_write &
TARGET_PAGE_MASK)
             + tlb_entry->addend);
         ram_addr = qemu_ram_addr_from_host_nofail(p);
@@ -4604,7 +4609,8 @@ tb_page_addr_t get_page_addr_code(CPUArchState
*env1, target_ulong addr)
     pd = env1->iotlb[mmu_idx][page_index] & ~TARGET_PAGE_MASK;
     mr = iotlb_to_region(pd);
     if (mr != &io_mem_ram && mr != &io_mem_rom
-        && mr != &io_mem_notdirty && !mr->rom_device) {
+        && mr != &io_mem_notdirty && !mr->rom_device
+        && mr != &io_mem_watch) {
 #if defined(TARGET_ALPHA) || defined(TARGET_MIPS) || defined(TARGET_SPARC)
         cpu_unassigned_access(env1, addr, 0, 1, 0, 4);
 #else

-- 
error compiling committee.c: too many arguments to function

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

* Re: [Qemu-devel] [PULL] Memory core regression fixes
  2012-03-19  9:40 [Qemu-devel] [PULL] Memory core regression fixes Avi Kivity
@ 2012-03-19 17:15 ` Avi Kivity
  2012-03-19 17:18   ` Anthony Liguori
  2012-03-19 21:16   ` Anthony Liguori
  2012-03-19 18:12 ` Anthony Liguori
  1 sibling, 2 replies; 5+ messages in thread
From: Avi Kivity @ 2012-03-19 17:15 UTC (permalink / raw)
  To: qemu-devel, Anthony Liguori, Blue Swirl

On 03/19/2012 11:40 AM, Avi Kivity wrote:
> The last memory core pull introduced a couple of regressions; here are
> the fixes.
>
> Please pull from:
>
>   git://git.kernel.org/pub/scm/virt/kvm/qemu-kvm.git memory/urgent
>

I've tacked on another patch to this branch, fixing a xen regression:

commit 0a1b357f1555ce410d2d0d5f947b5415587ac4d8
Author: Anthony PERARD <anthony.perard@citrix.com>
Date:   Mon Mar 19 15:54:34 2012 +0000

    exec: fix guest memory access for Xen
   
    In cpu_physical_memory_rw, a change has been introduced and
qemu_get_ram_ptr is
    no longuer called with the ram addr we want to access, but only with the
    section address. This patch fixes this. (All other call to
qemu_get_ram_ptr are
    already called with the right address.)
   
    This patch fixes Xen guest.
   
    Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
    Signed-off-by: Avi Kivity <avi@redhat.com>

diff --git a/exec.c b/exec.c
index a3818ff..265e895 100644
--- a/exec.c
+++ b/exec.c
@@ -3856,8 +3856,8 @@ void cpu_physical_memory_rw(target_phys_addr_t
addr, uint8_t *buf,
                 }
             } else {
                 /* RAM case */
-                ptr = qemu_get_ram_ptr(section->mr->ram_addr)
-                    + section_addr(section, addr);
+                ptr = qemu_get_ram_ptr(section->mr->ram_addr
+                                       + section_addr(section, addr));
                 memcpy(buf, ptr, l);
                 qemu_put_ram_ptr(ptr);
             }

-- 
error compiling committee.c: too many arguments to function

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

* Re: [Qemu-devel] [PULL] Memory core regression fixes
  2012-03-19 17:15 ` Avi Kivity
@ 2012-03-19 17:18   ` Anthony Liguori
  2012-03-19 21:16   ` Anthony Liguori
  1 sibling, 0 replies; 5+ messages in thread
From: Anthony Liguori @ 2012-03-19 17:18 UTC (permalink / raw)
  To: Avi Kivity; +Cc: Blue Swirl, qemu-devel

On 03/19/2012 12:15 PM, Avi Kivity wrote:
> On 03/19/2012 11:40 AM, Avi Kivity wrote:
>> The last memory core pull introduced a couple of regressions; here are
>> the fixes.
>>
>> Please pull from:
>>
>>    git://git.kernel.org/pub/scm/virt/kvm/qemu-kvm.git memory/urgent
>>
>
> I've tacked on another patch to this branch, fixing a xen regression:

I'm become a bigger fan of not using a single branch for pull requests and 
instead doing what Gerd does an use a monotonically increasing branch.  For 
instance:

memory/urgent.1
memory/urgent.2
...

It avoids confusion caused by situations like this because you can immediately 
submit another PULL request if needed and I can just ignore the last one without 
fear of race conditions.

At any rate, I'm going to handle this as a separate merge as your previous pull 
is about to be pushed.

Regards,

Anthony Liguori

>
> commit 0a1b357f1555ce410d2d0d5f947b5415587ac4d8
> Author: Anthony PERARD<anthony.perard@citrix.com>
> Date:   Mon Mar 19 15:54:34 2012 +0000
>
>      exec: fix guest memory access for Xen
>
>      In cpu_physical_memory_rw, a change has been introduced and
> qemu_get_ram_ptr is
>      no longuer called with the ram addr we want to access, but only with the
>      section address. This patch fixes this. (All other call to
> qemu_get_ram_ptr are
>      already called with the right address.)
>
>      This patch fixes Xen guest.
>
>      Signed-off-by: Anthony PERARD<anthony.perard@citrix.com>
>      Signed-off-by: Avi Kivity<avi@redhat.com>
>
> diff --git a/exec.c b/exec.c
> index a3818ff..265e895 100644
> --- a/exec.c
> +++ b/exec.c
> @@ -3856,8 +3856,8 @@ void cpu_physical_memory_rw(target_phys_addr_t
> addr, uint8_t *buf,
>                   }
>               } else {
>                   /* RAM case */
> -                ptr = qemu_get_ram_ptr(section->mr->ram_addr)
> -                    + section_addr(section, addr);
> +                ptr = qemu_get_ram_ptr(section->mr->ram_addr
> +                                       + section_addr(section, addr));
>                   memcpy(buf, ptr, l);
>                   qemu_put_ram_ptr(ptr);
>               }
>

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

* Re: [Qemu-devel] [PULL] Memory core regression fixes
  2012-03-19  9:40 [Qemu-devel] [PULL] Memory core regression fixes Avi Kivity
  2012-03-19 17:15 ` Avi Kivity
@ 2012-03-19 18:12 ` Anthony Liguori
  1 sibling, 0 replies; 5+ messages in thread
From: Anthony Liguori @ 2012-03-19 18:12 UTC (permalink / raw)
  To: Avi Kivity; +Cc: Blue Swirl, qemu-devel

On 03/19/2012 04:40 AM, Avi Kivity wrote:
> The last memory core pull introduced a couple of regressions; here are
> the fixes.
>
> Please pull from:
>
>    git://git.kernel.org/pub/scm/virt/kvm/qemu-kvm.git memory/urgent

Pulled this specific commit.  Will handle the next commit next.  Thanks.

Regards,

Anthony Liguori

>
> ----------------------------------------------------------------
> Avi Kivity (2):
>        exec: fix write tlb entry misused as iotlb
>        memory: check for watchpoints when getting code ram_addr
>
>   exec.c |   14 ++++++++++----
>   1 files changed, 10 insertions(+), 4 deletions(-)
>
> diff --git a/exec.c b/exec.c
> index be392e2..a3818ff 100644
> --- a/exec.c
> +++ b/exec.c
> @@ -2031,14 +2031,19 @@ static void tlb_unprotect_code_phys(CPUArchState
> *env, ram_addr_t ram_addr,
>       cpu_physical_memory_set_dirty_flags(ram_addr, CODE_DIRTY_FLAG);
>   }
>
> +static bool tlb_is_dirty_ram(CPUTLBEntry *tlbe)
> +{
> +    return (tlbe->addr_write&
> (TLB_INVALID_MASK|TLB_MMIO|TLB_NOTDIRTY)) == 0;
> +}
> +
>   static inline void tlb_reset_dirty_range(CPUTLBEntry *tlb_entry,
>                                            unsigned long start, unsigned
> long length)
>   {
>       unsigned long addr;
> -    if ((tlb_entry->addr_write&  ~TARGET_PAGE_MASK) ==
> io_mem_ram.ram_addr) {
> +    if (tlb_is_dirty_ram(tlb_entry)) {
>           addr = (tlb_entry->addr_write&  TARGET_PAGE_MASK) +
> tlb_entry->addend;
>           if ((addr - start)<  length) {
> -            tlb_entry->addr_write = (tlb_entry->addr_write&
> TARGET_PAGE_MASK) | TLB_NOTDIRTY;
> +            tlb_entry->addr_write |= TLB_NOTDIRTY;
>           }
>       }
>   }
> @@ -2091,7 +2096,7 @@ static inline void tlb_update_dirty(CPUTLBEntry
> *tlb_entry)
>       ram_addr_t ram_addr;
>       void *p;
>
> -    if ((tlb_entry->addr_write&  ~TARGET_PAGE_MASK) ==
> io_mem_ram.ram_addr) {
> +    if (tlb_is_dirty_ram(tlb_entry)) {
>           p = (void *)(unsigned long)((tlb_entry->addr_write&
> TARGET_PAGE_MASK)
>               + tlb_entry->addend);
>           ram_addr = qemu_ram_addr_from_host_nofail(p);
> @@ -4604,7 +4609,8 @@ tb_page_addr_t get_page_addr_code(CPUArchState
> *env1, target_ulong addr)
>       pd = env1->iotlb[mmu_idx][page_index]&  ~TARGET_PAGE_MASK;
>       mr = iotlb_to_region(pd);
>       if (mr !=&io_mem_ram&&  mr !=&io_mem_rom
> -&&  mr !=&io_mem_notdirty&&  !mr->rom_device) {
> +&&  mr !=&io_mem_notdirty&&  !mr->rom_device
> +&&  mr !=&io_mem_watch) {
>   #if defined(TARGET_ALPHA) || defined(TARGET_MIPS) || defined(TARGET_SPARC)
>           cpu_unassigned_access(env1, addr, 0, 1, 0, 4);
>   #else
>

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

* Re: [Qemu-devel] [PULL] Memory core regression fixes
  2012-03-19 17:15 ` Avi Kivity
  2012-03-19 17:18   ` Anthony Liguori
@ 2012-03-19 21:16   ` Anthony Liguori
  1 sibling, 0 replies; 5+ messages in thread
From: Anthony Liguori @ 2012-03-19 21:16 UTC (permalink / raw)
  To: Avi Kivity; +Cc: Blue Swirl, qemu-devel

On 03/19/2012 12:15 PM, Avi Kivity wrote:
> On 03/19/2012 11:40 AM, Avi Kivity wrote:
>> The last memory core pull introduced a couple of regressions; here are
>> the fixes.
>>
>> Please pull from:
>>
>>    git://git.kernel.org/pub/scm/virt/kvm/qemu-kvm.git memory/urgent
>>
>
> I've tacked on another patch to this branch, fixing a xen regression:
>
> commit 0a1b357f1555ce410d2d0d5f947b5415587ac4d8
> Author: Anthony PERARD<anthony.perard@citrix.com>
> Date:   Mon Mar 19 15:54:34 2012 +0000
>
>      exec: fix guest memory access for Xen
>
>      In cpu_physical_memory_rw, a change has been introduced and
> qemu_get_ram_ptr is
>      no longuer called with the ram addr we want to access, but only with the
>      section address. This patch fixes this. (All other call to
> qemu_get_ram_ptr are
>      already called with the right address.)
>
>      This patch fixes Xen guest.
>
>      Signed-off-by: Anthony PERARD<anthony.perard@citrix.com>
>      Signed-off-by: Avi Kivity<avi@redhat.com>

Pulled this too.  Thanks.

Regards,

Anthony Liguori

>
> diff --git a/exec.c b/exec.c
> index a3818ff..265e895 100644
> --- a/exec.c
> +++ b/exec.c
> @@ -3856,8 +3856,8 @@ void cpu_physical_memory_rw(target_phys_addr_t
> addr, uint8_t *buf,
>                   }
>               } else {
>                   /* RAM case */
> -                ptr = qemu_get_ram_ptr(section->mr->ram_addr)
> -                    + section_addr(section, addr);
> +                ptr = qemu_get_ram_ptr(section->mr->ram_addr
> +                                       + section_addr(section, addr));
>                   memcpy(buf, ptr, l);
>                   qemu_put_ram_ptr(ptr);
>               }
>

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

end of thread, other threads:[~2012-03-19 21:16 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-03-19  9:40 [Qemu-devel] [PULL] Memory core regression fixes Avi Kivity
2012-03-19 17:15 ` Avi Kivity
2012-03-19 17:18   ` Anthony Liguori
2012-03-19 21:16   ` Anthony Liguori
2012-03-19 18:12 ` Anthony Liguori

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.