qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH v1] kvm: drop wrong assertion creating problems with pflash
@ 2017-09-20 14:50 David Hildenbrand
  2017-09-21  6:49 ` Gerd Hoffmann
  0 siblings, 1 reply; 3+ messages in thread
From: David Hildenbrand @ 2017-09-20 14:50 UTC (permalink / raw)
  To: qemu-devel
  Cc: Paolo Bonzini, Radim Krčmář, kvm, david,
	Gerd Hoffmann

pflash toggles mr->romd_mode. So this assert does not always hold.

1) a device was added with !mr->romd_mode, therefore effectively not
   creating a kvm slot as we want to trap every access (add = false).
2) mr->romd_mode was toggled on before remove it. There is now
   actually no slot to remove and the asser is wrong.

So let's just drop the assert.

Reported-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: David Hildenbrand <david@redhat.com>
---
 accel/kvm/kvm-all.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c
index b0181d7220..4f1997deec 100644
--- a/accel/kvm/kvm-all.c
+++ b/accel/kvm/kvm-all.c
@@ -722,7 +722,6 @@ static void kvm_set_phys_mem(KVMMemoryListener *kml,
     mem = kvm_lookup_matching_slot(kml, start_addr, size);
     if (!add) {
         if (!mem) {
-            g_assert(!memory_region_is_ram(mr) && !writeable && !mr->romd_mode);
             return;
         }
         if (mem->flags & KVM_MEM_LOG_DIRTY_PAGES) {
-- 
2.13.5

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

* Re: [Qemu-devel] [PATCH v1] kvm: drop wrong assertion creating problems with pflash
  2017-09-20 14:50 [Qemu-devel] [PATCH v1] kvm: drop wrong assertion creating problems with pflash David Hildenbrand
@ 2017-09-21  6:49 ` Gerd Hoffmann
  2017-09-21 10:34   ` Paolo Bonzini
  0 siblings, 1 reply; 3+ messages in thread
From: Gerd Hoffmann @ 2017-09-21  6:49 UTC (permalink / raw)
  To: David Hildenbrand, qemu-devel
  Cc: Paolo Bonzini, Radim Krčmář, kvm

On Wed, 2017-09-20 at 16:50 +0200, David Hildenbrand wrote:
> pflash toggles mr->romd_mode. So this assert does not always hold.
> 
> 1) a device was added with !mr->romd_mode, therefore effectively not
>    creating a kvm slot as we want to trap every access (add = false).
> 2) mr->romd_mode was toggled on before remove it. There is now
>    actually no slot to remove and the asser is wrong.
> 
> So let's just drop the assert.

Works without any obvious bad side effects.

Tested-by: Gerd Hoffmann <kraxel@redhat.com>

cheers,
  Gerd

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

* Re: [Qemu-devel] [PATCH v1] kvm: drop wrong assertion creating problems with pflash
  2017-09-21  6:49 ` Gerd Hoffmann
@ 2017-09-21 10:34   ` Paolo Bonzini
  0 siblings, 0 replies; 3+ messages in thread
From: Paolo Bonzini @ 2017-09-21 10:34 UTC (permalink / raw)
  To: Gerd Hoffmann, David Hildenbrand, qemu-devel
  Cc: Radim Krčmář, kvm

On 21/09/2017 08:49, Gerd Hoffmann wrote:
> On Wed, 2017-09-20 at 16:50 +0200, David Hildenbrand wrote:
>> pflash toggles mr->romd_mode. So this assert does not always hold.
>>
>> 1) a device was added with !mr->romd_mode, therefore effectively not
>>    creating a kvm slot as we want to trap every access (add = false).
>> 2) mr->romd_mode was toggled on before remove it. There is now
>>    actually no slot to remove and the asser is wrong.
>>
>> So let's just drop the assert.
> 
> Works without any obvious bad side effects.
> 
> Tested-by: Gerd Hoffmann <kraxel@redhat.com>

Queued, thanks.

Paolo

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

end of thread, other threads:[~2017-09-21 10:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-09-20 14:50 [Qemu-devel] [PATCH v1] kvm: drop wrong assertion creating problems with pflash David Hildenbrand
2017-09-21  6:49 ` Gerd Hoffmann
2017-09-21 10:34   ` Paolo Bonzini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).