[{"id":1783532,"web_url":"http://patchwork.ozlabs.org/comment/1783532/","msgid":"<7bf188b3-3c35-97ef-f67d-7ffabe45c4a1@redhat.com>","list_archive_url":null,"date":"2017-10-10T09:06:04","subject":"Re: [Qemu-devel] [PATCH v1 5/6] kvm: kvm_log_start/stop are only\n\tcalled with known sections","submitter":{"id":66152,"url":"http://patchwork.ozlabs.org/api/people/66152/","name":"Thomas Huth","email":"thuth@redhat.com"},"content":"On 11.09.2017 19:49, David Hildenbrand wrote:\n> Let's properly align the sections first and bail out if we would ever\n> get called with a memory section we don't know yet.\n> \n> Signed-off-by: David Hildenbrand <david@redhat.com>\n> ---\n>  accel/kvm/kvm-all.c | 18 ++++++++++++------\n>  1 file changed, 12 insertions(+), 6 deletions(-)\n> \n> diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c\n> index b677d1b13e..2ae459453d 100644\n> --- a/accel/kvm/kvm-all.c\n> +++ b/accel/kvm/kvm-all.c\n> @@ -411,15 +411,21 @@ static int kvm_slot_update_flags(KVMMemoryListener *kml, KVMSlot *mem,\n>  static int kvm_section_update_flags(KVMMemoryListener *kml,\n>                                      MemoryRegionSection *section)\n>  {\n> -    hwaddr phys_addr = section->offset_within_address_space;\n> -    ram_addr_t size = int128_get64(section->size);\n> -    KVMSlot *mem = kvm_lookup_matching_slot(kml, phys_addr, size);\n> +    hwaddr start_addr, size;\n> +    KVMSlot *mem;\n>  \n> -    if (mem == NULL)  {\n> +    size = kvm_align_section(section, &start_addr);\n> +    if (!size) {\n>          return 0;\n> -    } else {\n> -        return kvm_slot_update_flags(kml, mem, section->mr);\n>      }\n> +\n> +    mem = kvm_lookup_matching_slot(kml, start_addr, size);\n> +    if (!mem) {\n> +        fprintf(stderr, \"%s: error finding slot\\n\", __func__);\n> +        abort();\n> +    }\n\nFYI, this abort now triggers with the \"isa-vga\" device:\n\n$ x86_64-softmmu/qemu-system-x86_64 -S -accel kvm -device isa-vga\nkvm_section_update_flags: error finding slot\nAborted (core dumped)\n\nAny ideas how to fix this?\n\n Thomas","headers":{"Return-Path":"<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":["ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=nongnu.org\n\t(client-ip=2001:4830:134:3::11; helo=lists.gnu.org;\n\tenvelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n\treceiver=<UNKNOWN>)","ext-mx02.extmail.prod.ext.phx2.redhat.com;\n\tdmarc=none (p=none dis=none) header.from=redhat.com","ext-mx02.extmail.prod.ext.phx2.redhat.com;\n\tspf=fail smtp.mailfrom=thuth@redhat.com"],"Received":["from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11])\n\t(using TLSv1 with cipher AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3yBB7r5XSWz9rvt\n\tfor <incoming@patchwork.ozlabs.org>;\n\tTue, 10 Oct 2017 20:07:02 +1100 (AEDT)","from localhost ([::1]:33630 helo=lists.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.71) (envelope-from\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>)\n\tid 1e1qV9-0003Q4-Sc\n\tfor incoming@patchwork.ozlabs.org; Tue, 10 Oct 2017 05:06:59 -0400","from eggs.gnu.org ([2001:4830:134:3::10]:33668)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <thuth@redhat.com>) id 1e1qUU-0003Mq-UJ\n\tfor qemu-devel@nongnu.org; Tue, 10 Oct 2017 05:06:24 -0400","from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <thuth@redhat.com>) id 1e1qUP-0001R1-Td\n\tfor qemu-devel@nongnu.org; Tue, 10 Oct 2017 05:06:18 -0400","from mx1.redhat.com ([209.132.183.28]:45460)\n\tby eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)\n\t(Exim 4.71) (envelope-from <thuth@redhat.com>) id 1e1qUP-0001QM-N3\n\tfor qemu-devel@nongnu.org; Tue, 10 Oct 2017 05:06:13 -0400","from smtp.corp.redhat.com\n\t(int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16])\n\t(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby mx1.redhat.com (Postfix) with ESMTPS id 71724883C3;\n\tTue, 10 Oct 2017 09:06:12 +0000 (UTC)","from [10.36.116.161] (ovpn-116-161.ams2.redhat.com [10.36.116.161])\n\tby smtp.corp.redhat.com (Postfix) with ESMTPS id 69A835C892;\n\tTue, 10 Oct 2017 09:06:08 +0000 (UTC)"],"DMARC-Filter":"OpenDMARC Filter v1.3.2 mx1.redhat.com 71724883C3","To":"David Hildenbrand <david@redhat.com>, qemu-devel@nongnu.org","References":"<20170911174933.20789-1-david@redhat.com>\n\t<20170911174933.20789-6-david@redhat.com>","From":"Thomas Huth <thuth@redhat.com>","Message-ID":"<7bf188b3-3c35-97ef-f67d-7ffabe45c4a1@redhat.com>","Date":"Tue, 10 Oct 2017 11:06:04 +0200","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101\n\tThunderbird/52.3.0","MIME-Version":"1.0","In-Reply-To":"<20170911174933.20789-6-david@redhat.com>","Content-Type":"text/plain; charset=utf-8","Content-Language":"en-US","Content-Transfer-Encoding":"7bit","X-Scanned-By":"MIMEDefang 2.79 on 10.5.11.16","X-Greylist":"Sender IP whitelisted, not delayed by milter-greylist-4.5.16\n\t(mx1.redhat.com [10.5.110.26]);\n\tTue, 10 Oct 2017 09:06:12 +0000 (UTC)","X-detected-operating-system":"by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]\n\t[fuzzy]","X-Received-From":"209.132.183.28","Subject":"Re: [Qemu-devel] [PATCH v1 5/6] kvm: kvm_log_start/stop are only\n\tcalled with known sections","X-BeenThere":"qemu-devel@nongnu.org","X-Mailman-Version":"2.1.21","Precedence":"list","List-Id":"<qemu-devel.nongnu.org>","List-Unsubscribe":"<https://lists.nongnu.org/mailman/options/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>","List-Archive":"<http://lists.nongnu.org/archive/html/qemu-devel/>","List-Post":"<mailto:qemu-devel@nongnu.org>","List-Help":"<mailto:qemu-devel-request@nongnu.org?subject=help>","List-Subscribe":"<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=subscribe>","Cc":"Paolo Bonzini <pbonzini@redhat.com>, kvm@vger.kernel.org, =?utf-8?q?Ra?=\n\t=?utf-8?b?ZGltIEtyxI1tw6HFmQ==?= <rkrcmar@redhat.com>","Errors-To":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org","Sender":"\"Qemu-devel\"\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>"}},{"id":1783725,"web_url":"http://patchwork.ozlabs.org/comment/1783725/","msgid":"<f6eb7866-3df7-e420-5b84-6d3caf052413@redhat.com>","list_archive_url":null,"date":"2017-10-10T13:29:11","subject":"Re: [Qemu-devel] [PATCH v1 5/6] kvm: kvm_log_start/stop are only\n\tcalled with known sections","submitter":{"id":2701,"url":"http://patchwork.ozlabs.org/api/people/2701/","name":"Paolo Bonzini","email":"pbonzini@redhat.com"},"content":"On 10/10/2017 11:06, Thomas Huth wrote:\n> On 11.09.2017 19:49, David Hildenbrand wrote:\n>> Let's properly align the sections first and bail out if we would ever\n>> get called with a memory section we don't know yet.\n>>\n>> Signed-off-by: David Hildenbrand <david@redhat.com>\n>> ---\n>>  accel/kvm/kvm-all.c | 18 ++++++++++++------\n>>  1 file changed, 12 insertions(+), 6 deletions(-)\n>>\n>> diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c\n>> index b677d1b13e..2ae459453d 100644\n>> --- a/accel/kvm/kvm-all.c\n>> +++ b/accel/kvm/kvm-all.c\n>> @@ -411,15 +411,21 @@ static int kvm_slot_update_flags(KVMMemoryListener *kml, KVMSlot *mem,\n>>  static int kvm_section_update_flags(KVMMemoryListener *kml,\n>>                                      MemoryRegionSection *section)\n>>  {\n>> -    hwaddr phys_addr = section->offset_within_address_space;\n>> -    ram_addr_t size = int128_get64(section->size);\n>> -    KVMSlot *mem = kvm_lookup_matching_slot(kml, phys_addr, size);\n>> +    hwaddr start_addr, size;\n>> +    KVMSlot *mem;\n>>  \n>> -    if (mem == NULL)  {\n>> +    size = kvm_align_section(section, &start_addr);\n>> +    if (!size) {\n>>          return 0;\n>> -    } else {\n>> -        return kvm_slot_update_flags(kml, mem, section->mr);\n>>      }\n>> +\n>> +    mem = kvm_lookup_matching_slot(kml, start_addr, size);\n>> +    if (!mem) {\n>> +        fprintf(stderr, \"%s: error finding slot\\n\", __func__);\n>> +        abort();\n>> +    }\n> \n> FYI, this abort now triggers with the \"isa-vga\" device:\n> \n> $ x86_64-softmmu/qemu-system-x86_64 -S -accel kvm -device isa-vga\n> kvm_section_update_flags: error finding slot\n> Aborted (core dumped)\n> \n> Any ideas how to fix this?\n\nReverting, unless David has some time to look into it.\n\nPaolo","headers":{"Return-Path":"<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":["ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=nongnu.org\n\t(client-ip=2001:4830:134:3::11; helo=lists.gnu.org;\n\tenvelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n\treceiver=<UNKNOWN>)","ext-mx07.extmail.prod.ext.phx2.redhat.com;\n\tdmarc=none (p=none dis=none) header.from=redhat.com","ext-mx07.extmail.prod.ext.phx2.redhat.com;\n\tspf=fail smtp.mailfrom=pbonzini@redhat.com"],"Received":["from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11])\n\t(using TLSv1 with cipher AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3yBHyx411zz9tYN\n\tfor <incoming@patchwork.ozlabs.org>;\n\tWed, 11 Oct 2017 00:29:45 +1100 (AEDT)","from localhost ([::1]:35097 helo=lists.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.71) (envelope-from\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>)\n\tid 1e1ubP-0006S2-KA\n\tfor incoming@patchwork.ozlabs.org; Tue, 10 Oct 2017 09:29:43 -0400","from eggs.gnu.org ([2001:4830:134:3::10]:58103)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <pbonzini@redhat.com>) id 1e1ub6-0006Rv-2e\n\tfor qemu-devel@nongnu.org; Tue, 10 Oct 2017 09:29:24 -0400","from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <pbonzini@redhat.com>) id 1e1ub1-0007dD-5T\n\tfor qemu-devel@nongnu.org; Tue, 10 Oct 2017 09:29:24 -0400","from mx1.redhat.com ([209.132.183.28]:10518)\n\tby eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)\n\t(Exim 4.71) (envelope-from <pbonzini@redhat.com>) id 1e1ub0-0007cw-Uq\n\tfor qemu-devel@nongnu.org; Tue, 10 Oct 2017 09:29:19 -0400","from smtp.corp.redhat.com\n\t(int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12])\n\t(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby mx1.redhat.com (Postfix) with ESMTPS id E897EC04AC71;\n\tTue, 10 Oct 2017 13:29:17 +0000 (UTC)","from [10.36.117.201] (ovpn-117-201.ams2.redhat.com [10.36.117.201])\n\tby smtp.corp.redhat.com (Postfix) with ESMTPS id 7A0EC60F80;\n\tTue, 10 Oct 2017 13:29:13 +0000 (UTC)"],"DMARC-Filter":"OpenDMARC Filter v1.3.2 mx1.redhat.com E897EC04AC71","To":"Thomas Huth <thuth@redhat.com>, David Hildenbrand <david@redhat.com>,\n\tqemu-devel@nongnu.org","References":"<20170911174933.20789-1-david@redhat.com>\n\t<20170911174933.20789-6-david@redhat.com>\n\t<7bf188b3-3c35-97ef-f67d-7ffabe45c4a1@redhat.com>","From":"Paolo Bonzini <pbonzini@redhat.com>","Message-ID":"<f6eb7866-3df7-e420-5b84-6d3caf052413@redhat.com>","Date":"Tue, 10 Oct 2017 15:29:11 +0200","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101\n\tThunderbird/52.3.0","MIME-Version":"1.0","In-Reply-To":"<7bf188b3-3c35-97ef-f67d-7ffabe45c4a1@redhat.com>","Content-Type":"text/plain; charset=utf-8","Content-Language":"en-US","Content-Transfer-Encoding":"7bit","X-Scanned-By":"MIMEDefang 2.79 on 10.5.11.12","X-Greylist":"Sender IP whitelisted, not delayed by milter-greylist-4.5.16\n\t(mx1.redhat.com [10.5.110.31]);\n\tTue, 10 Oct 2017 13:29:18 +0000 (UTC)","X-detected-operating-system":"by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]\n\t[fuzzy]","X-Received-From":"209.132.183.28","Subject":"Re: [Qemu-devel] [PATCH v1 5/6] kvm: kvm_log_start/stop are only\n\tcalled with known sections","X-BeenThere":"qemu-devel@nongnu.org","X-Mailman-Version":"2.1.21","Precedence":"list","List-Id":"<qemu-devel.nongnu.org>","List-Unsubscribe":"<https://lists.nongnu.org/mailman/options/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>","List-Archive":"<http://lists.nongnu.org/archive/html/qemu-devel/>","List-Post":"<mailto:qemu-devel@nongnu.org>","List-Help":"<mailto:qemu-devel-request@nongnu.org?subject=help>","List-Subscribe":"<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=subscribe>","Cc":"kvm@vger.kernel.org, =?utf-8?b?UmFkaW0gS3LEjW3DocWZ?=\n\t<rkrcmar@redhat.com>","Errors-To":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org","Sender":"\"Qemu-devel\"\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>"}},{"id":1787188,"web_url":"http://patchwork.ozlabs.org/comment/1787188/","msgid":"<bffd31bf-a3a1-8ecf-1ca0-afd3d891fd24@redhat.com>","list_archive_url":null,"date":"2017-10-16T07:16:34","subject":"Re: [Qemu-devel] [PATCH v1 5/6] kvm: kvm_log_start/stop are only\n\tcalled with known sections","submitter":{"id":70402,"url":"http://patchwork.ozlabs.org/api/people/70402/","name":"David Hildenbrand","email":"david@redhat.com"},"content":"On 10.10.2017 15:29, Paolo Bonzini wrote:\n> On 10/10/2017 11:06, Thomas Huth wrote:\n>> On 11.09.2017 19:49, David Hildenbrand wrote:\n>>> Let's properly align the sections first and bail out if we would ever\n>>> get called with a memory section we don't know yet.\n>>>\n>>> Signed-off-by: David Hildenbrand <david@redhat.com>\n>>> ---\n>>>  accel/kvm/kvm-all.c | 18 ++++++++++++------\n>>>  1 file changed, 12 insertions(+), 6 deletions(-)\n>>>\n>>> diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c\n>>> index b677d1b13e..2ae459453d 100644\n>>> --- a/accel/kvm/kvm-all.c\n>>> +++ b/accel/kvm/kvm-all.c\n>>> @@ -411,15 +411,21 @@ static int kvm_slot_update_flags(KVMMemoryListener *kml, KVMSlot *mem,\n>>>  static int kvm_section_update_flags(KVMMemoryListener *kml,\n>>>                                      MemoryRegionSection *section)\n>>>  {\n>>> -    hwaddr phys_addr = section->offset_within_address_space;\n>>> -    ram_addr_t size = int128_get64(section->size);\n>>> -    KVMSlot *mem = kvm_lookup_matching_slot(kml, phys_addr, size);\n>>> +    hwaddr start_addr, size;\n>>> +    KVMSlot *mem;\n>>>  \n>>> -    if (mem == NULL)  {\n>>> +    size = kvm_align_section(section, &start_addr);\n>>> +    if (!size) {\n>>>          return 0;\n>>> -    } else {\n>>> -        return kvm_slot_update_flags(kml, mem, section->mr);\n>>>      }\n>>> +\n>>> +    mem = kvm_lookup_matching_slot(kml, start_addr, size);\n>>> +    if (!mem) {\n>>> +        fprintf(stderr, \"%s: error finding slot\\n\", __func__);\n>>> +        abort();\n>>> +    }\n>>\n>> FYI, this abort now triggers with the \"isa-vga\" device:\n>>\n>> $ x86_64-softmmu/qemu-system-x86_64 -S -accel kvm -device isa-vga\n>> kvm_section_update_flags: error finding slot\n>> Aborted (core dumped)\n>>\n>> Any ideas how to fix this?\n> \n> Reverting, unless David has some time to look into it.\n> \n> Paolo\n> \n\nJust returned from vacation, I'll have a look this week.\n\nThanks for that nice reproducer Thomas, that should help a lot!","headers":{"Return-Path":"<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":["ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=nongnu.org\n\t(client-ip=2001:4830:134:3::11; helo=lists.gnu.org;\n\tenvelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n\treceiver=<UNKNOWN>)","ext-mx03.extmail.prod.ext.phx2.redhat.com;\n\tdmarc=none (p=none dis=none) header.from=redhat.com","ext-mx03.extmail.prod.ext.phx2.redhat.com;\n\tspf=fail smtp.mailfrom=david@redhat.com"],"Received":["from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11])\n\t(using TLSv1 with cipher AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3yFqWw3vqpz9t1t\n\tfor <incoming@patchwork.ozlabs.org>;\n\tMon, 16 Oct 2017 18:22:04 +1100 (AEDT)","from localhost ([::1]:59741 helo=lists.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.71) (envelope-from\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>)\n\tid 1e3zir-0007Wh-Oy\n\tfor incoming@patchwork.ozlabs.org; Mon, 16 Oct 2017 03:22:01 -0400","from eggs.gnu.org ([2001:4830:134:3::10]:50585)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <david@redhat.com>) id 1e3zdg-0004Pc-Es\n\tfor qemu-devel@nongnu.org; Mon, 16 Oct 2017 03:16:41 -0400","from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <david@redhat.com>) id 1e3zdd-0002sq-AL\n\tfor qemu-devel@nongnu.org; Mon, 16 Oct 2017 03:16:40 -0400","from mx1.redhat.com ([209.132.183.28]:42428)\n\tby eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)\n\t(Exim 4.71) (envelope-from <david@redhat.com>) id 1e3zdd-0002sG-39\n\tfor qemu-devel@nongnu.org; Mon, 16 Oct 2017 03:16:37 -0400","from smtp.corp.redhat.com\n\t(int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14])\n\t(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby mx1.redhat.com (Postfix) with ESMTPS id 3F38C7E42C;\n\tMon, 16 Oct 2017 07:16:36 +0000 (UTC)","from [10.36.116.255] (unknown [10.36.116.255])\n\tby smtp.corp.redhat.com (Postfix) with ESMTP id 01F9D5D9CC;\n\tMon, 16 Oct 2017 07:16:34 +0000 (UTC)"],"DMARC-Filter":"OpenDMARC Filter v1.3.2 mx1.redhat.com 3F38C7E42C","To":"Paolo Bonzini <pbonzini@redhat.com>, Thomas Huth <thuth@redhat.com>,\n\tqemu-devel@nongnu.org","References":"<20170911174933.20789-1-david@redhat.com>\n\t<20170911174933.20789-6-david@redhat.com>\n\t<7bf188b3-3c35-97ef-f67d-7ffabe45c4a1@redhat.com>\n\t<f6eb7866-3df7-e420-5b84-6d3caf052413@redhat.com>","From":"David Hildenbrand <david@redhat.com>","Organization":"Red Hat GmbH","Message-ID":"<bffd31bf-a3a1-8ecf-1ca0-afd3d891fd24@redhat.com>","Date":"Mon, 16 Oct 2017 09:16:34 +0200","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101\n\tThunderbird/52.3.0","MIME-Version":"1.0","In-Reply-To":"<f6eb7866-3df7-e420-5b84-6d3caf052413@redhat.com>","Content-Type":"text/plain; charset=utf-8","Content-Language":"en-US","Content-Transfer-Encoding":"7bit","X-Scanned-By":"MIMEDefang 2.79 on 10.5.11.14","X-Greylist":"Sender IP whitelisted, not delayed by milter-greylist-4.5.16\n\t(mx1.redhat.com [10.5.110.27]);\n\tMon, 16 Oct 2017 07:16:36 +0000 (UTC)","X-detected-operating-system":"by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]\n\t[fuzzy]","X-Received-From":"209.132.183.28","Subject":"Re: [Qemu-devel] [PATCH v1 5/6] kvm: kvm_log_start/stop are only\n\tcalled with known sections","X-BeenThere":"qemu-devel@nongnu.org","X-Mailman-Version":"2.1.21","Precedence":"list","List-Id":"<qemu-devel.nongnu.org>","List-Unsubscribe":"<https://lists.nongnu.org/mailman/options/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>","List-Archive":"<http://lists.nongnu.org/archive/html/qemu-devel/>","List-Post":"<mailto:qemu-devel@nongnu.org>","List-Help":"<mailto:qemu-devel-request@nongnu.org?subject=help>","List-Subscribe":"<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=subscribe>","Cc":"kvm@vger.kernel.org, =?utf-8?b?UmFkaW0gS3LEjW3DocWZ?=\n\t<rkrcmar@redhat.com>","Errors-To":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org","Sender":"\"Qemu-devel\"\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>"}},{"id":1787247,"web_url":"http://patchwork.ozlabs.org/comment/1787247/","msgid":"<986d3c41-1b0e-6b0b-3096-916c90208b46@redhat.com>","list_archive_url":null,"date":"2017-10-16T08:52:27","subject":"Re: [Qemu-devel] [PATCH v1 5/6] kvm: kvm_log_start/stop are only\n\tcalled with known sections","submitter":{"id":66152,"url":"http://patchwork.ozlabs.org/api/people/66152/","name":"Thomas Huth","email":"thuth@redhat.com"},"content":"On 16.10.2017 09:16, David Hildenbrand wrote:\n> On 10.10.2017 15:29, Paolo Bonzini wrote:\n>> On 10/10/2017 11:06, Thomas Huth wrote:\n>>> On 11.09.2017 19:49, David Hildenbrand wrote:\n>>>> Let's properly align the sections first and bail out if we would ever\n>>>> get called with a memory section we don't know yet.\n>>>>\n>>>> Signed-off-by: David Hildenbrand <david@redhat.com>\n>>>> ---\n>>>>  accel/kvm/kvm-all.c | 18 ++++++++++++------\n>>>>  1 file changed, 12 insertions(+), 6 deletions(-)\n>>>>\n>>>> diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c\n>>>> index b677d1b13e..2ae459453d 100644\n>>>> --- a/accel/kvm/kvm-all.c\n>>>> +++ b/accel/kvm/kvm-all.c\n>>>> @@ -411,15 +411,21 @@ static int kvm_slot_update_flags(KVMMemoryListener *kml, KVMSlot *mem,\n>>>>  static int kvm_section_update_flags(KVMMemoryListener *kml,\n>>>>                                      MemoryRegionSection *section)\n>>>>  {\n>>>> -    hwaddr phys_addr = section->offset_within_address_space;\n>>>> -    ram_addr_t size = int128_get64(section->size);\n>>>> -    KVMSlot *mem = kvm_lookup_matching_slot(kml, phys_addr, size);\n>>>> +    hwaddr start_addr, size;\n>>>> +    KVMSlot *mem;\n>>>>  \n>>>> -    if (mem == NULL)  {\n>>>> +    size = kvm_align_section(section, &start_addr);\n>>>> +    if (!size) {\n>>>>          return 0;\n>>>> -    } else {\n>>>> -        return kvm_slot_update_flags(kml, mem, section->mr);\n>>>>      }\n>>>> +\n>>>> +    mem = kvm_lookup_matching_slot(kml, start_addr, size);\n>>>> +    if (!mem) {\n>>>> +        fprintf(stderr, \"%s: error finding slot\\n\", __func__);\n>>>> +        abort();\n>>>> +    }\n>>>\n>>> FYI, this abort now triggers with the \"isa-vga\" device:\n>>>\n>>> $ x86_64-softmmu/qemu-system-x86_64 -S -accel kvm -device isa-vga\n>>> kvm_section_update_flags: error finding slot\n>>> Aborted (core dumped)\n>>>\n>>> Any ideas how to fix this?\n>>\n>> Reverting, unless David has some time to look into it.\n>>\n>> Paolo\n>>\n> \n> Just returned from vacation, I'll have a look this week.\n> \n> Thanks for that nice reproducer Thomas, that should help a lot!\n\nFWIW, I've found the problem with the scripts/device-crash-test script,\nso you might want to run that, too, before submitting a new version.\n\n Thomas","headers":{"Return-Path":"<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":["ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=nongnu.org\n\t(client-ip=2001:4830:134:3::11; helo=lists.gnu.org;\n\tenvelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n\treceiver=<UNKNOWN>)","ext-mx09.extmail.prod.ext.phx2.redhat.com;\n\tdmarc=none (p=none dis=none) header.from=redhat.com","ext-mx09.extmail.prod.ext.phx2.redhat.com;\n\tspf=fail smtp.mailfrom=thuth@redhat.com"],"Received":["from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11])\n\t(using TLSv1 with cipher AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3yFsXw0nJbz9sNr\n\tfor <incoming@patchwork.ozlabs.org>;\n\tMon, 16 Oct 2017 19:53:02 +1100 (AEDT)","from localhost ([::1]:60025 helo=lists.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.71) (envelope-from\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>)\n\tid 1e418u-00065c-I2\n\tfor incoming@patchwork.ozlabs.org; Mon, 16 Oct 2017 04:53:00 -0400","from eggs.gnu.org ([2001:4830:134:3::10]:43391)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <thuth@redhat.com>) id 1e418Y-00065F-Al\n\tfor qemu-devel@nongnu.org; Mon, 16 Oct 2017 04:52:39 -0400","from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <thuth@redhat.com>) id 1e418U-0002Ec-EH\n\tfor qemu-devel@nongnu.org; Mon, 16 Oct 2017 04:52:38 -0400","from mx1.redhat.com ([209.132.183.28]:38054)\n\tby eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)\n\t(Exim 4.71) (envelope-from <thuth@redhat.com>) id 1e418U-0002E5-5M\n\tfor qemu-devel@nongnu.org; Mon, 16 Oct 2017 04:52:34 -0400","from smtp.corp.redhat.com\n\t(int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16])\n\t(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby mx1.redhat.com (Postfix) with ESMTPS id 331734E4CA;\n\tMon, 16 Oct 2017 08:52:32 +0000 (UTC)","from [10.33.192.189] (dhcp-192-189.str.redhat.com [10.33.192.189])\n\tby smtp.corp.redhat.com (Postfix) with ESMTPS id 55A7E5C54A;\n\tMon, 16 Oct 2017 08:52:29 +0000 (UTC)"],"DMARC-Filter":"OpenDMARC Filter v1.3.2 mx1.redhat.com 331734E4CA","To":"David Hildenbrand <david@redhat.com>, Paolo Bonzini\n\t<pbonzini@redhat.com>, qemu-devel@nongnu.org","References":"<20170911174933.20789-1-david@redhat.com>\n\t<20170911174933.20789-6-david@redhat.com>\n\t<7bf188b3-3c35-97ef-f67d-7ffabe45c4a1@redhat.com>\n\t<f6eb7866-3df7-e420-5b84-6d3caf052413@redhat.com>\n\t<bffd31bf-a3a1-8ecf-1ca0-afd3d891fd24@redhat.com>","From":"Thomas Huth <thuth@redhat.com>","Message-ID":"<986d3c41-1b0e-6b0b-3096-916c90208b46@redhat.com>","Date":"Mon, 16 Oct 2017 10:52:27 +0200","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101\n\tThunderbird/52.4.0","MIME-Version":"1.0","In-Reply-To":"<bffd31bf-a3a1-8ecf-1ca0-afd3d891fd24@redhat.com>","Content-Type":"text/plain; charset=utf-8","Content-Language":"en-US","X-Scanned-By":"MIMEDefang 2.79 on 10.5.11.16","X-Greylist":"Sender IP whitelisted, not delayed by milter-greylist-4.5.16\n\t(mx1.redhat.com [10.5.110.38]);\n\tMon, 16 Oct 2017 08:52:32 +0000 (UTC)","Content-Transfer-Encoding":"quoted-printable","X-detected-operating-system":"by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]\n\t[fuzzy]","X-Received-From":"209.132.183.28","Subject":"Re: [Qemu-devel] [PATCH v1 5/6] kvm: kvm_log_start/stop are only\n\tcalled with known sections","X-BeenThere":"qemu-devel@nongnu.org","X-Mailman-Version":"2.1.21","Precedence":"list","List-Id":"<qemu-devel.nongnu.org>","List-Unsubscribe":"<https://lists.nongnu.org/mailman/options/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>","List-Archive":"<http://lists.nongnu.org/archive/html/qemu-devel/>","List-Post":"<mailto:qemu-devel@nongnu.org>","List-Help":"<mailto:qemu-devel-request@nongnu.org?subject=help>","List-Subscribe":"<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=subscribe>","Cc":"Eduardo Habkost <ehabkost@redhat.com>, kvm@vger.kernel.org,\n\t=?utf-8?b?UmFkaW0gS3LEjW3DocWZ?= <rkrcmar@redhat.com>","Errors-To":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org","Sender":"\"Qemu-devel\"\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>"}},{"id":1787272,"web_url":"http://patchwork.ozlabs.org/comment/1787272/","msgid":"<578fbf47-9106-0922-a185-a7f0da3760bd@redhat.com>","list_archive_url":null,"date":"2017-10-16T09:19:01","subject":"Re: [Qemu-devel] [PATCH v1 5/6] kvm: kvm_log_start/stop are only\n\tcalled with known sections","submitter":{"id":70402,"url":"http://patchwork.ozlabs.org/api/people/70402/","name":"David Hildenbrand","email":"david@redhat.com"},"content":"On 16.10.2017 10:52, Thomas Huth wrote:\n> On 16.10.2017 09:16, David Hildenbrand wrote:\n>> On 10.10.2017 15:29, Paolo Bonzini wrote:\n>>> On 10/10/2017 11:06, Thomas Huth wrote:\n>>>> On 11.09.2017 19:49, David Hildenbrand wrote:\n>>>>> Let's properly align the sections first and bail out if we would ever\n>>>>> get called with a memory section we don't know yet.\n>>>>>\n>>>>> Signed-off-by: David Hildenbrand <david@redhat.com>\n>>>>> ---\n>>>>>  accel/kvm/kvm-all.c | 18 ++++++++++++------\n>>>>>  1 file changed, 12 insertions(+), 6 deletions(-)\n>>>>>\n>>>>> diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c\n>>>>> index b677d1b13e..2ae459453d 100644\n>>>>> --- a/accel/kvm/kvm-all.c\n>>>>> +++ b/accel/kvm/kvm-all.c\n>>>>> @@ -411,15 +411,21 @@ static int kvm_slot_update_flags(KVMMemoryListener *kml, KVMSlot *mem,\n>>>>>  static int kvm_section_update_flags(KVMMemoryListener *kml,\n>>>>>                                      MemoryRegionSection *section)\n>>>>>  {\n>>>>> -    hwaddr phys_addr = section->offset_within_address_space;\n>>>>> -    ram_addr_t size = int128_get64(section->size);\n>>>>> -    KVMSlot *mem = kvm_lookup_matching_slot(kml, phys_addr, size);\n>>>>> +    hwaddr start_addr, size;\n>>>>> +    KVMSlot *mem;\n>>>>>  \n>>>>> -    if (mem == NULL)  {\n>>>>> +    size = kvm_align_section(section, &start_addr);\n>>>>> +    if (!size) {\n>>>>>          return 0;\n>>>>> -    } else {\n>>>>> -        return kvm_slot_update_flags(kml, mem, section->mr);\n>>>>>      }\n>>>>> +\n>>>>> +    mem = kvm_lookup_matching_slot(kml, start_addr, size);\n>>>>> +    if (!mem) {\n>>>>> +        fprintf(stderr, \"%s: error finding slot\\n\", __func__);\n>>>>> +        abort();\n>>>>> +    }\n>>>>\n>>>> FYI, this abort now triggers with the \"isa-vga\" device:\n>>>>\n>>>> $ x86_64-softmmu/qemu-system-x86_64 -S -accel kvm -device isa-vga\n>>>> kvm_section_update_flags: error finding slot\n>>>> Aborted (core dumped)\n>>>>\n>>>> Any ideas how to fix this?\n>>>\n>>> Reverting, unless David has some time to look into it.\n>>>\n>>> Paolo\n>>>\n>>\n>> Just returned from vacation, I'll have a look this week.\n>>\n>> Thanks for that nice reproducer Thomas, that should help a lot!\n> \n> FWIW, I've found the problem with the scripts/device-crash-test script,\n> so you might want to run that, too, before submitting a new version.\n> \n>  Thomas\n> \n\nThis one was easy to fix, there was just one place where the asssumption\n\"only called with known sections\" was wrong.\n\nSee \"memory: call log_start after region_add\"","headers":{"Return-Path":"<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":["ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=nongnu.org\n\t(client-ip=2001:4830:134:3::11; helo=lists.gnu.org;\n\tenvelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n\treceiver=<UNKNOWN>)","ext-mx08.extmail.prod.ext.phx2.redhat.com;\n\tdmarc=none (p=none dis=none) header.from=redhat.com","ext-mx08.extmail.prod.ext.phx2.redhat.com;\n\tspf=fail smtp.mailfrom=david@redhat.com"],"Received":["from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11])\n\t(using TLSv1 with cipher AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3yFt7d1TCBz9sP1\n\tfor <incoming@patchwork.ozlabs.org>;\n\tMon, 16 Oct 2017 20:19:41 +1100 (AEDT)","from localhost ([::1]:60096 helo=lists.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.71) (envelope-from\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>)\n\tid 1e41Yh-0005RR-6z\n\tfor incoming@patchwork.ozlabs.org; Mon, 16 Oct 2017 05:19:39 -0400","from eggs.gnu.org ([2001:4830:134:3::10]:49009)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <david@redhat.com>) id 1e41YA-0005QW-7D\n\tfor qemu-devel@nongnu.org; Mon, 16 Oct 2017 05:19:08 -0400","from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <david@redhat.com>) id 1e41Y9-0005kc-16\n\tfor qemu-devel@nongnu.org; Mon, 16 Oct 2017 05:19:06 -0400","from mx1.redhat.com ([209.132.183.28]:54776)\n\tby eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)\n\t(Exim 4.71) (envelope-from <david@redhat.com>) id 1e41Y8-0005jh-OF\n\tfor qemu-devel@nongnu.org; Mon, 16 Oct 2017 05:19:04 -0400","from smtp.corp.redhat.com\n\t(int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11])\n\t(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby mx1.redhat.com (Postfix) with ESMTPS id D2BCAC057F91;\n\tMon, 16 Oct 2017 09:19:03 +0000 (UTC)","from [10.36.116.255] (unknown [10.36.116.255])\n\tby smtp.corp.redhat.com (Postfix) with ESMTP id 6DAE56046F;\n\tMon, 16 Oct 2017 09:19:02 +0000 (UTC)"],"DMARC-Filter":"OpenDMARC Filter v1.3.2 mx1.redhat.com D2BCAC057F91","To":"Thomas Huth <thuth@redhat.com>, Paolo Bonzini <pbonzini@redhat.com>,\n\tqemu-devel@nongnu.org","References":"<20170911174933.20789-1-david@redhat.com>\n\t<20170911174933.20789-6-david@redhat.com>\n\t<7bf188b3-3c35-97ef-f67d-7ffabe45c4a1@redhat.com>\n\t<f6eb7866-3df7-e420-5b84-6d3caf052413@redhat.com>\n\t<bffd31bf-a3a1-8ecf-1ca0-afd3d891fd24@redhat.com>\n\t<986d3c41-1b0e-6b0b-3096-916c90208b46@redhat.com>","From":"David Hildenbrand <david@redhat.com>","Organization":"Red Hat GmbH","Message-ID":"<578fbf47-9106-0922-a185-a7f0da3760bd@redhat.com>","Date":"Mon, 16 Oct 2017 11:19:01 +0200","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101\n\tThunderbird/52.3.0","MIME-Version":"1.0","In-Reply-To":"<986d3c41-1b0e-6b0b-3096-916c90208b46@redhat.com>","Content-Type":"text/plain; charset=utf-8","Content-Language":"en-US","Content-Transfer-Encoding":"7bit","X-Scanned-By":"MIMEDefang 2.79 on 10.5.11.11","X-Greylist":"Sender IP whitelisted, not delayed by milter-greylist-4.5.16\n\t(mx1.redhat.com [10.5.110.32]);\n\tMon, 16 Oct 2017 09:19:03 +0000 (UTC)","X-detected-operating-system":"by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]\n\t[fuzzy]","X-Received-From":"209.132.183.28","Subject":"Re: [Qemu-devel] [PATCH v1 5/6] kvm: kvm_log_start/stop are only\n\tcalled with known sections","X-BeenThere":"qemu-devel@nongnu.org","X-Mailman-Version":"2.1.21","Precedence":"list","List-Id":"<qemu-devel.nongnu.org>","List-Unsubscribe":"<https://lists.nongnu.org/mailman/options/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>","List-Archive":"<http://lists.nongnu.org/archive/html/qemu-devel/>","List-Post":"<mailto:qemu-devel@nongnu.org>","List-Help":"<mailto:qemu-devel-request@nongnu.org?subject=help>","List-Subscribe":"<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=subscribe>","Cc":"Eduardo Habkost <ehabkost@redhat.com>, kvm@vger.kernel.org,\n\t=?utf-8?b?UmFkaW0gS3LEjW3DocWZ?= <rkrcmar@redhat.com>","Errors-To":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org","Sender":"\"Qemu-devel\"\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>"}}]