From MAILER-DAEMON Mon Jul 04 03:31:02 2016 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1bJyLN-00031t-Uk for mharc-qemu-stable@gnu.org; Mon, 04 Jul 2016 03:31:02 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33465) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bJyLL-0002zu-Nj for qemu-stable@nongnu.org; Mon, 04 Jul 2016 03:31:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bJyLJ-0002kE-QQ for qemu-stable@nongnu.org; Mon, 04 Jul 2016 03:30:58 -0400 Received: from [59.151.112.132] (port=26522 helo=heian.cn.fujitsu.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bJyLD-0002im-Vv; Mon, 04 Jul 2016 03:30:52 -0400 X-IronPort-AV: E=Sophos;i="5.22,518,1449504000"; d="scan'208";a="8325826" Received: from unknown (HELO cn.fujitsu.com) ([10.167.33.5]) by heian.cn.fujitsu.com with ESMTP; 04 Jul 2016 15:30:40 +0800 Received: from G08CNEXCHPEKD03.g08.fujitsu.local (unknown [10.167.33.85]) by cn.fujitsu.com (Postfix) with ESMTP id 4D75A41C0BBD; Mon, 4 Jul 2016 15:30:38 +0800 (CST) Received: from [10.167.225.55] (10.167.225.55) by G08CNEXCHPEKD03.g08.fujitsu.local (10.167.33.89) with Microsoft SMTP Server id 14.3.279.2; Mon, 4 Jul 2016 15:30:37 +0800 Message-ID: <577A11C7.9030003@cn.fujitsu.com> Date: Mon, 4 Jul 2016 15:35:35 +0800 From: Changlong Xie User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: Eric Blake , CC: , Luiz Capitulino , , References: <1463608012-12760-1-git-send-email-eblake@redhat.com> In-Reply-To: <1463608012-12760-1-git-send-email-eblake@redhat.com> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.167.225.55] X-yoursite-MailScanner-ID: 4D75A41C0BBD.AAB87 X-yoursite-MailScanner: Found to be clean X-yoursite-MailScanner-From: xiecl.fnst@cn.fujitsu.com X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 59.151.112.132 Subject: Re: [Qemu-stable] [Qemu-devel] [PATCH] json-streamer: Don't leak tokens on incomplete parse X-BeenThere: qemu-stable@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Jul 2016 07:31:00 -0000 On 05/19/2016 05:46 AM, Eric Blake wrote: > Valgrind complained about a number of leaks in > tests/check-qobject-json: > > ==12657== definitely lost: 17,247 bytes in 1,234 blocks > > All of which had the same root cause: on an incomplete parse, > we were abandoning the token queue without cleaning up the > allocated data within each queue element. Introduced in > commit 95385fe, when we switched from QList (which recursively > frees contents) to g_queue (which does not). > > We don't yet require glib 2.32 with its g_queue_free_full(), > so open-code it instead. > > CC: qemu-stable@nongnu.org > Signed-off-by: Eric Blake > --- > qobject/json-streamer.c | 6 ++++++ > 1 file changed, 6 insertions(+) > > diff --git a/qobject/json-streamer.c b/qobject/json-streamer.c > index 0251685..7164390 100644 > --- a/qobject/json-streamer.c > +++ b/qobject/json-streamer.c > @@ -20,9 +20,15 @@ > #define MAX_TOKEN_COUNT (2ULL << 20) > #define MAX_NESTING (1ULL << 10) > > +static void json_message_free_token(void *token, void *opaque) > +{ > + g_free(token); > +} > + > static void json_message_free_tokens(JSONMessageParser *parser) > { > if (parser->tokens) { > + g_queue_foreach(parser->tokens, json_message_free_token, NULL); > g_queue_free(parser->tokens); > parser->tokens = NULL; > } > It seems this commit make tests/qemu-iotests/071 failed on the last master branch. From MAILER-DAEMON Mon Jul 04 08:21:29 2016 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1bK2sT-0000K6-Qi for mharc-qemu-stable@gnu.org; Mon, 04 Jul 2016 08:21:29 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43072) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bK2sO-0000Ed-CJ for qemu-stable@nongnu.org; Mon, 04 Jul 2016 08:21:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bK2sH-00047T-Lk for qemu-stable@nongnu.org; Mon, 04 Jul 2016 08:21:23 -0400 Received: from mx1.redhat.com ([209.132.183.28]:34752) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bK2sB-00046Q-Jl; Mon, 04 Jul 2016 08:21:11 -0400 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 3357D7F342; Mon, 4 Jul 2016 12:21:11 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-116-57.ams2.redhat.com [10.36.116.57]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u64CL9fH020231 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Mon, 4 Jul 2016 08:21:10 -0400 Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 810D11133016; Mon, 4 Jul 2016 14:21:08 +0200 (CEST) From: Markus Armbruster To: Changlong Xie Cc: Eric Blake , , pbonzini@redhat.com, qemu-stable@nongnu.org, Luiz Capitulino References: <1463608012-12760-1-git-send-email-eblake@redhat.com> <577A11C7.9030003@cn.fujitsu.com> Date: Mon, 04 Jul 2016 14:21:08 +0200 In-Reply-To: <577A11C7.9030003@cn.fujitsu.com> (Changlong Xie's message of "Mon, 4 Jul 2016 15:35:35 +0800") Message-ID: <87inwllhl7.fsf@dusky.pond.sub.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Scanned-By: MIMEDefang 2.68 on 10.5.11.27 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Mon, 04 Jul 2016 12:21:11 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: Re: [Qemu-stable] [Qemu-devel] [PATCH] json-streamer: Don't leak tokens on incomplete parse X-BeenThere: qemu-stable@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Jul 2016 12:21:28 -0000 Changlong Xie writes: > On 05/19/2016 05:46 AM, Eric Blake wrote: >> Valgrind complained about a number of leaks in >> tests/check-qobject-json: >> >> ==12657== definitely lost: 17,247 bytes in 1,234 blocks >> >> All of which had the same root cause: on an incomplete parse, >> we were abandoning the token queue without cleaning up the >> allocated data within each queue element. Introduced in >> commit 95385fe, when we switched from QList (which recursively >> frees contents) to g_queue (which does not). >> >> We don't yet require glib 2.32 with its g_queue_free_full(), >> so open-code it instead. >> >> CC: qemu-stable@nongnu.org >> Signed-off-by: Eric Blake >> --- >> qobject/json-streamer.c | 6 ++++++ >> 1 file changed, 6 insertions(+) >> >> diff --git a/qobject/json-streamer.c b/qobject/json-streamer.c >> index 0251685..7164390 100644 >> --- a/qobject/json-streamer.c >> +++ b/qobject/json-streamer.c >> @@ -20,9 +20,15 @@ >> #define MAX_TOKEN_COUNT (2ULL << 20) >> #define MAX_NESTING (1ULL << 10) >> >> +static void json_message_free_token(void *token, void *opaque) >> +{ >> + g_free(token); >> +} >> + >> static void json_message_free_tokens(JSONMessageParser *parser) >> { >> if (parser->tokens) { >> + g_queue_foreach(parser->tokens, json_message_free_token, NULL); >> g_queue_free(parser->tokens); >> parser->tokens = NULL; >> } >> > > It seems this commit make tests/qemu-iotests/071 failed on the last > master branch. More direct reproducer: { "execute": "qmp_capabilities" } { "execute": "blockdev-add", "arguments": { "options": { "node-name": "drive0", "driver": "qcow2", "file": { "driver": "file", "filename": "t.qcow2" } } } } { "execute": "blockdev-add", "arguments": { "options": { "driver": "blkverify", "id": "drive0-verify", "test": "drive0", "raw": { "driver": "file", "filename": "t.qcow2.base" } } } } { "execute": "human-monitor-command", "arguments": { "command-line": 'qemu-io drive0-verify "read 0 512"' } } With t.qcow2 and t.qcow2.base as in 071. Interesting part of valgrind run: ==29716== at 0xF7E8E71: g_queue_foreach (in /usr/lib64/libglib-2.0.so.0.4600.2) ==29716== by 0x7CB7C5: json_message_free_tokens (json-streamer.c:31) ==29716== by 0x7CBAC6: json_message_parser_destroy (json-streamer.c:131) ==29716== by 0x3469AE: monitor_qmp_event (monitor.c:4022) ==29716== by 0x476C32: qemu_chr_be_event (qemu-char.c:205) ==29716== by 0x47BE05: tcp_chr_close (qemu-char.c:3175) ==29716== by 0x47E5AB: qemu_chr_free (qemu-char.c:4036) ==29716== by 0x47E62C: qemu_chr_delete (qemu-char.c:4044) ==29716== by 0x47F576: qemu_chr_cleanup (qemu-char.c:4557) ==29716== by 0x12EA65E7: __run_exit_handlers (in /usr/lib64/libc-2.22.so) ==29716== by 0x12EA6634: exit (in /usr/lib64/libc-2.22.so) ==29716== by 0x74762C: blkverify_err (blkverify.c:58) ==29716== Address 0x24270550 is 0 bytes inside a block of size 24 free'd ==29716== at 0x4C29CF0: free (vg_replace_malloc.c:530) ==29716== by 0xF7DE63D: g_free (in /usr/lib64/libglib-2.0.so.0.4600.2) ==29716== by 0xF7F5DCC: g_slice_free1 (in /usr/lib64/libglib-2.0.so.0.4600.2) ==29716== by 0x7CC327: parser_context_free (json-parser.c:268) ==29716== by 0x7CCFB5: json_parser_parse_err (json-parser.c:577) ==29716== by 0x7CCF48: json_parser_parse (json-parser.c:561) ==29716== by 0x3464A2: handle_qmp_command (monitor.c:3892) ==29716== by 0x7CB9C7: json_message_process_token (json-streamer.c:100) ==29716== by 0x7EDEC2: json_lexer_feed_char (json-lexer.c:319) ==29716== by 0x7EE00A: json_lexer_feed (json-lexer.c:369) ==29716== by 0x7CBA7E: json_message_parser_feed (json-streamer.c:120) ==29716== by 0x346722: monitor_qmp_read (monitor.c:3949) ==29716== Block was alloc'd at ==29716== at 0x4C28BF6: malloc (vg_replace_malloc.c:299) ==29716== by 0xF7DE528: g_malloc (in /usr/lib64/libglib-2.0.so.0.4600.2) ==29716== by 0xF7F5652: g_slice_alloc (in /usr/lib64/libglib-2.0.so.0.4600.2) ==29716== by 0xF7F5CED: g_slice_alloc0 (in /usr/lib64/libglib-2.0.so.0.4600.2) ==29716== by 0x7CB9CC: json_message_process_token (json-streamer.c:101) ==29716== by 0x7EDEC2: json_lexer_feed_char (json-lexer.c:319) ==29716== by 0x7EE00A: json_lexer_feed (json-lexer.c:369) ==29716== by 0x7CBA7E: json_message_parser_feed (json-streamer.c:120) ==29716== by 0x346722: monitor_qmp_read (monitor.c:3949) ==29716== by 0x477214: qemu_chr_be_write_impl (qemu-char.c:388) ==29716== by 0x477272: qemu_chr_be_write (qemu-char.c:400) ==29716== by 0x47B4CD: tcp_chr_read (qemu-char.c:2894) Double free. Can't see offhand how this stuff works. Eric, let's revert this patch unless you can see a fix. From MAILER-DAEMON Mon Jul 04 08:31:58 2016 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1bK32c-0006hc-MV for mharc-qemu-stable@gnu.org; Mon, 04 Jul 2016 08:31:58 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45322) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bK32a-0006V5-Fo for qemu-stable@nongnu.org; Mon, 04 Jul 2016 08:31:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bK32Y-0006Wt-DU for qemu-stable@nongnu.org; Mon, 04 Jul 2016 08:31:55 -0400 Received: from mx1.redhat.com ([209.132.183.28]:42928) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bK32U-0006VI-42; Mon, 04 Jul 2016 08:31:50 -0400 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8970C3B709; Mon, 4 Jul 2016 12:31:48 +0000 (UTC) Received: from [10.36.112.57] (ovpn-112-57.ams2.redhat.com [10.36.112.57]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u64CVi1V029808 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 4 Jul 2016 08:31:46 -0400 To: Markus Armbruster , Changlong Xie References: <1463608012-12760-1-git-send-email-eblake@redhat.com> <577A11C7.9030003@cn.fujitsu.com> <87inwllhl7.fsf@dusky.pond.sub.org> Cc: Eric Blake , qemu-devel@nongnu.org, qemu-stable@nongnu.org, Luiz Capitulino From: Paolo Bonzini Message-ID: Date: Mon, 4 Jul 2016 14:31:43 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.1.1 MIME-Version: 1.0 In-Reply-To: <87inwllhl7.fsf@dusky.pond.sub.org> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.68 on 10.5.11.26 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Mon, 04 Jul 2016 12:31:48 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: Re: [Qemu-stable] [Qemu-devel] [PATCH] json-streamer: Don't leak tokens on incomplete parse X-BeenThere: qemu-stable@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Jul 2016 12:31:57 -0000 On 04/07/2016 14:21, Markus Armbruster wrote: > Double free. Can't see offhand how this stuff works. Eric, let's > revert this patch unless you can see a fix. I think I have a fix. Paolo From MAILER-DAEMON Mon Jul 04 12:46:55 2016 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1bK71L-0001i0-Hw for mharc-qemu-stable@gnu.org; Mon, 04 Jul 2016 12:46:55 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39881) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bK71J-0001fS-JE for qemu-stable@nongnu.org; Mon, 04 Jul 2016 12:46:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bK71I-0002A9-1y for qemu-stable@nongnu.org; Mon, 04 Jul 2016 12:46:52 -0400 Received: from mx1.redhat.com ([209.132.183.28]:33301) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bK71C-000282-Fz; Mon, 04 Jul 2016 12:46:46 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id DFC4FC049E1B; Mon, 4 Jul 2016 16:46:45 +0000 (UTC) Received: from redhat.com (vpn1-6-134.ams2.redhat.com [10.36.6.134]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with SMTP id u64Gkhh2012287; Mon, 4 Jul 2016 12:46:44 -0400 Date: Mon, 4 Jul 2016 19:46:43 +0300 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , qemu-stable@nongnu.org, Robin Geuze Message-ID: <20160704194643-mutt-send-email-mst@redhat.com> References: <1467650742-17580-1-git-send-email-mst@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1467650742-17580-1-git-send-email-mst@redhat.com> X-Mutt-Fcc: =sent X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Mon, 04 Jul 2016 16:46:46 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-stable] [PULL 10/36] virtio: set low features early on load X-BeenThere: qemu-stable@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Jul 2016 16:46:54 -0000 virtio migrates the low 32 feature bits twice, the first copy is there for compatibility but ever since 019a3edbb25f1571e876f8af1ce4c55412939e5d: ("virtio: make features 64bit wide") it's ignored on load. This is wrong since virtio_net_load tests self announcement and guest offloads before the second copy including high feature bits is loaded. This means that self announcement, control vq and guest offloads are all broken after migration. Fix it up by loading low feature bits: somewhat ugly since high and low bits become out of sync temporarily, but seems unavoidable for compatibility. The right thing to do for new features is probably to test the host features, anyway. Fixes: 019a3edbb25f1571e876f8af1ce4c55412939e5d ("virtio: make features 64bit wide") Cc: qemu-stable@nongnu.org Reported-by: Robin Geuze Tested-by: Robin Geuze Signed-off-by: Michael S. Tsirkin --- hw/virtio/virtio.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c index 7ed06ea..18153d5 100644 --- a/hw/virtio/virtio.c +++ b/hw/virtio/virtio.c @@ -1499,6 +1499,16 @@ int virtio_load(VirtIODevice *vdev, QEMUFile *f, int version_id) } qemu_get_be32s(f, &features); + /* + * Temporarily set guest_features low bits - needed by + * virtio net load code testing for VIRTIO_NET_F_CTRL_GUEST_OFFLOADS + * VIRTIO_NET_F_GUEST_ANNOUNCE and VIRTIO_NET_F_CTRL_VQ. + * + * Note: devices should always test host features in future - don't create + * new dependencies like this. + */ + vdev->guest_features = features; + config_len = qemu_get_be32(f); /* -- MST From MAILER-DAEMON Mon Jul 04 12:46:58 2016 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1bK71N-0001kd-R5 for mharc-qemu-stable@gnu.org; Mon, 04 Jul 2016 12:46:57 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39909) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bK71L-0001hV-3P for qemu-stable@nongnu.org; Mon, 04 Jul 2016 12:46:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bK71K-0002CB-43 for qemu-stable@nongnu.org; Mon, 04 Jul 2016 12:46:55 -0400 Received: from mx1.redhat.com ([209.132.183.28]:37651) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bK71F-00029O-W9; Mon, 04 Jul 2016 12:46:50 -0400 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 5F0AB7F0A0; Mon, 4 Jul 2016 16:46:49 +0000 (UTC) Received: from redhat.com (vpn1-6-134.ams2.redhat.com [10.36.6.134]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with SMTP id u64Gkka8003884; Mon, 4 Jul 2016 12:46:47 -0400 Date: Mon, 4 Jul 2016 19:46:46 +0300 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , qemu-stable@nongnu.org, Robin Geuze , Jason Wang Message-ID: <20160704194646-mutt-send-email-mst@redhat.com> References: <1467650742-17580-1-git-send-email-mst@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1467650742-17580-1-git-send-email-mst@redhat.com> X-Mutt-Fcc: =sent X-Scanned-By: MIMEDefang 2.68 on 10.5.11.27 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Mon, 04 Jul 2016 16:46:49 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-stable] [PULL 11/36] Revert "virtio-net: unbreak self announcement and guest offloads after migration" X-BeenThere: qemu-stable@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Jul 2016 16:46:56 -0000 This reverts commit 1f8828ef573c83365b4a87a776daf8bcef1caa21. Cc: qemu-stable@nongnu.org Reported-by: Robin Geuze Tested-by: Robin Geuze Signed-off-by: Michael S. Tsirkin --- hw/net/virtio-net.c | 40 +++++++++++++++++----------------------- 1 file changed, 17 insertions(+), 23 deletions(-) diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c index 7e6a60a..9999899 100644 --- a/hw/net/virtio-net.c +++ b/hw/net/virtio-net.c @@ -1542,33 +1542,11 @@ static int virtio_net_load(QEMUFile *f, void *opaque, int version_id) { VirtIONet *n = opaque; VirtIODevice *vdev = VIRTIO_DEVICE(n); - int ret; if (version_id < 2 || version_id > VIRTIO_NET_VM_VERSION) return -EINVAL; - ret = virtio_load(vdev, f, version_id); - if (ret) { - return ret; - } - - if (virtio_vdev_has_feature(vdev, VIRTIO_NET_F_CTRL_GUEST_OFFLOADS)) { - n->curr_guest_offloads = qemu_get_be64(f); - } else { - n->curr_guest_offloads = virtio_net_supported_guest_offloads(n); - } - - if (peer_has_vnet_hdr(n)) { - virtio_net_apply_guest_offloads(n); - } - - if (virtio_vdev_has_feature(vdev, VIRTIO_NET_F_GUEST_ANNOUNCE) && - virtio_vdev_has_feature(vdev, VIRTIO_NET_F_CTRL_VQ)) { - n->announce_counter = SELF_ANNOUNCE_ROUNDS; - timer_mod(n->announce_timer, qemu_clock_get_ms(QEMU_CLOCK_VIRTUAL)); - } - - return 0; + return virtio_load(vdev, f, version_id); } static int virtio_net_load_device(VirtIODevice *vdev, QEMUFile *f, @@ -1665,6 +1643,16 @@ static int virtio_net_load_device(VirtIODevice *vdev, QEMUFile *f, } } + if (virtio_vdev_has_feature(vdev, VIRTIO_NET_F_CTRL_GUEST_OFFLOADS)) { + n->curr_guest_offloads = qemu_get_be64(f); + } else { + n->curr_guest_offloads = virtio_net_supported_guest_offloads(n); + } + + if (peer_has_vnet_hdr(n)) { + virtio_net_apply_guest_offloads(n); + } + virtio_net_set_queues(n); /* Find the first multicast entry in the saved MAC filter */ @@ -1682,6 +1670,12 @@ static int virtio_net_load_device(VirtIODevice *vdev, QEMUFile *f, qemu_get_subqueue(n->nic, i)->link_down = link_down; } + if (virtio_vdev_has_feature(vdev, VIRTIO_NET_F_GUEST_ANNOUNCE) && + virtio_vdev_has_feature(vdev, VIRTIO_NET_F_CTRL_VQ)) { + n->announce_counter = SELF_ANNOUNCE_ROUNDS; + timer_mod(n->announce_timer, qemu_clock_get_ms(QEMU_CLOCK_VIRTUAL)); + } + return 0; } -- MST From MAILER-DAEMON Tue Jul 05 03:56:48 2016 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1bKLDs-0000g0-00 for mharc-qemu-stable@gnu.org; Tue, 05 Jul 2016 03:56:48 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59676) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bKLDp-0000cU-3E for qemu-stable@nongnu.org; Tue, 05 Jul 2016 03:56:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bKLDj-0004Bq-VG for qemu-stable@nongnu.org; Tue, 05 Jul 2016 03:56:44 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:49110 helo=mx0a-001b2d01.pphosted.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bKLDj-0004BY-Px for qemu-stable@nongnu.org; Tue, 05 Jul 2016 03:56:39 -0400 Received: from pps.filterd (m0098420.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.11/8.16.0.11) with SMTP id u657rilB117863 for ; Tue, 5 Jul 2016 03:56:39 -0400 Received: from e06smtp09.uk.ibm.com (e06smtp09.uk.ibm.com [195.75.94.105]) by mx0b-001b2d01.pphosted.com with ESMTP id 23x9t15p3p-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Tue, 05 Jul 2016 03:56:39 -0400 Received: from localhost by e06smtp09.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 5 Jul 2016 08:56:36 +0100 Received: from d06dlp02.portsmouth.uk.ibm.com (9.149.20.14) by e06smtp09.uk.ibm.com (192.168.101.139) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Tue, 5 Jul 2016 08:56:33 +0100 X-IBM-Helo: d06dlp02.portsmouth.uk.ibm.com X-IBM-MailFrom: cornelia.huck@de.ibm.com X-IBM-RcptTo: qemu-devel@nongnu.org;qemu-stable@nongnu.org Received: from b06cxnps3075.portsmouth.uk.ibm.com (d06relay10.portsmouth.uk.ibm.com [9.149.109.195]) by d06dlp02.portsmouth.uk.ibm.com (Postfix) with ESMTP id 52E022190046; Tue, 5 Jul 2016 08:56:02 +0100 (BST) Received: from d06av07.portsmouth.uk.ibm.com (d06av07.portsmouth.uk.ibm.com [9.149.37.248]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id u657uXnR17760516; Tue, 5 Jul 2016 07:56:33 GMT Received: from d06av07.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av07.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id u657uWGk003875; Tue, 5 Jul 2016 03:56:32 -0400 Received: from gondolin.boeblingen.de.ibm.com (dyn-9-152-224-202.boeblingen.de.ibm.com [9.152.224.202]) by d06av07.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id u657uUM8003759 (version=TLSv1/SSLv3 cipher=AES256-SHA256 bits=256 verify=NO); Tue, 5 Jul 2016 03:56:32 -0400 From: Cornelia Huck To: qemu-devel@nongnu.org Cc: borntraeger@de.ibm.com, agraf@suse.de, jfrei@linux.vnet.ibm.com, David Hildenbrand , qemu-stable@nongnu.org, Cornelia Huck Date: Tue, 5 Jul 2016 09:56:24 +0200 X-Mailer: git-send-email 2.9.0 In-Reply-To: <20160705075628.6203-1-cornelia.huck@de.ibm.com> References: <20160705075628.6203-1-cornelia.huck@de.ibm.com> X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16070507-0036-0000-0000-000001FA7748 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 16070507-0037-0000-0000-00001195C632 Message-Id: <20160705075628.6203-5-cornelia.huck@de.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2016-07-05_03:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=1 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1604210000 definitions=main-1607050074 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] X-Received-From: 148.163.158.5 Subject: [Qemu-stable] [PATCH for-2.7 4/8] s390x/ipl: fix reboots for migration from different bios X-BeenThere: qemu-stable@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Jul 2016 07:56:46 -0000 From: David Hildenbrand When migrating from a different QEMU version, the start_address and bios_start_address may differ. During migration these values are migrated and overwrite the values that were detected by QEMU itself. On a reboot, QEMU will reload its own BIOS, but use the migrated start addresses, which does not work if the values differ. Fix this by not relying on the migrated values anymore, but still provide them during migration, so existing QEMUs continue to work. Signed-off-by: David Hildenbrand Cc: qemu-stable@nongnu.org Signed-off-by: Cornelia Huck --- hw/s390x/ipl.c | 11 +++++++++-- hw/s390x/ipl.h | 2 ++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/hw/s390x/ipl.c b/hw/s390x/ipl.c index 78998cd..a54284c 100644 --- a/hw/s390x/ipl.c +++ b/hw/s390x/ipl.c @@ -69,8 +69,8 @@ static const VMStateDescription vmstate_ipl = { .version_id = 0, .minimum_version_id = 0, .fields = (VMStateField[]) { - VMSTATE_UINT64(start_addr, S390IPLState), - VMSTATE_UINT64(bios_start_addr, S390IPLState), + VMSTATE_UINT64(compat_start_addr, S390IPLState), + VMSTATE_UINT64(compat_bios_start_addr, S390IPLState), VMSTATE_STRUCT(iplb, S390IPLState, 0, vmstate_iplb, IplParameterBlock), VMSTATE_BOOL(iplb_valid, S390IPLState), VMSTATE_UINT8(cssid, S390IPLState), @@ -192,6 +192,13 @@ static void s390_ipl_realize(DeviceState *dev, Error **errp) stq_p(rom_ptr(INITRD_PARM_SIZE), initrd_size); } } + /* + * Don't ever use the migrated values, they could come from a different + * BIOS and therefore don't work. But still migrate the values, so + * QEMUs relying on it don't break. + */ + ipl->compat_start_addr = ipl->start_addr; + ipl->compat_bios_start_addr = ipl->bios_start_addr; qemu_register_reset(qdev_reset_all_fn, dev); error: error_propagate(errp, err); diff --git a/hw/s390x/ipl.h b/hw/s390x/ipl.h index ed3f2c8..c891095 100644 --- a/hw/s390x/ipl.h +++ b/hw/s390x/ipl.h @@ -93,7 +93,9 @@ struct S390IPLState { /*< private >*/ DeviceState parent_obj; uint64_t start_addr; + uint64_t compat_start_addr; uint64_t bios_start_addr; + uint64_t compat_bios_start_addr; bool enforce_bios; IplParameterBlock iplb; bool iplb_valid; -- 2.9.0 From MAILER-DAEMON Tue Jul 05 11:46:52 2016 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1bKSYm-0004ce-0e for mharc-qemu-stable@gnu.org; Tue, 05 Jul 2016 11:46:52 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40672) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bKSYh-0004XB-Aq for qemu-stable@nongnu.org; Tue, 05 Jul 2016 11:46:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bKSYf-0005Yo-BV for qemu-stable@nongnu.org; Tue, 05 Jul 2016 11:46:46 -0400 Received: from mx1.redhat.com ([209.132.183.28]:53706) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bKSYb-0005Y9-F8; Tue, 05 Jul 2016 11:46:41 -0400 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id BF15865408; Tue, 5 Jul 2016 15:46:40 +0000 (UTC) Received: from redhat.com (vpn1-6-161.ams2.redhat.com [10.36.6.161]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with SMTP id u65FkcrY028601; Tue, 5 Jul 2016 11:46:39 -0400 Date: Tue, 5 Jul 2016 18:46:38 +0300 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , qemu-stable@nongnu.org, Robin Geuze Message-ID: <20160705184638-mutt-send-email-mst@redhat.com> References: <1467733400-17206-1-git-send-email-mst@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1467733400-17206-1-git-send-email-mst@redhat.com> X-Mutt-Fcc: =sent X-Scanned-By: MIMEDefang 2.68 on 10.5.11.26 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Tue, 05 Jul 2016 15:46:40 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-stable] [PULL v2 10/30] virtio: set low features early on load X-BeenThere: qemu-stable@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Jul 2016 15:46:50 -0000 virtio migrates the low 32 feature bits twice, the first copy is there for compatibility but ever since 019a3edbb25f1571e876f8af1ce4c55412939e5d: ("virtio: make features 64bit wide") it's ignored on load. This is wrong since virtio_net_load tests self announcement and guest offloads before the second copy including high feature bits is loaded. This means that self announcement, control vq and guest offloads are all broken after migration. Fix it up by loading low feature bits: somewhat ugly since high and low bits become out of sync temporarily, but seems unavoidable for compatibility. The right thing to do for new features is probably to test the host features, anyway. Fixes: 019a3edbb25f1571e876f8af1ce4c55412939e5d ("virtio: make features 64bit wide") Cc: qemu-stable@nongnu.org Reported-by: Robin Geuze Tested-by: Robin Geuze Signed-off-by: Michael S. Tsirkin --- hw/virtio/virtio.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c index 7ed06ea..18153d5 100644 --- a/hw/virtio/virtio.c +++ b/hw/virtio/virtio.c @@ -1499,6 +1499,16 @@ int virtio_load(VirtIODevice *vdev, QEMUFile *f, int version_id) } qemu_get_be32s(f, &features); + /* + * Temporarily set guest_features low bits - needed by + * virtio net load code testing for VIRTIO_NET_F_CTRL_GUEST_OFFLOADS + * VIRTIO_NET_F_GUEST_ANNOUNCE and VIRTIO_NET_F_CTRL_VQ. + * + * Note: devices should always test host features in future - don't create + * new dependencies like this. + */ + vdev->guest_features = features; + config_len = qemu_get_be32(f); /* -- MST From MAILER-DAEMON Tue Jul 05 11:46:55 2016 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1bKSYp-0004ec-Bm for mharc-qemu-stable@gnu.org; Tue, 05 Jul 2016 11:46:55 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40707) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bKSYl-0004c9-Jz for qemu-stable@nongnu.org; Tue, 05 Jul 2016 11:46:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bKSYk-0005ZZ-Ie for qemu-stable@nongnu.org; Tue, 05 Jul 2016 11:46:51 -0400 Received: from mx1.redhat.com ([209.132.183.28]:52124) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bKSYe-0005Ye-TT; Tue, 05 Jul 2016 11:46:45 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6FE54C049D59; Tue, 5 Jul 2016 15:46:44 +0000 (UTC) Received: from redhat.com (vpn1-6-161.ams2.redhat.com [10.36.6.161]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with SMTP id u65Fkfl1002963; Tue, 5 Jul 2016 11:46:42 -0400 Date: Tue, 5 Jul 2016 18:46:41 +0300 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , qemu-stable@nongnu.org, Robin Geuze , Jason Wang Message-ID: <20160705184641-mutt-send-email-mst@redhat.com> References: <1467733400-17206-1-git-send-email-mst@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1467733400-17206-1-git-send-email-mst@redhat.com> X-Mutt-Fcc: =sent X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Tue, 05 Jul 2016 15:46:44 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-stable] [PULL v2 11/30] Revert "virtio-net: unbreak self announcement and guest offloads after migration" X-BeenThere: qemu-stable@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Jul 2016 15:46:52 -0000 This reverts commit 1f8828ef573c83365b4a87a776daf8bcef1caa21. Cc: qemu-stable@nongnu.org Reported-by: Robin Geuze Tested-by: Robin Geuze Signed-off-by: Michael S. Tsirkin --- hw/net/virtio-net.c | 40 +++++++++++++++++----------------------- 1 file changed, 17 insertions(+), 23 deletions(-) diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c index 7e6a60a..9999899 100644 --- a/hw/net/virtio-net.c +++ b/hw/net/virtio-net.c @@ -1542,33 +1542,11 @@ static int virtio_net_load(QEMUFile *f, void *opaque, int version_id) { VirtIONet *n = opaque; VirtIODevice *vdev = VIRTIO_DEVICE(n); - int ret; if (version_id < 2 || version_id > VIRTIO_NET_VM_VERSION) return -EINVAL; - ret = virtio_load(vdev, f, version_id); - if (ret) { - return ret; - } - - if (virtio_vdev_has_feature(vdev, VIRTIO_NET_F_CTRL_GUEST_OFFLOADS)) { - n->curr_guest_offloads = qemu_get_be64(f); - } else { - n->curr_guest_offloads = virtio_net_supported_guest_offloads(n); - } - - if (peer_has_vnet_hdr(n)) { - virtio_net_apply_guest_offloads(n); - } - - if (virtio_vdev_has_feature(vdev, VIRTIO_NET_F_GUEST_ANNOUNCE) && - virtio_vdev_has_feature(vdev, VIRTIO_NET_F_CTRL_VQ)) { - n->announce_counter = SELF_ANNOUNCE_ROUNDS; - timer_mod(n->announce_timer, qemu_clock_get_ms(QEMU_CLOCK_VIRTUAL)); - } - - return 0; + return virtio_load(vdev, f, version_id); } static int virtio_net_load_device(VirtIODevice *vdev, QEMUFile *f, @@ -1665,6 +1643,16 @@ static int virtio_net_load_device(VirtIODevice *vdev, QEMUFile *f, } } + if (virtio_vdev_has_feature(vdev, VIRTIO_NET_F_CTRL_GUEST_OFFLOADS)) { + n->curr_guest_offloads = qemu_get_be64(f); + } else { + n->curr_guest_offloads = virtio_net_supported_guest_offloads(n); + } + + if (peer_has_vnet_hdr(n)) { + virtio_net_apply_guest_offloads(n); + } + virtio_net_set_queues(n); /* Find the first multicast entry in the saved MAC filter */ @@ -1682,6 +1670,12 @@ static int virtio_net_load_device(VirtIODevice *vdev, QEMUFile *f, qemu_get_subqueue(n->nic, i)->link_down = link_down; } + if (virtio_vdev_has_feature(vdev, VIRTIO_NET_F_GUEST_ANNOUNCE) && + virtio_vdev_has_feature(vdev, VIRTIO_NET_F_CTRL_VQ)) { + n->announce_counter = SELF_ANNOUNCE_ROUNDS; + timer_mod(n->announce_timer, qemu_clock_get_ms(QEMU_CLOCK_VIRTUAL)); + } + return 0; } -- MST From MAILER-DAEMON Wed Jul 06 04:40:29 2016 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1bKiNh-00035X-Hy for mharc-qemu-stable@gnu.org; Wed, 06 Jul 2016 04:40:29 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41406) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bKiNf-0002ym-BV for qemu-stable@nongnu.org; Wed, 06 Jul 2016 04:40:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bKiNe-0000cc-Gb for qemu-stable@nongnu.org; Wed, 06 Jul 2016 04:40:27 -0400 Received: from mx1.redhat.com ([209.132.183.28]:49814) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bKiNX-0000aw-50; Wed, 06 Jul 2016 04:40:19 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 99A9C6408A; Wed, 6 Jul 2016 08:40:17 +0000 (UTC) Received: from noname.str.redhat.com (dhcp-192-197.str.redhat.com [10.33.192.197]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with SMTP id u668eG61031205; Wed, 6 Jul 2016 04:40:16 -0400 Date: Wed, 6 Jul 2016 10:40:15 +0200 From: Kevin Wolf To: Max Reitz Cc: qemu-block@nongnu.org, qemu-devel@nongnu.org, qemu-stable@nongnu.org Message-ID: <20160706084015.GF5233@noname.str.redhat.com> References: <20160615153630.2116-1-mreitz@redhat.com> <20160615153630.2116-3-mreitz@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160615153630.2116-3-mreitz@redhat.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Wed, 06 Jul 2016 08:40:17 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: Re: [Qemu-stable] [PATCH 2/2] qcow2: Avoid making the L1 table too big X-BeenThere: qemu-stable@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Jul 2016 08:40:28 -0000 Am 15.06.2016 um 17:36 hat Max Reitz geschrieben: > We refuse to open images whose L1 table we deem "too big". Consequently, > we should not produce such images ourselves. > > Cc: qemu-stable@nongnu.org > Signed-off-by: Max Reitz > --- > block/qcow2-cluster.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/block/qcow2-cluster.c b/block/qcow2-cluster.c > index 893ddf6..335b9b0 100644 > --- a/block/qcow2-cluster.c > +++ b/block/qcow2-cluster.c > @@ -65,7 +65,7 @@ int qcow2_grow_l1_table(BlockDriverState *bs, uint64_t min_size, > } > } > > - if (new_l1_size > INT_MAX / sizeof(uint64_t)) { > + if (new_l1_size > QCOW_MAX_L1_SIZE / sizeof(uint64_t)) { > return -EFBIG; > } Maybe add a QEMU_BUILD_BUG_ON(QCOW_MAX_L1_SIZE > INT_MAX)? Kevin From MAILER-DAEMON Wed Jul 06 08:47:47 2016 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1bKmF0-0002Hu-Vy for mharc-qemu-stable@gnu.org; Wed, 06 Jul 2016 08:47:47 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41432) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bKmEw-0002FT-AX for qemu-stable@nongnu.org; Wed, 06 Jul 2016 08:47:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bKmEv-0001vp-9f for qemu-stable@nongnu.org; Wed, 06 Jul 2016 08:47:42 -0400 Received: from mx1.redhat.com ([209.132.183.28]:47606) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bKmEm-0001u1-W5; Wed, 06 Jul 2016 08:47:33 -0400 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 522DF63175; Wed, 6 Jul 2016 12:47:32 +0000 (UTC) Received: from [10.36.116.85] (ovpn-116-85.ams2.redhat.com [10.36.116.85]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u66ClU6p023638 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 6 Jul 2016 08:47:31 -0400 To: Kevin Wolf References: <20160615153630.2116-1-mreitz@redhat.com> <20160615153630.2116-3-mreitz@redhat.com> <20160706084015.GF5233@noname.str.redhat.com> Cc: qemu-block@nongnu.org, qemu-devel@nongnu.org, qemu-stable@nongnu.org From: Max Reitz Message-ID: <1a0e01ee-fdcd-3428-c2de-7ea8e50dc5a6@redhat.com> Date: Wed, 6 Jul 2016 14:47:29 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.1.1 MIME-Version: 1.0 In-Reply-To: <20160706084015.GF5233@noname.str.redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="K641SMG3nf2l313SuNHl2EuBlTfSECJFU" X-Scanned-By: MIMEDefang 2.68 on 10.5.11.26 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Wed, 06 Jul 2016 12:47:32 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: Re: [Qemu-stable] [PATCH 2/2] qcow2: Avoid making the L1 table too big X-BeenThere: qemu-stable@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Jul 2016 12:47:45 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --K641SMG3nf2l313SuNHl2EuBlTfSECJFU Content-Type: multipart/mixed; boundary="uLDQQ5UAK5wwjrQBwk2sm6kQGOS79VbJ1" From: Max Reitz To: Kevin Wolf Cc: qemu-block@nongnu.org, qemu-devel@nongnu.org, qemu-stable@nongnu.org Message-ID: <1a0e01ee-fdcd-3428-c2de-7ea8e50dc5a6@redhat.com> Subject: Re: [PATCH 2/2] qcow2: Avoid making the L1 table too big References: <20160615153630.2116-1-mreitz@redhat.com> <20160615153630.2116-3-mreitz@redhat.com> <20160706084015.GF5233@noname.str.redhat.com> In-Reply-To: <20160706084015.GF5233@noname.str.redhat.com> --uLDQQ5UAK5wwjrQBwk2sm6kQGOS79VbJ1 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable On 06.07.2016 10:40, Kevin Wolf wrote: > Am 15.06.2016 um 17:36 hat Max Reitz geschrieben: >> We refuse to open images whose L1 table we deem "too big". Consequentl= y, >> we should not produce such images ourselves. >> >> Cc: qemu-stable@nongnu.org >> Signed-off-by: Max Reitz >> --- >> block/qcow2-cluster.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/block/qcow2-cluster.c b/block/qcow2-cluster.c >> index 893ddf6..335b9b0 100644 >> --- a/block/qcow2-cluster.c >> +++ b/block/qcow2-cluster.c >> @@ -65,7 +65,7 @@ int qcow2_grow_l1_table(BlockDriverState *bs, uint64= _t min_size, >> } >> } >> =20 >> - if (new_l1_size > INT_MAX / sizeof(uint64_t)) { >> + if (new_l1_size > QCOW_MAX_L1_SIZE / sizeof(uint64_t)) { >> return -EFBIG; >> } >=20 > Maybe add a QEMU_BUILD_BUG_ON(QCOW_MAX_L1_SIZE > INT_MAX)? Good idea, did that. I changed it directly in my block branch, or do you think a v2 mail necessary? Max --uLDQQ5UAK5wwjrQBwk2sm6kQGOS79VbJ1-- --K641SMG3nf2l313SuNHl2EuBlTfSECJFU Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQEvBAEBCAAZBQJXfP3hEhxtcmVpdHpAcmVkaGF0LmNvbQAKCRA7sUIC6DisrfsT B/42k7NV9/2KK75BxJfPudJBGf93CMa3466GT3WcZPIflAYSxYvJEjUY4XFPJkS5 9u4w4teHcd5rForOrCyJ8e+XifXv+Nj9YUpjlKHljtTq9p6X40YuPdyY7sDLPssI X7rzGROsa6ZTw3mux+rM+Gw/6GmD+n0Decbt6HRjJEXv7A1Azzgvp0djH5Wmdkpc GfcKze3GnPnzGQgAW2swWv2Plqi9AmBFNR6nc1o39lft0EFGP+FTjzp/16lVObiT wPvH4bgDtxTCKW8mt8oShCsHY876MDJVBQYC6/JEgjpEtfdRRXybcaTDBnbwm8Rx dgxejGsjww7xdFh3qxjekImM =9hG/ -----END PGP SIGNATURE----- --K641SMG3nf2l313SuNHl2EuBlTfSECJFU-- From MAILER-DAEMON Wed Jul 06 08:54:42 2016 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1bKmLi-0006rc-DZ for mharc-qemu-stable@gnu.org; Wed, 06 Jul 2016 08:54:42 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42821) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bKmLg-0006po-4A for qemu-stable@nongnu.org; Wed, 06 Jul 2016 08:54:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bKmLb-0003Q8-2V for qemu-stable@nongnu.org; Wed, 06 Jul 2016 08:54:40 -0400 Received: from mx1.redhat.com ([209.132.183.28]:52025) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bKmLQ-0003Mx-S8; Wed, 06 Jul 2016 08:54:24 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4D797C05B1CD; Wed, 6 Jul 2016 12:54:24 +0000 (UTC) Received: from noname.str.redhat.com (dhcp-192-197.str.redhat.com [10.33.192.197]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with SMTP id u66CsMeP001442; Wed, 6 Jul 2016 08:54:23 -0400 Date: Wed, 6 Jul 2016 14:54:22 +0200 From: Kevin Wolf To: Max Reitz Cc: qemu-block@nongnu.org, qemu-devel@nongnu.org, qemu-stable@nongnu.org Message-ID: <20160706125422.GG5233@noname.str.redhat.com> References: <20160615153630.2116-1-mreitz@redhat.com> <20160615153630.2116-3-mreitz@redhat.com> <20160706084015.GF5233@noname.str.redhat.com> <1a0e01ee-fdcd-3428-c2de-7ea8e50dc5a6@redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="Md/poaVZ8hnGTzuv" Content-Disposition: inline In-Reply-To: <1a0e01ee-fdcd-3428-c2de-7ea8e50dc5a6@redhat.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Wed, 06 Jul 2016 12:54:24 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: Re: [Qemu-stable] [PATCH 2/2] qcow2: Avoid making the L1 table too big X-BeenThere: qemu-stable@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Jul 2016 12:54:41 -0000 --Md/poaVZ8hnGTzuv Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Am 06.07.2016 um 14:47 hat Max Reitz geschrieben: > On 06.07.2016 10:40, Kevin Wolf wrote: > > Am 15.06.2016 um 17:36 hat Max Reitz geschrieben: > >> We refuse to open images whose L1 table we deem "too big". Consequentl= y, > >> we should not produce such images ourselves. > >> > >> Cc: qemu-stable@nongnu.org > >> Signed-off-by: Max Reitz > >> --- > >> block/qcow2-cluster.c | 2 +- > >> 1 file changed, 1 insertion(+), 1 deletion(-) > >> > >> diff --git a/block/qcow2-cluster.c b/block/qcow2-cluster.c > >> index 893ddf6..335b9b0 100644 > >> --- a/block/qcow2-cluster.c > >> +++ b/block/qcow2-cluster.c > >> @@ -65,7 +65,7 @@ int qcow2_grow_l1_table(BlockDriverState *bs, uint64= _t min_size, > >> } > >> } > >> =20 > >> - if (new_l1_size > INT_MAX / sizeof(uint64_t)) { > >> + if (new_l1_size > QCOW_MAX_L1_SIZE / sizeof(uint64_t)) { > >> return -EFBIG; > >> } > >=20 > > Maybe add a QEMU_BUILD_BUG_ON(QCOW_MAX_L1_SIZE > INT_MAX)? >=20 > Good idea, did that. I changed it directly in my block branch, or do you > think a v2 mail necessary? No, letting you apply it directly is what I intended. Kevin --Md/poaVZ8hnGTzuv Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (GNU/Linux) iQIcBAEBAgAGBQJXfP9+AAoJEH8JsnLIjy/W+K4QALmePqY+4T4l0ry0pvNpvep3 rBNNybH34gRjeNh96i0gJq/4lKOBTaI7d6SsVq57SKo+Mv0Ftmq7dLEhYd8PhK26 ec6Jng5ZJpMoy2GAy0im66NP5/STUY40Is7FJ4XoldF/B/0uMT++Puww7oObzoHB sKiBpK1LlqC4pr1rbt5nLMF21H5LtlzMIPodJS3eqLplDbCgTInyWhL5kidNe61V tHBc+sTQUO8lE8d7fbHjMA7iEOtH4zVeTs01uIDgLjx5kNYVQVjby8U34OLq7s+T lV+GZtBX65I74JQzZctMtwqZLpLkrlDdau8V8bNYv95NTrtzXZ4/nYmJsB9EsgKg QdppdwUic3hb84aKDllSjQfRaEYB0nsD8SyZ3+yTL5lMHzDQcq9q4M13ypMvE+xk jgtWWkjBdJP5G86NWXPx0n5us//1Wzn+UDAe/nv/3P2C22fEHSFY+I49qwuKGR5i tdOvefDBQTeRUaC1MYyRi/QCAppgdn6zuZ5WEmGjaKwQmz8yix+l2+R4YpGRvcLs J9hogGZv3yO89T/NaNQHV51N+qJooqnML1A7ykJNeQMNKUftxaFMYdUGvfdBEU/0 QgwSluD8WNZE6Ll0FEbaT5SJ29dNCQAJymsU5uBGmgkSkVhEf+ePXsoxi3CN9hE9 TmRfxjE8ZOUoys5r0DWF =8BJx -----END PGP SIGNATURE----- --Md/poaVZ8hnGTzuv-- From MAILER-DAEMON Fri Jul 08 10:04:18 2016 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1bLWOA-0007tb-PH for mharc-qemu-stable@gnu.org; Fri, 08 Jul 2016 10:04:18 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46500) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bLWO5-0007qq-TK for qemu-stable@nongnu.org; Fri, 08 Jul 2016 10:04:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bLWO4-0006GE-On for qemu-stable@nongnu.org; Fri, 08 Jul 2016 10:04:13 -0400 Received: from smtp3.mundo-r.com ([212.51.32.191]:16093 helo=smtp4.mundo-r.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bLWNy-0005uK-Dj; Fri, 08 Jul 2016 10:04:06 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A2BHBgAvsn9X/5tjdVtbHQGDIIFSpDCSVYIPgXuGGAKBJzkTAQEBAQEBAWUnhE0CBHkQPxI8GxmINAG9XwEwhV+CSIQGAYNThQ8FjgRwiiCOT4lNhV+QDiADMYIWJoE4a4kyAQEB X-IPAS-Result: A2BHBgAvsn9X/5tjdVtbHQGDIIFSpDCSVYIPgXuGGAKBJzkTAQEBAQEBAWUnhE0CBHkQPxI8GxmINAG9XwEwhV+CSIQGAYNThQ8FjgRwiiCOT4lNhV+QDiADMYIWJoE4a4kyAQEB X-IronPort-AV: E=Sophos;i="5.28,330,1464645600"; d="scan'208";a="82788368" Received: from fanzine.igalia.com ([91.117.99.155]) by smtp4.mundo-r.com with ESMTP; 08 Jul 2016 16:03:21 +0200 Received: from [194.100.51.2] (helo=perseus.local) by fanzine.igalia.com with esmtpsa (Cipher TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim) id 1bLWNF-00034y-Gw; Fri, 08 Jul 2016 16:03:21 +0200 Received: from berto by perseus.local with local (Exim 4.87) (envelope-from ) id 1bLWMx-0000RU-NA; Fri, 08 Jul 2016 17:03:03 +0300 From: Alberto Garcia To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, Stefan Hajnoczi , Max Reitz , Alberto Garcia , qemu-stable@nongnu.org Date: Fri, 8 Jul 2016 17:03:00 +0300 Message-Id: X-Mailer: git-send-email 2.8.1 In-Reply-To: References: In-Reply-To: References: X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 212.51.32.191 Subject: [Qemu-stable] [PATCH 1/2] blockdev: Fix regression with the default naming of throttling groups X-BeenThere: qemu-stable@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Jul 2016 14:04:17 -0000 When I/O limits are set for a block device, the name of the throttling group is taken from the BlockBackend if the user doesn't specify one. Commit efaa7c4eeb7490c6f37f3 moved the naming of the BlockBackend in blockdev_init() to the end of the function, after I/O limits are set. The consequence is that the throttling group gets an empty name. Signed-off-by: Alberto Garcia Reported-by: Stefan Hajnoczi Cc: Max Reitz Cc: qemu-stable@nongnu.org --- blockdev.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/blockdev.c b/blockdev.c index 0f8065c..3ad7d29 100644 --- a/blockdev.c +++ b/blockdev.c @@ -483,6 +483,7 @@ static BlockBackend *blockdev_init(const char *file, QDict *bs_opts, const char *id; BlockdevDetectZeroesOptions detect_zeroes = BLOCKDEV_DETECT_ZEROES_OPTIONS_OFF; + const char *blk_id; const char *throttling_group = NULL; /* Check common options by copying from bs_opts to opts, all other options @@ -512,6 +513,8 @@ static BlockBackend *blockdev_init(const char *file, QDict *bs_opts, writethrough = !qemu_opt_get_bool(opts, BDRV_OPT_CACHE_WB, true); + blk_id = qemu_opts_id(opts); + qdict_extract_subqdict(bs_opts, &interval_dict, "stats-intervals."); qdict_array_split(interval_dict, &interval_list); @@ -616,7 +619,7 @@ static BlockBackend *blockdev_init(const char *file, QDict *bs_opts, /* disk I/O throttling */ if (throttle_enabled(&cfg)) { if (!throttling_group) { - throttling_group = blk_name(blk); + throttling_group = blk_id; } blk_io_limits_enable(blk, throttling_group); blk_set_io_limits(blk, &cfg); @@ -625,7 +628,7 @@ static BlockBackend *blockdev_init(const char *file, QDict *bs_opts, blk_set_enable_write_cache(blk, !writethrough); blk_set_on_error(blk, on_read_error, on_write_error); - if (!monitor_add_blk(blk, qemu_opts_id(opts), errp)) { + if (!monitor_add_blk(blk, blk_id, errp)) { blk_unref(blk); blk = NULL; goto err_no_bs_opts; -- 2.8.1 From MAILER-DAEMON Fri Jul 08 10:05:52 2016 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1bLWPf-0000mq-Vh for mharc-qemu-stable@gnu.org; Fri, 08 Jul 2016 10:05:52 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47115) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bLWPd-0000k3-D6 for qemu-stable@nongnu.org; Fri, 08 Jul 2016 10:05:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bLWPa-0006pE-HQ for qemu-stable@nongnu.org; Fri, 08 Jul 2016 10:05:49 -0400 Received: from smtp3.mundo-r.com ([212.51.32.191]:49778 helo=smtp4.mundo-r.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bLWPS-0006ly-2w; Fri, 08 Jul 2016 10:05:38 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A2BxAgAvsn9X/5tjdVtbHQGDIIFSjSqXBpJVgg+Be4YYAoEnOBQBAQEBAQEBZSeETQIEJ1IQPxI8GxmINAG9XwEwhV+CSIQGAYNThQ8FjgRwiiCOT4lNhV+QDh42ghYmgThriTIBAQE X-IPAS-Result: A2BxAgAvsn9X/5tjdVtbHQGDIIFSjSqXBpJVgg+Be4YYAoEnOBQBAQEBAQEBZSeETQIEJ1IQPxI8GxmINAG9XwEwhV+CSIQGAYNThQ8FjgRwiiCOT4lNhV+QDh42ghYmgThriTIBAQE X-IronPort-AV: E=Sophos;i="5.28,330,1464645600"; d="scan'208";a="82788930" Received: from fanzine.igalia.com ([91.117.99.155]) by smtp4.mundo-r.com with ESMTP; 08 Jul 2016 16:05:35 +0200 Received: from [194.100.51.2] (helo=perseus.local) by fanzine.igalia.com with esmtpsa (Cipher TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim) id 1bLWPP-00036S-7s; Fri, 08 Jul 2016 16:05:35 +0200 Received: from berto by perseus.local with local (Exim 4.87) (envelope-from ) id 1bLWP9-0000js-KC; Fri, 08 Jul 2016 17:05:19 +0300 From: Alberto Garcia To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, qemu-stable@nongnu.org, Stefan Hajnoczi , Max Reitz , Alberto Garcia Date: Fri, 8 Jul 2016 17:05:13 +0300 Message-Id: <4b0273851beba772975be3e3a0decb2b93846874.1467986629.git.berto@igalia.com> X-Mailer: git-send-email 2.8.1 In-Reply-To: References: In-Reply-To: References: X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 212.51.32.191 Subject: [Qemu-stable] [PATCH for-2.6 1/2] blockdev: Fix regression with the default naming of throttling groups X-BeenThere: qemu-stable@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Jul 2016 14:05:50 -0000 When I/O limits are set for a block device, the name of the throttling group is taken from the BlockBackend if the user doesn't specify one. Commit efaa7c4eeb7490c6f37f3 moved the naming of the BlockBackend in blockdev_init() to the end of the function, after I/O limits are set. The consequence is that the throttling group gets an empty name. Signed-off-by: Alberto Garcia Reported-by: Stefan Hajnoczi Cc: Max Reitz Cc: qemu-stable@nongnu.org --- blockdev.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/blockdev.c b/blockdev.c index f1f520a..260a6f5 100644 --- a/blockdev.c +++ b/blockdev.c @@ -481,6 +481,7 @@ static BlockBackend *blockdev_init(const char *file, QDict *bs_opts, const char *id; BlockdevDetectZeroesOptions detect_zeroes = BLOCKDEV_DETECT_ZEROES_OPTIONS_OFF; + const char *blk_id; const char *throttling_group = NULL; /* Check common options by copying from bs_opts to opts, all other options @@ -510,6 +511,8 @@ static BlockBackend *blockdev_init(const char *file, QDict *bs_opts, writethrough = !qemu_opt_get_bool(opts, BDRV_OPT_CACHE_WB, true); + blk_id = qemu_opts_id(opts); + qdict_extract_subqdict(bs_opts, &interval_dict, "stats-intervals."); qdict_array_split(interval_dict, &interval_list); @@ -579,7 +582,7 @@ static BlockBackend *blockdev_init(const char *file, QDict *bs_opts, if (throttle_enabled(&cfg)) { if (!throttling_group) { - throttling_group = blk_name(blk); + throttling_group = blk_id; } blk_rs->throttle_group = g_strdup(throttling_group); blk_rs->throttle_state = throttle_group_incref(throttling_group); @@ -614,7 +617,7 @@ static BlockBackend *blockdev_init(const char *file, QDict *bs_opts, /* disk I/O throttling */ if (throttle_enabled(&cfg)) { if (!throttling_group) { - throttling_group = blk_name(blk); + throttling_group = blk_id; } bdrv_io_limits_enable(bs, throttling_group); bdrv_set_io_limits(bs, &cfg); @@ -636,7 +639,7 @@ static BlockBackend *blockdev_init(const char *file, QDict *bs_opts, blk_set_enable_write_cache(blk, !writethrough); blk_set_on_error(blk, on_read_error, on_write_error); - if (!monitor_add_blk(blk, qemu_opts_id(opts), errp)) { + if (!monitor_add_blk(blk, blk_id, errp)) { blk_unref(blk); blk = NULL; goto err_no_bs_opts; -- 2.8.1 From MAILER-DAEMON Fri Jul 08 10:05:53 2016 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1bLWPh-0000o1-5r for mharc-qemu-stable@gnu.org; Fri, 08 Jul 2016 10:05:53 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47114) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bLWPd-0000k2-Cv for qemu-stable@nongnu.org; Fri, 08 Jul 2016 10:05:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bLWPa-0006p2-4g for qemu-stable@nongnu.org; Fri, 08 Jul 2016 10:05:49 -0400 Received: from smtp3.mundo-r.com ([212.51.32.191]:49778 helo=smtp4.mundo-r.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bLWPR-0006ly-3r; Fri, 08 Jul 2016 10:05:37 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A2AqAwAvsn9X/5tjdVtbgz6BC6RmEZJVgg+BexKGBoEpOBQBAQEBAQEBZSeFTE9OiGgBvhCFX4ZOAYNThQ8FjnSKII5PgVSHeYVfkA4eNoE4AV2BXoodAQEB X-IPAS-Result: A2AqAwAvsn9X/5tjdVtbgz6BC6RmEZJVgg+BexKGBoEpOBQBAQEBAQEBZSeFTE9OiGgBvhCFX4ZOAYNThQ8FjnSKII5PgVSHeYVfkA4eNoE4AV2BXoodAQEB X-IronPort-AV: E=Sophos;i="5.28,330,1464645600"; d="scan'208";a="82788931" Received: from fanzine.igalia.com ([91.117.99.155]) by smtp4.mundo-r.com with ESMTP; 08 Jul 2016 16:05:35 +0200 Received: from [194.100.51.2] (helo=perseus.local) by fanzine.igalia.com with esmtpsa (Cipher TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim) id 1bLWPP-00036R-8b; Fri, 08 Jul 2016 16:05:35 +0200 Received: from berto by perseus.local with local (Exim 4.87) (envelope-from ) id 1bLWP9-0000jo-Ir; Fri, 08 Jul 2016 17:05:19 +0300 From: Alberto Garcia To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, qemu-stable@nongnu.org, Stefan Hajnoczi , Max Reitz , Alberto Garcia Date: Fri, 8 Jul 2016 17:05:12 +0300 Message-Id: X-Mailer: git-send-email 2.8.1 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 212.51.32.191 Subject: [Qemu-stable] [PATCH for-2.6 0/2] Fix regression with the default naming of throttling groups X-BeenThere: qemu-stable@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Jul 2016 14:05:50 -0000 Hi, Stefan reported this, this is a regression caused by commit efaa7c4eeb7490c6f37f3. I sent a separate series for the git master, this is the backport for QEMU v2.6.0. Berto Alberto Garcia (2): blockdev: Fix regression with the default naming of throttling groups qemu-iotests: Test naming of throttling groups blockdev.c | 9 +++-- tests/qemu-iotests/093 | 98 ++++++++++++++++++++++++++++++++++++++++++++++ tests/qemu-iotests/093.out | 4 +- 3 files changed, 106 insertions(+), 5 deletions(-) -- 2.8.1 From MAILER-DAEMON Fri Jul 08 10:06:02 2016 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1bLWPq-0000wo-Bk for mharc-qemu-stable@gnu.org; Fri, 08 Jul 2016 10:06:02 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47153) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bLWPn-0000t0-9h for qemu-stable@nongnu.org; Fri, 08 Jul 2016 10:06:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bLWPj-0006q5-0H for qemu-stable@nongnu.org; Fri, 08 Jul 2016 10:05:58 -0400 Received: from smtp3.mundo-r.com ([212.51.32.191]:28742 helo=smtp4.mundo-r.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bLWPS-0006mN-JB; Fri, 08 Jul 2016 10:05:39 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A2B0AgAvsn9X/5tjdVtbHQGDIIFSjSqXAAUBgRABkUSCD4F7hhgCgSc4FAEBAQEBAQFlJ4RNAgR5ED8SPBsZiDQBszCKLwEBAQcnhV+CSIxpBYgahWpwiiCOT4lNhV+QDh42g3RriTIBAQE X-IPAS-Result: A2B0AgAvsn9X/5tjdVtbHQGDIIFSjSqXAAUBgRABkUSCD4F7hhgCgSc4FAEBAQEBAQFlJ4RNAgR5ED8SPBsZiDQBszCKLwEBAQcnhV+CSIxpBYgahWpwiiCOT4lNhV+QDh42g3RriTIBAQE X-IronPort-AV: E=Sophos;i="5.28,330,1464645600"; d="scan'208";a="82788932" Received: from fanzine.igalia.com ([91.117.99.155]) by smtp4.mundo-r.com with ESMTP; 08 Jul 2016 16:05:35 +0200 Received: from [194.100.51.2] (helo=perseus.local) by fanzine.igalia.com with esmtpsa (Cipher TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim) id 1bLWPP-00036T-9X; Fri, 08 Jul 2016 16:05:35 +0200 Received: from berto by perseus.local with local (Exim 4.87) (envelope-from ) id 1bLWP9-0000jw-LB; Fri, 08 Jul 2016 17:05:19 +0300 From: Alberto Garcia To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, qemu-stable@nongnu.org, Stefan Hajnoczi , Max Reitz , Alberto Garcia Date: Fri, 8 Jul 2016 17:05:14 +0300 Message-Id: X-Mailer: git-send-email 2.8.1 In-Reply-To: References: In-Reply-To: References: X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 212.51.32.191 Subject: [Qemu-stable] [PATCH for-2.6 2/2] qemu-iotests: Test naming of throttling groups X-BeenThere: qemu-stable@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Jul 2016 14:06:00 -0000 Throttling groups are named using the 'group' parameter of the block_set_io_throttle command and the throttling.group command-line option. If that parameter is unspecified the groups get the name of the block device. This patch adds a new test to check the naming of throttling groups. Signed-off-by: Alberto Garcia --- tests/qemu-iotests/093 | 98 ++++++++++++++++++++++++++++++++++++++++++++++ tests/qemu-iotests/093.out | 4 +- 2 files changed, 100 insertions(+), 2 deletions(-) diff --git a/tests/qemu-iotests/093 b/tests/qemu-iotests/093 index ce8e13c..ffcb271 100755 --- a/tests/qemu-iotests/093 +++ b/tests/qemu-iotests/093 @@ -184,5 +184,103 @@ class ThrottleTestCase(iotests.QMPTestCase): class ThrottleTestCoroutine(ThrottleTestCase): test_img = "null-co://" +class ThrottleTestGroupNames(iotests.QMPTestCase): + test_img = "null-aio://" + max_drives = 3 + + def setUp(self): + self.vm = iotests.VM() + for i in range(0, self.max_drives): + self.vm.add_drive(self.test_img, "throttling.iops-total=100") + self.vm.launch() + + def tearDown(self): + self.vm.shutdown() + + def set_io_throttle(self, device, params): + params["device"] = device + result = self.vm.qmp("block_set_io_throttle", conv_keys=False, **params) + self.assert_qmp(result, 'return', {}) + + def verify_name(self, device, name): + result = self.vm.qmp("query-block") + for r in result["return"]: + if r["device"] == device: + info = r["inserted"] + if name: + self.assertEqual(info["group"], name) + else: + self.assertFalse(info.has_key('group')) + return + + raise Exception("No group information found for '%s'" % device) + + def test_group_naming(self): + params = {"bps": 0, + "bps_rd": 0, + "bps_wr": 0, + "iops": 0, + "iops_rd": 0, + "iops_wr": 0} + + # Check the drives added using the command line. + # The default throttling group name is the device name. + for i in range(self.max_drives): + devname = "drive%d" % i + self.verify_name(devname, devname) + + # Clear throttling settings => the group name is gone. + for i in range(self.max_drives): + devname = "drive%d" % i + self.set_io_throttle(devname, params) + self.verify_name(devname, None) + + # Set throttling settings using block_set_io_throttle and + # check the default group names. + params["iops"] = 10 + for i in range(self.max_drives): + devname = "drive%d" % i + self.set_io_throttle(devname, params) + self.verify_name(devname, devname) + + # Set a custom group name for each device + for i in range(3): + devname = "drive%d" % i + groupname = "group%d" % i + params['group'] = groupname + self.set_io_throttle(devname, params) + self.verify_name(devname, groupname) + + # Put drive0 in group1 and check that all other devices remain + # unchanged + params['group'] = 'group1' + self.set_io_throttle('drive0', params) + self.verify_name('drive0', 'group1') + for i in range(1, self.max_drives): + devname = "drive%d" % i + groupname = "group%d" % i + self.verify_name(devname, groupname) + + # Put drive0 in group2 and check that all other devices remain + # unchanged + params['group'] = 'group2' + self.set_io_throttle('drive0', params) + self.verify_name('drive0', 'group2') + for i in range(1, self.max_drives): + devname = "drive%d" % i + groupname = "group%d" % i + self.verify_name(devname, groupname) + + # Clear throttling settings from drive0 check that all other + # devices remain unchanged + params["iops"] = 0 + self.set_io_throttle('drive0', params) + self.verify_name('drive0', None) + for i in range(1, self.max_drives): + devname = "drive%d" % i + groupname = "group%d" % i + self.verify_name(devname, groupname) + + if __name__ == '__main__': iotests.main(supported_fmts=["raw"]) diff --git a/tests/qemu-iotests/093.out b/tests/qemu-iotests/093.out index 89968f3..914e373 100644 --- a/tests/qemu-iotests/093.out +++ b/tests/qemu-iotests/093.out @@ -1,5 +1,5 @@ -.... +..... ---------------------------------------------------------------------- -Ran 4 tests +Ran 5 tests OK -- 2.8.1 From MAILER-DAEMON Fri Jul 08 10:23:21 2016 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1bLWgb-0002QV-7l for mharc-qemu-stable@gnu.org; Fri, 08 Jul 2016 10:23:21 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52179) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bLWgY-0002OS-QM for qemu-stable@nongnu.org; Fri, 08 Jul 2016 10:23:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bLWgX-00023u-LN for qemu-stable@nongnu.org; Fri, 08 Jul 2016 10:23:18 -0400 Received: from mx1.redhat.com ([209.132.183.28]:54667) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bLWgO-00020g-2g; Fri, 08 Jul 2016 10:23:08 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 548D07D0C2; Fri, 8 Jul 2016 14:23:07 +0000 (UTC) Received: from [10.36.116.49] (ovpn-116-49.ams2.redhat.com [10.36.116.49]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u68EN4bL011825 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 8 Jul 2016 10:23:05 -0400 To: Alberto Garcia , qemu-devel@nongnu.org References: Cc: qemu-block@nongnu.org, Stefan Hajnoczi , qemu-stable@nongnu.org From: Max Reitz Message-ID: <9589dde4-638e-efe5-5791-a990fc93fe3d@redhat.com> Date: Fri, 8 Jul 2016 16:23:03 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.1.1 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="HdC7mDcIfLvLh6E5m4xfmLSRoXcE7bFkA" X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Fri, 08 Jul 2016 14:23:07 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: Re: [Qemu-stable] [PATCH 1/2] blockdev: Fix regression with the default naming of throttling groups X-BeenThere: qemu-stable@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Jul 2016 14:23:20 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --HdC7mDcIfLvLh6E5m4xfmLSRoXcE7bFkA Content-Type: multipart/mixed; boundary="QqdVRmQDBBv9XdWiECQCMmERGfDGxNEmS" From: Max Reitz To: Alberto Garcia , qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, Stefan Hajnoczi , qemu-stable@nongnu.org Message-ID: <9589dde4-638e-efe5-5791-a990fc93fe3d@redhat.com> Subject: Re: [PATCH 1/2] blockdev: Fix regression with the default naming of throttling groups References: In-Reply-To: --QqdVRmQDBBv9XdWiECQCMmERGfDGxNEmS Content-Type: text/plain; charset=iso-8859-15 Content-Transfer-Encoding: quoted-printable On 08.07.2016 16:03, Alberto Garcia wrote: > When I/O limits are set for a block device, the name of the throttling > group is taken from the BlockBackend if the user doesn't specify one. >=20 > Commit efaa7c4eeb7490c6f37f3 moved the naming of the BlockBackend in > blockdev_init() to the end of the function, after I/O limits are set. > The consequence is that the throttling group gets an empty name. >=20 > Signed-off-by: Alberto Garcia > Reported-by: Stefan Hajnoczi > Cc: Max Reitz > Cc: qemu-stable@nongnu.org > --- > blockdev.c | 7 +++++-- > 1 file changed, 5 insertions(+), 2 deletions(-) >=20 > diff --git a/blockdev.c b/blockdev.c > index 0f8065c..3ad7d29 100644 > --- a/blockdev.c > +++ b/blockdev.c > @@ -483,6 +483,7 @@ static BlockBackend *blockdev_init(const char *file= , QDict *bs_opts, > const char *id; > BlockdevDetectZeroesOptions detect_zeroes =3D > BLOCKDEV_DETECT_ZEROES_OPTIONS_OFF; > + const char *blk_id; > const char *throttling_group =3D NULL; > =20 > /* Check common options by copying from bs_opts to opts, all other= options > @@ -512,6 +513,8 @@ static BlockBackend *blockdev_init(const char *file= , QDict *bs_opts, > =20 > writethrough =3D !qemu_opt_get_bool(opts, BDRV_OPT_CACHE_WB, true)= ; > =20 > + blk_id =3D qemu_opts_id(opts); > + Side note: The "id" variable is supposed to contain the exact same value, but the string it points to is invalidated by the qdict_del(bs_opts, "id") call. So indeed we need to obtain the ID anew here (or we'd have to do g_strdup() before and g_free() after, which is cumbersome). But regarding the variable itself, you could have actually reused "id" (I only noticed that just now). But that's just a minor thing, so: Reviewed-by: Max Reitz > qdict_extract_subqdict(bs_opts, &interval_dict, "stats-intervals."= ); > qdict_array_split(interval_dict, &interval_list); > =20 > @@ -616,7 +619,7 @@ static BlockBackend *blockdev_init(const char *file= , QDict *bs_opts, > /* disk I/O throttling */ > if (throttle_enabled(&cfg)) { > if (!throttling_group) { > - throttling_group =3D blk_name(blk); > + throttling_group =3D blk_id; > } > blk_io_limits_enable(blk, throttling_group); > blk_set_io_limits(blk, &cfg); > @@ -625,7 +628,7 @@ static BlockBackend *blockdev_init(const char *file= , QDict *bs_opts, > blk_set_enable_write_cache(blk, !writethrough); > blk_set_on_error(blk, on_read_error, on_write_error); > =20 > - if (!monitor_add_blk(blk, qemu_opts_id(opts), errp)) { > + if (!monitor_add_blk(blk, blk_id, errp)) { > blk_unref(blk); > blk =3D NULL; > goto err_no_bs_opts; >=20 --QqdVRmQDBBv9XdWiECQCMmERGfDGxNEmS-- --HdC7mDcIfLvLh6E5m4xfmLSRoXcE7bFkA Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQEvBAEBCAAZBQJXf7dIEhxtcmVpdHpAcmVkaGF0LmNvbQAKCRA7sUIC6DisrcnY B/9jRbe1T/mHz7y384qRTLjVNQTIavTRggg73GlqFvbCucUzjlEqb2ALPYnjdfD0 3caPSL5PPnWeUvCI1eY5Fe7hGyceUBp+nDrPOsnyxWNdynXNk5wekSgEgKXq4i7Z VjSxe6ZLx3nShmzpxpglCVKsA+n7un26i9Mq+yhYQZqAYoLAv4n3DOWLA/bAP23m H3vBwiZWeXaARbwJQwyVwEkxL0ostfvKM03wsWZmOaRcF6XdcFxpIArMFChJOAUD J8prBI5fI4gYrM/dhePWHYnq6VbM6/zEoW1qwvQXvPRxvTUa4E/MefnBbA9+wI9w 9NHiZRuW2ka1Uo81BvXWpY51 =Gjyk -----END PGP SIGNATURE----- --HdC7mDcIfLvLh6E5m4xfmLSRoXcE7bFkA-- From MAILER-DAEMON Fri Jul 08 10:26:11 2016 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1bLWjK-0004x7-Tc for mharc-qemu-stable@gnu.org; Fri, 08 Jul 2016 10:26:10 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53263) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bLWjE-0004j2-14 for qemu-stable@nongnu.org; Fri, 08 Jul 2016 10:26:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bLWjC-00031Q-24 for qemu-stable@nongnu.org; Fri, 08 Jul 2016 10:26:02 -0400 Received: from smtp3.mundo-r.com ([212.51.32.191]:59112 helo=smtp4.mundo-r.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bLWj3-0002y5-MI; Fri, 08 Jul 2016 10:25:53 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A2DHAQDCtn9X/5tjdVtbGgEBAQGDIIFSjSqXBpJVgg+Be4YYAoEnOBQBAQEBAQEBZSeETQEBBHkQCw4KCSUPASwbBgESiDQBvWQBAQEBAQEBAwEBAQEBIoVfhRWBOQGIYgWZFJ17kA4eNoIWJoE3OjKJMgEBAQ X-IPAS-Result: A2DHAQDCtn9X/5tjdVtbGgEBAQGDIIFSjSqXBpJVgg+Be4YYAoEnOBQBAQEBAQEBZSeETQEBBHkQCw4KCSUPASwbBgESiDQBvWQBAQEBAQEBAwEBAQEBIoVfhRWBOQGIYgWZFJ17kA4eNoIWJoE3OjKJMgEBAQ X-IronPort-AV: E=Sophos;i="5.28,330,1464645600"; d="scan'208";a="82793651" Received: from fanzine.igalia.com ([91.117.99.155]) by smtp4.mundo-r.com with ESMTP; 08 Jul 2016 16:25:50 +0200 Received: from maestria.local.igalia.com ([192.168.10.14] helo=mail.igalia.com) by fanzine.igalia.com with esmtps (Cipher TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim) id 1bLWj0-0003Hj-Hp; Fri, 08 Jul 2016 16:25:50 +0200 Received: from berto by mail.igalia.com with local (Exim) id 1bLWj0-0002lJ-F9; Fri, 08 Jul 2016 16:25:50 +0200 From: Alberto Garcia To: Max Reitz , qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, Stefan Hajnoczi , qemu-stable@nongnu.org In-Reply-To: <9589dde4-638e-efe5-5791-a990fc93fe3d@redhat.com> References: <9589dde4-638e-efe5-5791-a990fc93fe3d@redhat.com> User-Agent: Notmuch/0.18.2 (http://notmuchmail.org) Emacs/24.4.1 (i586-pc-linux-gnu) Date: Fri, 08 Jul 2016 16:25:50 +0200 Message-ID: MIME-Version: 1.0 Content-Type: text/plain X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 212.51.32.191 Subject: Re: [Qemu-stable] [PATCH 1/2] blockdev: Fix regression with the default naming of throttling groups X-BeenThere: qemu-stable@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Jul 2016 14:26:09 -0000 On Fri 08 Jul 2016 04:23:03 PM CEST, Max Reitz wrote: >> + blk_id = qemu_opts_id(opts); >> + > > Side note: The "id" variable is supposed to contain the exact same > value, but the string it points to is invalidated by the > qdict_del(bs_opts, "id") call. > > So indeed we need to obtain the ID anew here (or we'd have to do > g_strdup() before and g_free() after, which is cumbersome). But > regarding the variable itself, you could have actually reused "id" (I > only noticed that just now). > > But that's just a minor thing, so: > > Reviewed-by: Max Reitz Ok, if this series doesn't get a new version feel free to modify the patch when you apply it. Berto From MAILER-DAEMON Fri Jul 08 10:39:10 2016 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1bLWvu-00018d-HS for mharc-qemu-stable@gnu.org; Fri, 08 Jul 2016 10:39:10 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57414) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bLWvo-00015P-Lr for qemu-stable@nongnu.org; Fri, 08 Jul 2016 10:39:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bLWvn-0006CU-FX for qemu-stable@nongnu.org; Fri, 08 Jul 2016 10:39:04 -0400 Received: from mx1.redhat.com ([209.132.183.28]:55389) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bLWve-00069N-ER; Fri, 08 Jul 2016 10:38:54 -0400 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 068FF72676; Fri, 8 Jul 2016 14:38:54 +0000 (UTC) Received: from [10.36.116.49] (ovpn-116-49.ams2.redhat.com [10.36.116.49]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u68EcpDp015563 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 8 Jul 2016 10:38:52 -0400 To: Alberto Garcia , qemu-devel@nongnu.org References: <4b0273851beba772975be3e3a0decb2b93846874.1467986629.git.berto@igalia.com> Cc: qemu-block@nongnu.org, qemu-stable@nongnu.org, Stefan Hajnoczi From: Max Reitz Message-ID: Date: Fri, 8 Jul 2016 16:38:51 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.1.1 MIME-Version: 1.0 In-Reply-To: <4b0273851beba772975be3e3a0decb2b93846874.1467986629.git.berto@igalia.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="1BbSWD9pGg7HMcI0WDhMbId9xT4RR2jdg" X-Scanned-By: MIMEDefang 2.68 on 10.5.11.27 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Fri, 08 Jul 2016 14:38:54 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: Re: [Qemu-stable] [PATCH for-2.6 1/2] blockdev: Fix regression with the default naming of throttling groups X-BeenThere: qemu-stable@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Jul 2016 14:39:08 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --1BbSWD9pGg7HMcI0WDhMbId9xT4RR2jdg Content-Type: multipart/mixed; boundary="o5u5mD9ndJUj8UKpijL0IC9ExgGCU9u9I" From: Max Reitz To: Alberto Garcia , qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, qemu-stable@nongnu.org, Stefan Hajnoczi Message-ID: Subject: Re: [PATCH for-2.6 1/2] blockdev: Fix regression with the default naming of throttling groups References: <4b0273851beba772975be3e3a0decb2b93846874.1467986629.git.berto@igalia.com> In-Reply-To: <4b0273851beba772975be3e3a0decb2b93846874.1467986629.git.berto@igalia.com> --o5u5mD9ndJUj8UKpijL0IC9ExgGCU9u9I Content-Type: text/plain; charset=iso-8859-15 Content-Transfer-Encoding: quoted-printable On 08.07.2016 16:05, Alberto Garcia wrote: > When I/O limits are set for a block device, the name of the throttling > group is taken from the BlockBackend if the user doesn't specify one. >=20 > Commit efaa7c4eeb7490c6f37f3 moved the naming of the BlockBackend in > blockdev_init() to the end of the function, after I/O limits are set. > The consequence is that the throttling group gets an empty name. >=20 > Signed-off-by: Alberto Garcia > Reported-by: Stefan Hajnoczi > Cc: Max Reitz > Cc: qemu-stable@nongnu.org > --- > blockdev.c | 9 ++++++--- > 1 file changed, 6 insertions(+), 3 deletions(-) Reviewed-by: Max Reitz --o5u5mD9ndJUj8UKpijL0IC9ExgGCU9u9I-- --1BbSWD9pGg7HMcI0WDhMbId9xT4RR2jdg Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQEvBAEBCAAZBQJXf7r7EhxtcmVpdHpAcmVkaGF0LmNvbQAKCRA7sUIC6DisrVV0 B/kBh9vYXGttT7+vraeNxdf+RmFCPacG+AYWxg1or1z011x6vh6Mkoh0hsjSjH1g gewu1AcrJ8wafKuz5Oi3lI+5TzA33q5lFOFVQ8PEjLcR/wMNeDqa8ZaA0GJUoyEG DMQa6s/mpQBLbCgRCYAuESh5aLkDsOSzvQVYbvOPVCgZcUHyJb1ch5+41a+2p6a8 bIxaMtM579hsfFIs8uY53+o3oz9kvIe+CQ57fQvK2qhRRUFlHtl7vedu4KkxNGN8 9pyodv30OYeSZolapwUb0fpldQompXDIIn/NqAqOy7N9IjSBPZw5MdSj6QcXTtb+ uKj5Xj6vHnN8p3or4j1kJMzY =tLyA -----END PGP SIGNATURE----- --1BbSWD9pGg7HMcI0WDhMbId9xT4RR2jdg-- From MAILER-DAEMON Fri Jul 08 10:39:40 2016 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1bLWwO-0001Rm-3w for mharc-qemu-stable@gnu.org; Fri, 08 Jul 2016 10:39:40 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57552) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bLWwH-0001Lp-As for qemu-stable@nongnu.org; Fri, 08 Jul 2016 10:39:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bLWwC-0006GY-9b for qemu-stable@nongnu.org; Fri, 08 Jul 2016 10:39:32 -0400 Received: from mx1.redhat.com ([209.132.183.28]:60190) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bLWw3-0006FZ-NQ; Fri, 08 Jul 2016 10:39:19 -0400 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 38ABDC04B313; Fri, 8 Jul 2016 14:39:19 +0000 (UTC) Received: from [10.36.116.49] (ovpn-116-49.ams2.redhat.com [10.36.116.49]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u68EdG0N015932 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 8 Jul 2016 10:39:18 -0400 To: Alberto Garcia , qemu-devel@nongnu.org References: Cc: qemu-block@nongnu.org, qemu-stable@nongnu.org, Stefan Hajnoczi From: Max Reitz Message-ID: <8d509fba-f032-f1a9-6d11-0a59e98e6307@redhat.com> Date: Fri, 8 Jul 2016 16:39:16 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.1.1 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="hggHxCVetnPLGQHwajMBAncehfsE2BAAV" X-Scanned-By: MIMEDefang 2.68 on 10.5.11.27 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Fri, 08 Jul 2016 14:39:19 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: Re: [Qemu-stable] [PATCH for-2.6 2/2] qemu-iotests: Test naming of throttling groups X-BeenThere: qemu-stable@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Jul 2016 14:39:39 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --hggHxCVetnPLGQHwajMBAncehfsE2BAAV Content-Type: multipart/mixed; boundary="QLbxjCfgTqAOW7KPSfhNpuuetJ6xjCCes" From: Max Reitz To: Alberto Garcia , qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, qemu-stable@nongnu.org, Stefan Hajnoczi Message-ID: <8d509fba-f032-f1a9-6d11-0a59e98e6307@redhat.com> Subject: Re: [PATCH for-2.6 2/2] qemu-iotests: Test naming of throttling groups References: In-Reply-To: --QLbxjCfgTqAOW7KPSfhNpuuetJ6xjCCes Content-Type: text/plain; charset=iso-8859-15 Content-Transfer-Encoding: quoted-printable On 08.07.2016 16:05, Alberto Garcia wrote: > Throttling groups are named using the 'group' parameter of the > block_set_io_throttle command and the throttling.group command-line > option. If that parameter is unspecified the groups get the name of > the block device. >=20 > This patch adds a new test to check the naming of throttling groups. >=20 > Signed-off-by: Alberto Garcia > --- > tests/qemu-iotests/093 | 98 ++++++++++++++++++++++++++++++++++++++= ++++++++ > tests/qemu-iotests/093.out | 4 +- > 2 files changed, 100 insertions(+), 2 deletions(-) Reviewed-by: Max Reitz --QLbxjCfgTqAOW7KPSfhNpuuetJ6xjCCes-- --hggHxCVetnPLGQHwajMBAncehfsE2BAAV Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQEvBAEBCAAZBQJXf7sUEhxtcmVpdHpAcmVkaGF0LmNvbQAKCRA7sUIC6DisrWoQ B/9hBGKR96q3bRxwjX7ZsGJwel50c2iZ1rtamwBwhyjN1y+yGZUx0QRcceQsHWv5 FM0sg28Ihl/ppV4c1uhu5ETwZEWQbBPIYhbkDvW2gNjWWAEm7F+suvMFYQZBUSjR Tftb5BYdKlMKZOEZnE1gKNRL5zEGV1Amby3OKFNn+Klifl87KZveCQ5wCjkO9WhU 0KVvrybcdka9yXZmW24V0lXA+dsJFlfmNm0lQeQv1ERwwJb8PPgdsuYBb+2fqXUC M+2yoztfsxIt1zS4KsTEI0RLzcunm4plvbwLYTBA8qrOjkvWcwyCH03y2Q5j2ANR RqFT84rA8V/ts3QaoXCqYQ2y =3uA3 -----END PGP SIGNATURE----- --hggHxCVetnPLGQHwajMBAncehfsE2BAAV-- From MAILER-DAEMON Fri Jul 08 12:30:31 2016 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1bLYfe-0001jD-Tr for mharc-qemu-stable@gnu.org; Fri, 08 Jul 2016 12:30:30 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58411) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bLYfa-0001Nj-F6 for qemu-stable@nongnu.org; Fri, 08 Jul 2016 12:30:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bLYfZ-0007is-G5 for qemu-stable@nongnu.org; Fri, 08 Jul 2016 12:30:26 -0400 Received: from mx1.redhat.com ([209.132.183.28]:59427) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bLYfQ-0007hs-Ph; Fri, 08 Jul 2016 12:30:16 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 621A5C04B306; Fri, 8 Jul 2016 16:30:15 +0000 (UTC) Received: from localhost (ovpn-112-18.ams2.redhat.com [10.36.112.18]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u68GU2CD031792; Fri, 8 Jul 2016 12:30:10 -0400 Date: Fri, 8 Jul 2016 17:29:51 +0100 From: Stefan Hajnoczi To: Alberto Garcia Cc: qemu-devel@nongnu.org, qemu-block@nongnu.org, qemu-stable@nongnu.org, Max Reitz Message-ID: <20160708162951.GA32237@stefanha-x1.localdomain> References: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="0OAP2g/MAC+5xKAE" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.6.1 (2016-04-27) X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Fri, 08 Jul 2016 16:30:15 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: Re: [Qemu-stable] [PATCH for-2.6 0/2] Fix regression with the default naming of throttling groups X-BeenThere: qemu-stable@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Jul 2016 16:30:29 -0000 --0OAP2g/MAC+5xKAE Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Jul 08, 2016 at 05:05:12PM +0300, Alberto Garcia wrote: > Hi, >=20 > Stefan reported this, this is a regression caused by commit > efaa7c4eeb7490c6f37f3. >=20 > I sent a separate series for the git master, this is the backport for > QEMU v2.6.0. >=20 > Berto >=20 > Alberto Garcia (2): > blockdev: Fix regression with the default naming of throttling groups > qemu-iotests: Test naming of throttling groups >=20 > blockdev.c | 9 +++-- > tests/qemu-iotests/093 | 98 ++++++++++++++++++++++++++++++++++++++++= ++++++ > tests/qemu-iotests/093.out | 4 +- > 3 files changed, 106 insertions(+), 5 deletions(-) >=20 > --=20 > 2.8.1 >=20 Reviewed-by: Stefan Hajnoczi --0OAP2g/MAC+5xKAE Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQEbBAEBAgAGBQJXf9T/AAoJEJykq7OBq3PIZfIH+KJgSyc5Klfl3KBv3N+NpYgL D4jcZwzVGippA87qoMX0Nt/kSG3lplHA1MUuLkSNQNwRdFr1VJA3ugV0cqczNEe0 GMvN022WzM4meU/qTeo6RYyqFB34WQXxaIC3eu0DTXQnPBPtjUrh9j3j8g7hBIJL mpyBEgkZWfnR6rZGQ41tbrkZMPJh4AT47l7zDtgdE6KvxaFqZ0zT+Tng8utXgJ5f UVq7nnQYHkc6HIKnZuBRSWpIAeLoH9qJwZWuCz5WWsUZHS5NDjQ1dabAkDQz7BYd vyLI12J+Fo9nL0f8w9pYZUHaNnqXKjrzB18AP7JxiXgNOYBNMGvVBQELjvQKDQ== =bXUS -----END PGP SIGNATURE----- --0OAP2g/MAC+5xKAE-- From MAILER-DAEMON Mon Jul 11 04:11:05 2016 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1bMWIz-0004Uj-HV for mharc-qemu-stable@gnu.org; Mon, 11 Jul 2016 04:11:05 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36395) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bMWHY-0001cy-Jh for qemu-stable@nongnu.org; Mon, 11 Jul 2016 04:11:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bMWHR-0000BJ-Mr for qemu-stable@nongnu.org; Mon, 11 Jul 2016 04:09:36 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:9767) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bMWHR-00007v-BH for qemu-stable@nongnu.org; Mon, 11 Jul 2016 04:09:29 -0400 Received: from pps.filterd (m0098409.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.11/8.16.0.11) with SMTP id u6B88h5r127337 for ; Mon, 11 Jul 2016 04:09:27 -0400 Received: from e06smtp15.uk.ibm.com (e06smtp15.uk.ibm.com [195.75.94.111]) by mx0a-001b2d01.pphosted.com with ESMTP id 242vjv32c2-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Mon, 11 Jul 2016 04:09:27 -0400 Received: from localhost by e06smtp15.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 11 Jul 2016 09:09:22 +0100 Received: from d06dlp03.portsmouth.uk.ibm.com (9.149.20.15) by e06smtp15.uk.ibm.com (192.168.101.145) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Mon, 11 Jul 2016 09:09:17 +0100 X-IBM-Helo: d06dlp03.portsmouth.uk.ibm.com X-IBM-MailFrom: cornelia.huck@de.ibm.com X-IBM-RcptTo: qemu-devel@nongnu.org;qemu-stable@nongnu.org Received: from b06cxnps3074.portsmouth.uk.ibm.com (d06relay09.portsmouth.uk.ibm.com [9.149.109.194]) by d06dlp03.portsmouth.uk.ibm.com (Postfix) with ESMTP id E50BE1B08067; Mon, 11 Jul 2016 09:10:36 +0100 (BST) Received: from d06av05.portsmouth.uk.ibm.com (d06av05.portsmouth.uk.ibm.com [9.149.37.229]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id u6B89GX12818308; Mon, 11 Jul 2016 08:09:16 GMT Received: from d06av05.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av05.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id u6B89FaK020237; Mon, 11 Jul 2016 02:09:16 -0600 Received: from gondolin.boeblingen.de.ibm.com (dyn-9-152-224-202.boeblingen.de.ibm.com [9.152.224.202]) by d06av05.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id u6B89EaP020066 (version=TLSv1/SSLv3 cipher=AES256-SHA256 bits=256 verify=NO); Mon, 11 Jul 2016 02:09:15 -0600 From: Cornelia Huck To: peter.maydell@linaro.org Cc: borntraeger@de.ibm.com, agraf@suse.de, jfrei@linux.vnet.ibm.com, qemu-devel@nongnu.org, David Hildenbrand , qemu-stable@nongnu.org, Cornelia Huck Date: Mon, 11 Jul 2016 10:08:51 +0200 X-Mailer: git-send-email 2.9.0 In-Reply-To: <20160711080912.13947-1-cornelia.huck@de.ibm.com> References: <20160711080912.13947-1-cornelia.huck@de.ibm.com> X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16071108-0020-0000-0000-0000021BD3FC X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 16071108-0021-0000-0000-00003CF3FB76 Message-Id: <20160711080912.13947-5-cornelia.huck@de.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2016-07-11_04:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=1 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1604210000 definitions=main-1607110089 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] X-Received-From: 148.163.156.1 Subject: [Qemu-stable] [PULL 04/25] s390x/ipl: fix reboots for migration from different bios X-BeenThere: qemu-stable@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Jul 2016 08:11:05 -0000 From: David Hildenbrand When migrating from a different QEMU version, the start_address and bios_start_address may differ. During migration these values are migrated and overwrite the values that were detected by QEMU itself. On a reboot, QEMU will reload its own BIOS, but use the migrated start addresses, which does not work if the values differ. Fix this by not relying on the migrated values anymore, but still provide them during migration, so existing QEMUs continue to work. Signed-off-by: David Hildenbrand Cc: qemu-stable@nongnu.org Signed-off-by: Cornelia Huck --- hw/s390x/ipl.c | 11 +++++++++-- hw/s390x/ipl.h | 2 ++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/hw/s390x/ipl.c b/hw/s390x/ipl.c index 78998cd..a54284c 100644 --- a/hw/s390x/ipl.c +++ b/hw/s390x/ipl.c @@ -69,8 +69,8 @@ static const VMStateDescription vmstate_ipl = { .version_id = 0, .minimum_version_id = 0, .fields = (VMStateField[]) { - VMSTATE_UINT64(start_addr, S390IPLState), - VMSTATE_UINT64(bios_start_addr, S390IPLState), + VMSTATE_UINT64(compat_start_addr, S390IPLState), + VMSTATE_UINT64(compat_bios_start_addr, S390IPLState), VMSTATE_STRUCT(iplb, S390IPLState, 0, vmstate_iplb, IplParameterBlock), VMSTATE_BOOL(iplb_valid, S390IPLState), VMSTATE_UINT8(cssid, S390IPLState), @@ -192,6 +192,13 @@ static void s390_ipl_realize(DeviceState *dev, Error **errp) stq_p(rom_ptr(INITRD_PARM_SIZE), initrd_size); } } + /* + * Don't ever use the migrated values, they could come from a different + * BIOS and therefore don't work. But still migrate the values, so + * QEMUs relying on it don't break. + */ + ipl->compat_start_addr = ipl->start_addr; + ipl->compat_bios_start_addr = ipl->bios_start_addr; qemu_register_reset(qdev_reset_all_fn, dev); error: error_propagate(errp, err); diff --git a/hw/s390x/ipl.h b/hw/s390x/ipl.h index ed3f2c8..c891095 100644 --- a/hw/s390x/ipl.h +++ b/hw/s390x/ipl.h @@ -93,7 +93,9 @@ struct S390IPLState { /*< private >*/ DeviceState parent_obj; uint64_t start_addr; + uint64_t compat_start_addr; uint64_t bios_start_addr; + uint64_t compat_bios_start_addr; bool enforce_bios; IplParameterBlock iplb; bool iplb_valid; -- 2.9.0 From MAILER-DAEMON Mon Jul 18 04:00:33 2016 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1bP3Td-0007nw-GF for mharc-qemu-stable@gnu.org; Mon, 18 Jul 2016 04:00:33 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49340) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bP3TX-0007it-LQ for qemu-stable@nongnu.org; Mon, 18 Jul 2016 04:00:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bP3TU-00074n-MG for qemu-stable@nongnu.org; Mon, 18 Jul 2016 04:00:26 -0400 Received: from mx-v6.kamp.de ([2a02:248:0:51::16]:46790 helo=mx01.kamp.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bP3TU-00072t-Bp for qemu-stable@nongnu.org; Mon, 18 Jul 2016 04:00:24 -0400 Received: (qmail 1577 invoked by uid 89); 18 Jul 2016 08:00:22 -0000 Received: from [195.62.97.28] by client-16-kamp (envelope-from , uid 89) with qmail-scanner-2010/03/19-MF (clamdscan: 0.99.2/21923. hbedv: 8.3.40.44/7.12.99.34. avast: 1.2.2/16071700. spamassassin: 3.4.1. Clear:RC:1(195.62.97.28):. Processed in 0.105739 secs); 18 Jul 2016 08:00:22 -0000 Received: from smtp.kamp.de (HELO submission.kamp.de) ([195.62.97.28]) by mx01.kamp.de with ESMTPS (DHE-RSA-AES256-GCM-SHA384 encrypted); 18 Jul 2016 08:00:20 -0000 X-GL_Whitelist: yes Received: (qmail 28282 invoked from network); 18 Jul 2016 08:00:20 -0000 Received: from lieven-pc.kamp-intra.net (HELO ?172.21.12.60?) (pl@kamp.de@::ffff:172.21.12.60) by submission.kamp.de with ESMTPS (DHE-RSA-AES128-SHA encrypted) ESMTPA; 18 Jul 2016 08:00:20 -0000 To: Paolo Bonzini , Eric Blake , Fam Zheng , qemu-devel@nongnu.org References: <1468306113-847-1-git-send-email-famz@redhat.com> <578512BB.3040003@redhat.com> <9832869c-5e80-6636-8618-e4251f649726@redhat.com> Cc: Miroslav Rezanina , Stefan Hajnoczi , Max Reitz , qemu-stable@nongnu.org From: Peter Lieven Message-ID: <578C8C8B.1040700@kamp.de> Date: Mon, 18 Jul 2016 10:00:11 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.8.0 MIME-Version: 1.0 In-Reply-To: <9832869c-5e80-6636-8618-e4251f649726@redhat.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a02:248:0:51::16 Subject: Re: [Qemu-stable] [PATCH] util: Fix MIN_NON_ZERO X-BeenThere: qemu-stable@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Jul 2016 08:00:32 -0000 Am 12.07.2016 um 18:24 schrieb Paolo Bonzini: > > On 12/07/2016 17:54, Eric Blake wrote: >> On 07/12/2016 12:48 AM, Fam Zheng wrote: >>> MIN_NON_ZERO(0, 1) is evaluated to 0. Rewrite the macro to fix it. >> Huh? >> >> Old expansion, in various stages: >> >> (((0) != 0 && (0) < (1)) ? (0) : (1)) >> ((0 && 1) ? 0 : 1) >> (0 ? 0 : 1) >> 1 >> >> Maybe you meant MIN_NON_ZERO(1, 0), which evaluates to: >> >> (((1) != 0 && (1) < (0)) ? (1) : (0)) >> ((1 && 0) ? 1 : 0) >> (0 ? 1 : 0) >> 0 >> >> in which case, you are correct that there is a bug. > Commit message fixed, patch queued. > > Paolo Shouldn't we Cc qemu-stable? Peter From MAILER-DAEMON Mon Jul 18 04:52:49 2016 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1bP4IC-0003tF-R6 for mharc-qemu-stable@gnu.org; Mon, 18 Jul 2016 04:52:48 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57781) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bP4IA-0003gf-Ih for qemu-stable@nongnu.org; Mon, 18 Jul 2016 04:52:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bP4I7-0008BZ-Ds for qemu-stable@nongnu.org; Mon, 18 Jul 2016 04:52:46 -0400 Received: from mx-v6.kamp.de ([2a02:248:0:51::16]:57914 helo=mx01.kamp.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bP4I7-0008Aq-2s for qemu-stable@nongnu.org; Mon, 18 Jul 2016 04:52:43 -0400 Received: (qmail 5003 invoked by uid 89); 18 Jul 2016 08:52:40 -0000 Received: from [195.62.97.28] by client-16-kamp (envelope-from , uid 89) with qmail-scanner-2010/03/19-MF (clamdscan: 0.99.2/21924. hbedv: 8.3.40.44/7.12.99.34. avast: 1.2.2/16071700. spamassassin: 3.4.1. Clear:RC:1(195.62.97.28):. Processed in 0.247004 secs); 18 Jul 2016 08:52:40 -0000 Received: from smtp.kamp.de (HELO submission.kamp.de) ([195.62.97.28]) by mx01.kamp.de with ESMTPS (DHE-RSA-AES256-GCM-SHA384 encrypted); 18 Jul 2016 08:52:37 -0000 X-GL_Whitelist: yes Received: (qmail 28432 invoked from network); 18 Jul 2016 08:52:36 -0000 Received: from lieven-pc.kamp-intra.net (HELO lieven-pc) (relay@kamp.de@::ffff:172.21.12.60) by submission.kamp.de with ESMTPS (DHE-RSA-AES256-GCM-SHA384 encrypted) ESMTPA; 18 Jul 2016 08:52:36 -0000 Received: by lieven-pc (Postfix, from userid 1000) id 0C57A203D8; Mon, 18 Jul 2016 10:52:28 +0200 (CEST) From: Peter Lieven To: qemu-block@nongnu.org Cc: qemu-devel@nongnu.org, pbonzini@redhat.com, kwolf@redhat.com, mreitz@redhat.com, ronniesahlberg@gmail.com, famz@redhat.com, Peter Lieven , qemu-stable@nongnu.org Date: Mon, 18 Jul 2016 10:52:19 +0200 Message-Id: <1468831940-15556-2-git-send-email-pl@kamp.de> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1468831940-15556-1-git-send-email-pl@kamp.de> References: <1468831940-15556-1-git-send-email-pl@kamp.de> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a02:248:0:51::16 Subject: [Qemu-stable] [PATCH V5 1/2] block/iscsi: fix rounding in iscsi_allocationmap_set X-BeenThere: qemu-stable@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Jul 2016 08:52:47 -0000 when setting clusters as alloacted the boundaries have to be expanded. As Paolo pointed out the calculation of the number of clusters is wrong: Suppose cluster_sectors is 2, sector_num = 1, nb_sectors = 6: In the "mark allocated" case, you want to set 0..8, i.e. cluster_num=0, nb_clusters=4. 0--.--2--.--4--.--6--.--8 <--|_________________|--> (<--> = expanded) Instead you are setting nb_clusters=3, so that 6..8 is not marked. 0--.--2--.--4--.--6--.--8 <--|______________|!!! (! = wrong) Cc: qemu-stable@nongnu.org Reported-by: Paolo Bonzini Signed-off-by: Peter Lieven --- block/iscsi.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/block/iscsi.c b/block/iscsi.c index cf1e9e7..22330e1 100644 --- a/block/iscsi.c +++ b/block/iscsi.c @@ -432,12 +432,14 @@ static unsigned long *iscsi_allocationmap_init(IscsiLun *iscsilun) static void iscsi_allocationmap_set(IscsiLun *iscsilun, int64_t sector_num, int nb_sectors) { + int64_t cluster_num, nb_clusters; if (iscsilun->allocationmap == NULL) { return; } - bitmap_set(iscsilun->allocationmap, - sector_num / iscsilun->cluster_sectors, - DIV_ROUND_UP(nb_sectors, iscsilun->cluster_sectors)); + cluster_num = sector_num / iscsilun->cluster_sectors; + nb_clusters = DIV_ROUND_UP(sector_num + nb_sectors, + iscsilun->cluster_sectors) - cluster_num; + bitmap_set(iscsilun->allocationmap, cluster_num, nb_clusters); } static void iscsi_allocationmap_clear(IscsiLun *iscsilun, int64_t sector_num, -- 1.9.1 From MAILER-DAEMON Mon Jul 18 05:28:52 2016 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1bP4r5-00058U-TP for mharc-qemu-stable@gnu.org; Mon, 18 Jul 2016 05:28:52 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36470) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bP4qz-00051h-P7 for qemu-stable@nongnu.org; Mon, 18 Jul 2016 05:28:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bP4qx-0006g7-Pp for qemu-stable@nongnu.org; Mon, 18 Jul 2016 05:28:44 -0400 Received: from mx1.redhat.com ([209.132.183.28]:49596) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bP4qu-0006fB-Gs; Mon, 18 Jul 2016 05:28:40 -0400 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 223FD64D17; Mon, 18 Jul 2016 09:28:40 +0000 (UTC) Received: from donizetti.redhat.com (ovpn-112-56.ams2.redhat.com [10.36.112.56]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u6I9RuJH025611; Mon, 18 Jul 2016 05:28:38 -0400 From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: Peter Lieven , qemu-stable@nongnu.org Date: Mon, 18 Jul 2016 11:27:54 +0200 Message-Id: <1468834075-25669-23-git-send-email-pbonzini@redhat.com> In-Reply-To: <1468834075-25669-1-git-send-email-pbonzini@redhat.com> References: <1468834075-25669-1-git-send-email-pbonzini@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.27 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Mon, 18 Jul 2016 09:28:40 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-stable] [PULL 22/23] block/iscsi: fix rounding in iscsi_allocationmap_set X-BeenThere: qemu-stable@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Jul 2016 09:28:50 -0000 From: Peter Lieven when setting clusters as alloacted the boundaries have to be expanded. As Paolo pointed out the calculation of the number of clusters is wrong: Suppose cluster_sectors is 2, sector_num = 1, nb_sectors = 6: In the "mark allocated" case, you want to set 0..8, i.e. cluster_num=0, nb_clusters=4. 0--.--2--.--4--.--6--.--8 <--|_________________|--> (<--> = expanded) Instead you are setting nb_clusters=3, so that 6..8 is not marked. 0--.--2--.--4--.--6--.--8 <--|______________|!!! (! = wrong) Cc: qemu-stable@nongnu.org Reported-by: Paolo Bonzini Signed-off-by: Peter Lieven Message-Id: <1468831940-15556-2-git-send-email-pl@kamp.de> Signed-off-by: Paolo Bonzini --- block/iscsi.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/block/iscsi.c b/block/iscsi.c index cf1e9e7..22330e1 100644 --- a/block/iscsi.c +++ b/block/iscsi.c @@ -432,12 +432,14 @@ static unsigned long *iscsi_allocationmap_init(IscsiLun *iscsilun) static void iscsi_allocationmap_set(IscsiLun *iscsilun, int64_t sector_num, int nb_sectors) { + int64_t cluster_num, nb_clusters; if (iscsilun->allocationmap == NULL) { return; } - bitmap_set(iscsilun->allocationmap, - sector_num / iscsilun->cluster_sectors, - DIV_ROUND_UP(nb_sectors, iscsilun->cluster_sectors)); + cluster_num = sector_num / iscsilun->cluster_sectors; + nb_clusters = DIV_ROUND_UP(sector_num + nb_sectors, + iscsilun->cluster_sectors) - cluster_num; + bitmap_set(iscsilun->allocationmap, cluster_num, nb_clusters); } static void iscsi_allocationmap_clear(IscsiLun *iscsilun, int64_t sector_num, -- 2.7.4 From MAILER-DAEMON Tue Jul 19 00:08:27 2016 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1bPMKZ-0002K2-31 for mharc-qemu-stable@gnu.org; Tue, 19 Jul 2016 00:08:27 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35281) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bPMKP-00028p-Qr for qemu-stable@nongnu.org; Tue, 19 Jul 2016 00:08:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bPMKO-0002qI-9A for qemu-stable@nongnu.org; Tue, 19 Jul 2016 00:08:17 -0400 Received: from mx1.redhat.com ([209.132.183.28]:43783) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bPMKD-0002jb-Sj; Tue, 19 Jul 2016 00:08:06 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 89EF0C05AA46; Tue, 19 Jul 2016 04:08:05 +0000 (UTC) Received: from red.redhat.com (ovpn-116-181.phx2.redhat.com [10.3.116.181]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u6J4832c001375; Tue, 19 Jul 2016 00:08:04 -0400 From: Eric Blake To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, pbonzini@redhat.com, qemu-stable@nongnu.org, Kevin Wolf , Max Reitz Date: Mon, 18 Jul 2016 22:07:50 -0600 Message-Id: <1468901281-22858-4-git-send-email-eblake@redhat.com> In-Reply-To: <1468901281-22858-1-git-send-email-eblake@redhat.com> References: <1468901281-22858-1-git-send-email-eblake@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Tue, 19 Jul 2016 04:08:05 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-stable] [PATCH v5 03/14] nbd: Limit nbdflags to 16 bits X-BeenThere: qemu-stable@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Jul 2016 04:08:19 -0000 Rather than asserting that nbdflags is within range, just give it the correct type to begin with :) nbdflags corresponds to the per-export portion of NBD Protocol "transmission flags", which is 16 bits in response to NBD_OPT_EXPORT_NAME and NBD_OPT_GO. Furthermore, upstream NBD has never passed the global flags to the kernel via ioctl(NBD_SET_FLAGS) (the ioctl was first introduced in NBD 2.9.22; then a latent bug in NBD 3.1 actually tried to OR the global flags with the transmission flags, with the disaster that the addition of NBD_FLAG_NO_ZEROES in 3.9 caused all earlier NBD 3.x clients to treat every export as read-only; NBD 3.10 and later intentionally clip things to 16 bits to pass only transmission flags). Qemu should follow suit, since the current two global flags (NBD_FLAG_FIXED_NEWSTYLE and NBD_FLAG_NO_ZEROES) have no impact on the kernel's behavior during transmission. CC: qemu-stable@nongnu.org Signed-off-by: Eric Blake --- v4: rebase, cc qemu-stable v3: expand scope of patch --- block/nbd-client.h | 2 +- include/block/nbd.h | 6 +++--- nbd/client.c | 28 +++++++++++++++------------- nbd/server.c | 10 ++++------ qemu-nbd.c | 4 ++-- 5 files changed, 25 insertions(+), 25 deletions(-) diff --git a/block/nbd-client.h b/block/nbd-client.h index fa9817b..044aca4 100644 --- a/block/nbd-client.h +++ b/block/nbd-client.h @@ -20,7 +20,7 @@ typedef struct NbdClientSession { QIOChannelSocket *sioc; /* The master data channel */ QIOChannel *ioc; /* The current I/O channel which may differ (eg TLS) */ - uint32_t nbdflags; + uint16_t nbdflags; off_t size; CoMutex send_mutex; diff --git a/include/block/nbd.h b/include/block/nbd.h index 309db2b..fd7e30b 100644 --- a/include/block/nbd.h +++ b/include/block/nbd.h @@ -90,11 +90,11 @@ ssize_t nbd_wr_syncv(QIOChannel *ioc, size_t niov, size_t length, bool do_read); -int nbd_receive_negotiate(QIOChannel *ioc, const char *name, uint32_t *flags, +int nbd_receive_negotiate(QIOChannel *ioc, const char *name, uint16_t *flags, QCryptoTLSCreds *tlscreds, const char *hostname, QIOChannel **outioc, off_t *size, Error **errp); -int nbd_init(int fd, QIOChannelSocket *sioc, uint32_t flags, off_t size); +int nbd_init(int fd, QIOChannelSocket *sioc, uint16_t flags, off_t size); ssize_t nbd_send_request(QIOChannel *ioc, struct nbd_request *request); ssize_t nbd_receive_reply(QIOChannel *ioc, struct nbd_reply *reply); int nbd_client(int fd); @@ -104,7 +104,7 @@ typedef struct NBDExport NBDExport; typedef struct NBDClient NBDClient; NBDExport *nbd_export_new(BlockBackend *blk, off_t dev_offset, off_t size, - uint32_t nbdflags, void (*close)(NBDExport *), + uint16_t nbdflags, void (*close)(NBDExport *), Error **errp); void nbd_export_close(NBDExport *exp); void nbd_export_get(NBDExport *exp); diff --git a/nbd/client.c b/nbd/client.c index 78a7195..a92f1e2 100644 --- a/nbd/client.c +++ b/nbd/client.c @@ -408,7 +408,7 @@ static QIOChannel *nbd_receive_starttls(QIOChannel *ioc, } -int nbd_receive_negotiate(QIOChannel *ioc, const char *name, uint32_t *flags, +int nbd_receive_negotiate(QIOChannel *ioc, const char *name, uint16_t *flags, QCryptoTLSCreds *tlscreds, const char *hostname, QIOChannel **outioc, off_t *size, Error **errp) @@ -468,7 +468,6 @@ int nbd_receive_negotiate(QIOChannel *ioc, const char *name, uint32_t *flags, uint32_t opt; uint32_t namesize; uint16_t globalflags; - uint16_t exportflags; bool fixedNewStyle = false; if (read_sync(ioc, &globalflags, sizeof(globalflags)) != @@ -477,7 +476,6 @@ int nbd_receive_negotiate(QIOChannel *ioc, const char *name, uint32_t *flags, goto fail; } globalflags = be16_to_cpu(globalflags); - *flags = globalflags << 16; TRACE("Global flags are %" PRIx32, globalflags); if (globalflags & NBD_FLAG_FIXED_NEWSTYLE) { fixedNewStyle = true; @@ -545,17 +543,15 @@ int nbd_receive_negotiate(QIOChannel *ioc, const char *name, uint32_t *flags, goto fail; } *size = be64_to_cpu(s); - TRACE("Size is %" PRIu64, *size); - if (read_sync(ioc, &exportflags, sizeof(exportflags)) != - sizeof(exportflags)) { + if (read_sync(ioc, flags, sizeof(*flags)) != sizeof(*flags)) { error_setg(errp, "Failed to read export flags"); goto fail; } - exportflags = be16_to_cpu(exportflags); - *flags |= exportflags; - TRACE("Export flags are %" PRIx16, exportflags); + be16_to_cpus(flags); } else if (magic == NBD_CLIENT_MAGIC) { + uint32_t oldflags; + if (name) { error_setg(errp, "Server does not support export names"); goto fail; @@ -572,16 +568,22 @@ int nbd_receive_negotiate(QIOChannel *ioc, const char *name, uint32_t *flags, *size = be64_to_cpu(s); TRACE("Size is %" PRIu64, *size); - if (read_sync(ioc, flags, sizeof(*flags)) != sizeof(*flags)) { + if (read_sync(ioc, &oldflags, sizeof(oldflags)) != sizeof(oldflags)) { error_setg(errp, "Failed to read export flags"); goto fail; } - *flags = be32_to_cpu(*flags); + be32_to_cpus(&oldflags); + if (oldflags & ~0xffff) { + error_setg(errp, "Unexpected export flags %0x" PRIx32, oldflags); + goto fail; + } + *flags = oldflags; } else { error_setg(errp, "Bad magic received"); goto fail; } + TRACE("Size is %" PRIu64 ", export flags %" PRIx16, *size, *flags); if (read_sync(ioc, &buf, 124) != 124) { error_setg(errp, "Failed to read reserved block"); goto fail; @@ -593,7 +595,7 @@ fail: } #ifdef __linux__ -int nbd_init(int fd, QIOChannelSocket *sioc, uint32_t flags, off_t size) +int nbd_init(int fd, QIOChannelSocket *sioc, uint16_t flags, off_t size) { unsigned long sectors = size / BDRV_SECTOR_SIZE; if (size / BDRV_SECTOR_SIZE != sectors) { @@ -689,7 +691,7 @@ int nbd_disconnect(int fd) } #else -int nbd_init(int fd, QIOChannelSocket *ioc, uint32_t flags, off_t size) +int nbd_init(int fd, QIOChannelSocket *ioc, uint16_t flags, off_t size) { return -ENOTSUP; } diff --git a/nbd/server.c b/nbd/server.c index 438944c..6b68706 100644 --- a/nbd/server.c +++ b/nbd/server.c @@ -64,7 +64,7 @@ struct NBDExport { char *description; off_t dev_offset; off_t size; - uint32_t nbdflags; + uint16_t nbdflags; QTAILQ_HEAD(, NBDClient) clients; QTAILQ_ENTRY(NBDExport) next; @@ -554,8 +554,8 @@ static coroutine_fn int nbd_negotiate(NBDClientNewData *data) NBDClient *client = data->client; char buf[8 + 8 + 8 + 128]; int rc; - const int myflags = (NBD_FLAG_HAS_FLAGS | NBD_FLAG_SEND_TRIM | - NBD_FLAG_SEND_FLUSH | NBD_FLAG_SEND_FUA); + const uint16_t myflags = (NBD_FLAG_HAS_FLAGS | NBD_FLAG_SEND_TRIM | + NBD_FLAG_SEND_FLUSH | NBD_FLAG_SEND_FUA); bool oldStyle; /* Old style negotiation header without options @@ -585,7 +585,6 @@ static coroutine_fn int nbd_negotiate(NBDClientNewData *data) oldStyle = client->exp != NULL && !client->tlscreds; if (oldStyle) { - assert ((client->exp->nbdflags & ~65535) == 0); TRACE("advertising size %" PRIu64 " and flags %x", client->exp->size, client->exp->nbdflags | myflags); stq_be_p(buf + 8, NBD_CLIENT_MAGIC); @@ -616,7 +615,6 @@ static coroutine_fn int nbd_negotiate(NBDClientNewData *data) goto fail; } - assert ((client->exp->nbdflags & ~65535) == 0); TRACE("advertising size %" PRIu64 " and flags %x", client->exp->size, client->exp->nbdflags | myflags); stq_be_p(buf + 18, client->exp->size); @@ -820,7 +818,7 @@ static void nbd_eject_notifier(Notifier *n, void *data) } NBDExport *nbd_export_new(BlockBackend *blk, off_t dev_offset, off_t size, - uint32_t nbdflags, void (*close)(NBDExport *), + uint16_t nbdflags, void (*close)(NBDExport *), Error **errp) { NBDExport *exp = g_malloc0(sizeof(NBDExport)); diff --git a/qemu-nbd.c b/qemu-nbd.c index 34be33d..64f863c 100644 --- a/qemu-nbd.c +++ b/qemu-nbd.c @@ -252,7 +252,7 @@ static void *nbd_client_thread(void *arg) { char *device = arg; off_t size; - uint32_t nbdflags; + uint16_t nbdflags; QIOChannelSocket *sioc; int fd; int ret; @@ -466,7 +466,7 @@ int main(int argc, char **argv) BlockBackend *blk; BlockDriverState *bs; off_t dev_offset = 0; - uint32_t nbdflags = 0; + uint16_t nbdflags = 0; bool disconnect = false; const char *bindto = "0.0.0.0"; const char *port = NULL; -- 2.5.5 From MAILER-DAEMON Tue Jul 19 04:34:46 2016 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1bPQUI-0006OU-8V for mharc-qemu-stable@gnu.org; Tue, 19 Jul 2016 04:34:46 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43148) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bPQUC-0006EU-BJ for qemu-stable@nongnu.org; Tue, 19 Jul 2016 04:34:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bPQUA-0003Q7-8s for qemu-stable@nongnu.org; Tue, 19 Jul 2016 04:34:39 -0400 Received: from mail-wm0-x241.google.com ([2a00:1450:400c:c09::241]:33043) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bPQU7-0003P7-2Z; Tue, 19 Jul 2016 04:34:35 -0400 Received: by mail-wm0-x241.google.com with SMTP id o80so2022249wme.0; Tue, 19 Jul 2016 01:34:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=GSJRXDTISxqtNxYSQW5yuRemKtsemaFhd8O4+5dWiqU=; b=QmSe46pABVA9S4L1q4xIIUNaVFfKRnv+876IZbRLnt3+mupgMpnQ+6SjqXReP8SqkT Pi5NpX6iCmIE8yqbnnrAIVjo12XDw6PZ+iXWyAl98VlNv0GljRdIfwx9mQGmrAOLGEuM enydkYo6EOO3RoHyfthJDFldNSsfndpkH2mLqc9Ght89wZMqXUYIoLlzHRA1GKydCyZi C7ztjmkm/9DmokFJ4jFd2QftG28+3DQzKLCkOALbgy8yKNhZXCxIG4RkOxbLEAqzWzrk apDV7XPowNVd7qCQx8YzXf2gH5HUCRZyQ8tqD+W33KE1NsfDcVGxhR23vKaNsucfNxF4 vl+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=GSJRXDTISxqtNxYSQW5yuRemKtsemaFhd8O4+5dWiqU=; b=BP9g7/QOJCaJpuCcHVr3XxBiXO6fOX1zh5AcJhlv7iMqQmkDZbRVnRbLfkS+jPE9GF 51yOy29XyGpd69KKOHO9G5QLzA/RdlLBXUT29Ys7lRI0MDWKpNAvmvPSbDrTz4xkVi4I zEGv5VgHyE11zQiRA7QzcU63NrbNX7cBJ+ZRd9z0B0vZktIChPjtr9cykl3MoDiyfZ0q kCbm2w8MuoyRKRHJPGHM07JyafzbXdnNVJW3ILWExBbd2bkN+dgBgzkbwg/vb8M0A2YX 9iQdV25e16uyoT4xL/ch2Wc09ugw791aV/PKwRdftGvz4QIDyuq8GYvOtj+RyCW5xKyW ZRIw== X-Gm-Message-State: ALyK8tKyFSopc6IMewcScxSBU+PYOM+1lShwfGbGVB9GkgaOqd0vxHqCYKMu+J1MGCBHzg== X-Received: by 10.28.166.140 with SMTP id p134mr2302600wme.21.1468917274293; Tue, 19 Jul 2016 01:34:34 -0700 (PDT) Received: from donizetti.lan (94-39-158-5.adsl-ull.clienti.tiscali.it. [94.39.158.5]) by smtp.gmail.com with ESMTPSA id o142sm20886055wme.20.2016.07.19.01.34.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 19 Jul 2016 01:34:33 -0700 (PDT) Sender: Paolo Bonzini From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: Peter Lieven , qemu-stable@nongnu.org Date: Tue, 19 Jul 2016 10:34:17 +0200 Message-Id: <1468917259-8475-11-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1468917259-8475-1-git-send-email-pbonzini@redhat.com> References: <1468917259-8475-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:400c:c09::241 Subject: [Qemu-stable] [PULL 10/12] block/iscsi: fix rounding in iscsi_allocationmap_set X-BeenThere: qemu-stable@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Jul 2016 08:34:45 -0000 From: Peter Lieven when setting clusters as alloacted the boundaries have to be expanded. As Paolo pointed out the calculation of the number of clusters is wrong: Suppose cluster_sectors is 2, sector_num = 1, nb_sectors = 6: In the "mark allocated" case, you want to set 0..8, i.e. cluster_num=0, nb_clusters=4. 0--.--2--.--4--.--6--.--8 <--|_________________|--> (<--> = expanded) Instead you are setting nb_clusters=3, so that 6..8 is not marked. 0--.--2--.--4--.--6--.--8 <--|______________|!!! (! = wrong) Cc: qemu-stable@nongnu.org Reported-by: Paolo Bonzini Signed-off-by: Peter Lieven Message-Id: <1468831940-15556-2-git-send-email-pl@kamp.de> Signed-off-by: Paolo Bonzini --- block/iscsi.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/block/iscsi.c b/block/iscsi.c index cf1e9e7..22330e1 100644 --- a/block/iscsi.c +++ b/block/iscsi.c @@ -432,12 +432,14 @@ static unsigned long *iscsi_allocationmap_init(IscsiLun *iscsilun) static void iscsi_allocationmap_set(IscsiLun *iscsilun, int64_t sector_num, int nb_sectors) { + int64_t cluster_num, nb_clusters; if (iscsilun->allocationmap == NULL) { return; } - bitmap_set(iscsilun->allocationmap, - sector_num / iscsilun->cluster_sectors, - DIV_ROUND_UP(nb_sectors, iscsilun->cluster_sectors)); + cluster_num = sector_num / iscsilun->cluster_sectors; + nb_clusters = DIV_ROUND_UP(sector_num + nb_sectors, + iscsilun->cluster_sectors) - cluster_num; + bitmap_set(iscsilun->allocationmap, cluster_num, nb_clusters); } static void iscsi_allocationmap_clear(IscsiLun *iscsilun, int64_t sector_num, -- 2.7.4 From MAILER-DAEMON Tue Jul 19 18:01:09 2016 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1bPd4f-0001ki-DE for mharc-qemu-stable@gnu.org; Tue, 19 Jul 2016 18:01:09 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33526) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bPd4Y-0001go-8I for qemu-stable@nongnu.org; Tue, 19 Jul 2016 18:01:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bPd4W-0000An-Q0 for qemu-stable@nongnu.org; Tue, 19 Jul 2016 18:01:02 -0400 Received: from mx1.redhat.com ([209.132.183.28]:61658) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bPd4P-00007a-U8; Tue, 19 Jul 2016 18:00:54 -0400 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8AF51619FF; Tue, 19 Jul 2016 22:00:52 +0000 (UTC) Received: from redhat.com (vpn1-7-82.ams2.redhat.com [10.36.7.82]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with SMTP id u6JM0g4K028373; Tue, 19 Jul 2016 18:00:45 -0400 Date: Wed, 20 Jul 2016 01:00:39 +0300 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , qemu-stable@nongnu.org, Benjamin Herrenschmidt , Marcel Apfelbaum , dgilbert@redhat.com Message-ID: <20160719220039.GA32236@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Mutt-Fcc: =sent X-Scanned-By: MIMEDefang 2.68 on 10.5.11.26 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Tue, 19 Jul 2016 22:00:52 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-stable] [PATCH] pcie: fix link active status bit migration X-BeenThere: qemu-stable@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Jul 2016 22:01:07 -0000 We changed link status register in pci express endpoint capability over time. Specifically, commit b2101eae63ea57b571cee4a9075a4287d24ba4a4 ("pcie: Set the "link active" in the link status register") set data link layer link active bit in this register without adding compatibility to old machine types. When migrating from qemu 2.3 and older this affects xhci devices which under machine type 2.0 and older have a pci express endpoint capability even if they are on a pci bus. Add compatibility flags to make this bit value match what it was under 2.3. Additionally, to avoid breaking migration from qemu 2.3 and up, suppress checking link status during migration: this seems sane since hardware can change link status at any time. https://bugzilla.redhat.com/show_bug.cgi?id=1352860 Reported-by: Gerd Hoffmann Fixes: b2101eae63ea57b571cee4a9075a4287d24ba4a4 ("pcie: Set the "link active" in the link status register") Cc: qemu-stable@nongnu.org Cc: Benjamin Herrenschmidt Signed-off-by: Michael S. Tsirkin --- include/hw/compat.h | 4 ++++ include/hw/pci/pci.h | 3 +++ hw/pci/pci.c | 2 ++ hw/pci/pcie.c | 24 ++++++++++++++++++------ 4 files changed, 27 insertions(+), 6 deletions(-) diff --git a/include/hw/compat.h b/include/hw/compat.h index 9914e7a..e5113dc 100644 --- a/include/hw/compat.h +++ b/include/hw/compat.h @@ -80,6 +80,10 @@ .driver = "virtio-rng-pci",\ .property = "any_layout",\ .value = "off",\ + },{\ + .driver = TYPE_PCI_DEVICE,\ + .property = "x-pcie-lnksta-dllla",\ + .value = "off",\ }, #define HW_COMPAT_2_2 \ diff --git a/include/hw/pci/pci.h b/include/hw/pci/pci.h index 74d797d..929ec2f 100644 --- a/include/hw/pci/pci.h +++ b/include/hw/pci/pci.h @@ -174,6 +174,9 @@ enum { /* PCI Express capability - Power Controller Present */ #define QEMU_PCIE_SLTCAP_PCP_BITNR 7 QEMU_PCIE_SLTCAP_PCP = (1 << QEMU_PCIE_SLTCAP_PCP_BITNR), + /* Link active status in endpoint capability is always set */ +#define QEMU_PCIE_LNKSTA_DLLLA_BITNR 8 + QEMU_PCIE_LNKSTA_DLLLA = (1 << QEMU_PCIE_LNKSTA_DLLLA_BITNR), }; #define TYPE_PCI_DEVICE "pci-device" diff --git a/hw/pci/pci.c b/hw/pci/pci.c index 728c6d4..24fae16 100644 --- a/hw/pci/pci.c +++ b/hw/pci/pci.c @@ -62,6 +62,8 @@ static Property pci_props[] = { QEMU_PCI_CAP_MULTIFUNCTION_BITNR, false), DEFINE_PROP_BIT("command_serr_enable", PCIDevice, cap_present, QEMU_PCI_CAP_SERR_BITNR, true), + DEFINE_PROP_BIT("x-pcie-lnksta-dllla", PCIDevice, cap_present, + QEMU_PCIE_LNKSTA_DLLLA_BITNR, true), DEFINE_PROP_END_OF_LIST() }; diff --git a/hw/pci/pcie.c b/hw/pci/pcie.c index 9599fde..99cfb45 100644 --- a/hw/pci/pcie.c +++ b/hw/pci/pcie.c @@ -45,8 +45,11 @@ */ static void -pcie_cap_v1_fill(uint8_t *exp_cap, uint8_t port, uint8_t type, uint8_t version) +pcie_cap_v1_fill(PCIDevice *dev, uint8_t port, uint8_t type, uint8_t version) { + uint8_t *exp_cap = dev->config + dev->exp.exp_cap; + uint8_t *cmask = dev->cmask + dev->exp.exp_cap; + /* capability register interrupt message number defaults to 0 */ pci_set_word(exp_cap + PCI_EXP_FLAGS, @@ -69,7 +72,18 @@ pcie_cap_v1_fill(uint8_t *exp_cap, uint8_t port, uint8_t type, uint8_t version) PCI_EXP_LNK_LS_25); pci_set_word(exp_cap + PCI_EXP_LNKSTA, - PCI_EXP_LNK_MLW_1 | PCI_EXP_LNK_LS_25 |PCI_EXP_LNKSTA_DLLLA); + PCI_EXP_LNK_MLW_1 | PCI_EXP_LNK_LS_25); + + if (dev->cap_present & QEMU_PCIE_LNKSTA_DLLLA) { + pci_word_test_and_set_mask(exp_cap + PCI_EXP_LNKSTA, + PCI_EXP_LNKSTA_DLLLA); + } + + /* We changed link status bits over time, and changing them across + * migrations is generally fine as hardware changes them too. + * Let's not bother checking. + */ + pci_set_word(cmask + PCI_EXP_LNKSTA, 0); } int pcie_cap_init(PCIDevice *dev, uint8_t offset, uint8_t type, uint8_t port) @@ -88,7 +102,7 @@ int pcie_cap_init(PCIDevice *dev, uint8_t offset, uint8_t type, uint8_t port) exp_cap = dev->config + pos; /* Filling values common with v1 */ - pcie_cap_v1_fill(exp_cap, port, type, PCI_EXP_FLAGS_VER2); + pcie_cap_v1_fill(dev, port, type, PCI_EXP_FLAGS_VER2); /* Filling v2 specific values */ pci_set_long(exp_cap + PCI_EXP_DEVCAP2, @@ -103,7 +117,6 @@ int pcie_cap_v1_init(PCIDevice *dev, uint8_t offset, uint8_t type, { /* PCIe cap v1 init */ int pos; - uint8_t *exp_cap; assert(pci_is_express(dev)); @@ -112,9 +125,8 @@ int pcie_cap_v1_init(PCIDevice *dev, uint8_t offset, uint8_t type, return pos; } dev->exp.exp_cap = pos; - exp_cap = dev->config + pos; - pcie_cap_v1_fill(exp_cap, port, type, PCI_EXP_FLAGS_VER1); + pcie_cap_v1_fill(dev, port, type, PCI_EXP_FLAGS_VER1); return pos; } -- MST From MAILER-DAEMON Thu Jul 21 15:37:17 2016 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1bQJmX-0007xW-6X for mharc-qemu-stable@gnu.org; Thu, 21 Jul 2016 15:37:17 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34451) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bQJm4-0007c0-4W for qemu-stable@nongnu.org; Thu, 21 Jul 2016 15:37:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bQJlN-0000C9-1F for qemu-stable@nongnu.org; Thu, 21 Jul 2016 15:36:47 -0400 Received: from resqmta-po-08v.sys.comcast.net ([96.114.154.167]:34858) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bQJlM-0000Bu-My for qemu-stable@nongnu.org; Thu, 21 Jul 2016 15:36:04 -0400 Received: from resomta-po-20v.sys.comcast.net ([96.114.154.244]) by resqmta-po-08v.sys.comcast.net with SMTP id QJiIb9BYe2dNjQJkNb9kQF; Thu, 21 Jul 2016 19:35:03 +0000 Received: from red.redhat.com ([24.10.254.122]) by comcast with SMTP id QJk8biiyxp3M2QJkNbHdGM; Thu, 21 Jul 2016 19:35:03 +0000 From: Eric Blake To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, pl@kamp.de, pbonzini@redhat.com, qemu-stable@nongnu.org, Kevin Wolf , Max Reitz Date: Thu, 21 Jul 2016 13:34:46 -0600 Message-Id: <1469129688-22848-3-git-send-email-eblake@redhat.com> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1469129688-22848-1-git-send-email-eblake@redhat.com> References: <1469129688-22848-1-git-send-email-eblake@redhat.com> X-CMAE-Envelope: MS4wfEbYCFjaz1280y5avyAlP2qgqBYd7HJlTVBWQjiDuErI4TJNJVu76WvP0rzqNseUhbYMx77HiD0o9rgTJg01Tdp37Ts2b9BuDnMdxvnLeieU71nQTjyz 4xFPmqged7LVZKZFKfvHLfZ5n6yfkzmWEYATZOMZQTvmckPQOPIsGrOYDN3Ki2b8jGB4vwBwwy3iaRqGl71gg3idGQHM/KmIQOwJWLrJRdiBzmSkEl0cT04X P04GmFbM+HXGGlpyLsqa1vw7uw9WUggFgZVAutmw0VHORAPSniBsYpcHUfL2Hs8HPMsyXDLs9x6offFZMEs/sAb68DdkryxLMCwCBpQSIMM= X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 96.114.154.167 Subject: [Qemu-stable] [PATCH 2/4] nbd: Limit nbdflags to 16 bits X-BeenThere: qemu-stable@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Jul 2016 19:37:16 -0000 Rather than asserting that nbdflags is within range, just give it the correct type to begin with :) nbdflags corresponds to the per-export portion of NBD Protocol "transmission flags", which is 16 bits in response to NBD_OPT_EXPORT_NAME and NBD_OPT_GO. Furthermore, upstream NBD has never passed the global flags to the kernel via ioctl(NBD_SET_FLAGS) (the ioctl was first introduced in NBD 2.9.22; then a latent bug in NBD 3.1 actually tried to OR the global flags with the transmission flags, with the disaster that the addition of NBD_FLAG_NO_ZEROES in 3.9 caused all earlier NBD 3.x clients to treat every export as read-only; NBD 3.10 and later intentionally clip things to 16 bits to pass only transmission flags). Qemu should follow suit, since the current two global flags (NBD_FLAG_FIXED_NEWSTYLE and NBD_FLAG_NO_ZEROES) have no impact on the kernel's behavior during transmission. CC: qemu-stable@nongnu.org Signed-off-by: Eric Blake --- v1: extract from larger series previously 3/14 of v5 NBD write zeroes series v4: rebase, cc qemu-stable v3: expand scope of patch --- block/nbd-client.h | 2 +- include/block/nbd.h | 6 +++--- nbd/client.c | 28 +++++++++++++++------------- nbd/server.c | 10 ++++------ qemu-nbd.c | 4 ++-- 5 files changed, 25 insertions(+), 25 deletions(-) diff --git a/block/nbd-client.h b/block/nbd-client.h index fa9817b..044aca4 100644 --- a/block/nbd-client.h +++ b/block/nbd-client.h @@ -20,7 +20,7 @@ typedef struct NbdClientSession { QIOChannelSocket *sioc; /* The master data channel */ QIOChannel *ioc; /* The current I/O channel which may differ (eg TLS) */ - uint32_t nbdflags; + uint16_t nbdflags; off_t size; CoMutex send_mutex; diff --git a/include/block/nbd.h b/include/block/nbd.h index cb91820..1897557 100644 --- a/include/block/nbd.h +++ b/include/block/nbd.h @@ -90,11 +90,11 @@ ssize_t nbd_wr_syncv(QIOChannel *ioc, size_t niov, size_t length, bool do_read); -int nbd_receive_negotiate(QIOChannel *ioc, const char *name, uint32_t *flags, +int nbd_receive_negotiate(QIOChannel *ioc, const char *name, uint16_t *flags, QCryptoTLSCreds *tlscreds, const char *hostname, QIOChannel **outioc, off_t *size, Error **errp); -int nbd_init(int fd, QIOChannelSocket *sioc, uint32_t flags, off_t size); +int nbd_init(int fd, QIOChannelSocket *sioc, uint16_t flags, off_t size); ssize_t nbd_send_request(QIOChannel *ioc, struct nbd_request *request); ssize_t nbd_receive_reply(QIOChannel *ioc, struct nbd_reply *reply); int nbd_client(int fd); @@ -104,7 +104,7 @@ typedef struct NBDExport NBDExport; typedef struct NBDClient NBDClient; NBDExport *nbd_export_new(BlockBackend *blk, off_t dev_offset, off_t size, - uint32_t nbdflags, void (*close)(NBDExport *), + uint16_t nbdflags, void (*close)(NBDExport *), Error **errp); void nbd_export_close(NBDExport *exp); void nbd_export_get(NBDExport *exp); diff --git a/nbd/client.c b/nbd/client.c index 78a7195..a92f1e2 100644 --- a/nbd/client.c +++ b/nbd/client.c @@ -408,7 +408,7 @@ static QIOChannel *nbd_receive_starttls(QIOChannel *ioc, } -int nbd_receive_negotiate(QIOChannel *ioc, const char *name, uint32_t *flags, +int nbd_receive_negotiate(QIOChannel *ioc, const char *name, uint16_t *flags, QCryptoTLSCreds *tlscreds, const char *hostname, QIOChannel **outioc, off_t *size, Error **errp) @@ -468,7 +468,6 @@ int nbd_receive_negotiate(QIOChannel *ioc, const char *name, uint32_t *flags, uint32_t opt; uint32_t namesize; uint16_t globalflags; - uint16_t exportflags; bool fixedNewStyle = false; if (read_sync(ioc, &globalflags, sizeof(globalflags)) != @@ -477,7 +476,6 @@ int nbd_receive_negotiate(QIOChannel *ioc, const char *name, uint32_t *flags, goto fail; } globalflags = be16_to_cpu(globalflags); - *flags = globalflags << 16; TRACE("Global flags are %" PRIx32, globalflags); if (globalflags & NBD_FLAG_FIXED_NEWSTYLE) { fixedNewStyle = true; @@ -545,17 +543,15 @@ int nbd_receive_negotiate(QIOChannel *ioc, const char *name, uint32_t *flags, goto fail; } *size = be64_to_cpu(s); - TRACE("Size is %" PRIu64, *size); - if (read_sync(ioc, &exportflags, sizeof(exportflags)) != - sizeof(exportflags)) { + if (read_sync(ioc, flags, sizeof(*flags)) != sizeof(*flags)) { error_setg(errp, "Failed to read export flags"); goto fail; } - exportflags = be16_to_cpu(exportflags); - *flags |= exportflags; - TRACE("Export flags are %" PRIx16, exportflags); + be16_to_cpus(flags); } else if (magic == NBD_CLIENT_MAGIC) { + uint32_t oldflags; + if (name) { error_setg(errp, "Server does not support export names"); goto fail; @@ -572,16 +568,22 @@ int nbd_receive_negotiate(QIOChannel *ioc, const char *name, uint32_t *flags, *size = be64_to_cpu(s); TRACE("Size is %" PRIu64, *size); - if (read_sync(ioc, flags, sizeof(*flags)) != sizeof(*flags)) { + if (read_sync(ioc, &oldflags, sizeof(oldflags)) != sizeof(oldflags)) { error_setg(errp, "Failed to read export flags"); goto fail; } - *flags = be32_to_cpu(*flags); + be32_to_cpus(&oldflags); + if (oldflags & ~0xffff) { + error_setg(errp, "Unexpected export flags %0x" PRIx32, oldflags); + goto fail; + } + *flags = oldflags; } else { error_setg(errp, "Bad magic received"); goto fail; } + TRACE("Size is %" PRIu64 ", export flags %" PRIx16, *size, *flags); if (read_sync(ioc, &buf, 124) != 124) { error_setg(errp, "Failed to read reserved block"); goto fail; @@ -593,7 +595,7 @@ fail: } #ifdef __linux__ -int nbd_init(int fd, QIOChannelSocket *sioc, uint32_t flags, off_t size) +int nbd_init(int fd, QIOChannelSocket *sioc, uint16_t flags, off_t size) { unsigned long sectors = size / BDRV_SECTOR_SIZE; if (size / BDRV_SECTOR_SIZE != sectors) { @@ -689,7 +691,7 @@ int nbd_disconnect(int fd) } #else -int nbd_init(int fd, QIOChannelSocket *ioc, uint32_t flags, off_t size) +int nbd_init(int fd, QIOChannelSocket *ioc, uint16_t flags, off_t size) { return -ENOTSUP; } diff --git a/nbd/server.c b/nbd/server.c index 3c1e2b3..80fbb4d 100644 --- a/nbd/server.c +++ b/nbd/server.c @@ -63,7 +63,7 @@ struct NBDExport { char *name; off_t dev_offset; off_t size; - uint32_t nbdflags; + uint16_t nbdflags; QTAILQ_HEAD(, NBDClient) clients; QTAILQ_ENTRY(NBDExport) next; @@ -544,8 +544,8 @@ static coroutine_fn int nbd_negotiate(NBDClientNewData *data) NBDClient *client = data->client; char buf[8 + 8 + 8 + 128]; int rc; - const int myflags = (NBD_FLAG_HAS_FLAGS | NBD_FLAG_SEND_TRIM | - NBD_FLAG_SEND_FLUSH | NBD_FLAG_SEND_FUA); + const uint16_t myflags = (NBD_FLAG_HAS_FLAGS | NBD_FLAG_SEND_TRIM | + NBD_FLAG_SEND_FLUSH | NBD_FLAG_SEND_FUA); bool oldStyle; /* Old style negotiation header without options @@ -575,7 +575,6 @@ static coroutine_fn int nbd_negotiate(NBDClientNewData *data) oldStyle = client->exp != NULL && !client->tlscreds; if (oldStyle) { - assert ((client->exp->nbdflags & ~65535) == 0); TRACE("advertising size %" PRIu64 " and flags %x", client->exp->size, client->exp->nbdflags | myflags); stq_be_p(buf + 8, NBD_CLIENT_MAGIC); @@ -606,7 +605,6 @@ static coroutine_fn int nbd_negotiate(NBDClientNewData *data) goto fail; } - assert ((client->exp->nbdflags & ~65535) == 0); TRACE("advertising size %" PRIu64 " and flags %x", client->exp->size, client->exp->nbdflags | myflags); stq_be_p(buf + 18, client->exp->size); @@ -810,7 +808,7 @@ static void nbd_eject_notifier(Notifier *n, void *data) } NBDExport *nbd_export_new(BlockBackend *blk, off_t dev_offset, off_t size, - uint32_t nbdflags, void (*close)(NBDExport *), + uint16_t nbdflags, void (*close)(NBDExport *), Error **errp) { NBDExport *exp = g_malloc0(sizeof(NBDExport)); diff --git a/qemu-nbd.c b/qemu-nbd.c index 321f02b..e3571c2 100644 --- a/qemu-nbd.c +++ b/qemu-nbd.c @@ -251,7 +251,7 @@ static void *nbd_client_thread(void *arg) { char *device = arg; off_t size; - uint32_t nbdflags; + uint16_t nbdflags; QIOChannelSocket *sioc; int fd; int ret; @@ -465,7 +465,7 @@ int main(int argc, char **argv) BlockBackend *blk; BlockDriverState *bs; off_t dev_offset = 0; - uint32_t nbdflags = 0; + uint16_t nbdflags = 0; bool disconnect = false; const char *bindto = "0.0.0.0"; const char *port = NULL; -- 2.5.5 From MAILER-DAEMON Sat Jul 23 03:52:35 2016 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1bQrjf-00009e-2h for mharc-qemu-stable@gnu.org; Sat, 23 Jul 2016 03:52:35 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43581) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bQrjc-00009X-Ud for qemu-stable@nongnu.org; Sat, 23 Jul 2016 03:52:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bQrjX-0005dM-F2 for qemu-stable@nongnu.org; Sat, 23 Jul 2016 03:52:31 -0400 Received: from mx4-phx2.redhat.com ([209.132.183.25]:44837) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bQrjX-0005dC-70; Sat, 23 Jul 2016 03:52:27 -0400 Received: from zmail13.collab.prod.int.phx2.redhat.com (zmail13.collab.prod.int.phx2.redhat.com [10.5.83.15]) by mx4-phx2.redhat.com (8.13.8/8.13.8) with ESMTP id u6N7pMRT004704; Sat, 23 Jul 2016 03:51:22 -0400 Date: Sat, 23 Jul 2016 03:51:19 -0400 (EDT) From: Paolo Bonzini To: Richard Henderson Cc: Dave Hansen , dave@sr71.net, qemu-devel@nongnu.org, Dave Hansen , Eduardo Habkost , qemu-stable@nongnu.org Message-ID: <70840772.9841862.1469260279962.JavaMail.zimbra@redhat.com> In-Reply-To: <11445865-60ff-4d9a-ccfb-cfbcb3a92899@twiddle.net> References: <1469030260-28448-1-git-send-email-dave.hansen@intel.com> <11445865-60ff-4d9a-ccfb-cfbcb3a92899@twiddle.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Originating-IP: [10.4.164.1, 10.5.100.50] X-Mailer: Zimbra 8.0.6_GA_5922 (ZimbraWebClient - FF47 (Linux)/8.0.6_GA_5922) Thread-Topic: i386 translation: fix typo in xsetbv implementation Thread-Index: 27ILuMoTHHTEIltQ/in9IAuUjLVjIA== X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 209.132.183.25 Subject: Re: [Qemu-stable] [Qemu-devel] [PATCH] i386 translation: fix typo in xsetbv implementation X-BeenThere: qemu-stable@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Jul 2016 07:52:34 -0000 > On 07/20/2016 09:27 PM, Dave Hansen wrote: > > QEMU 2.6 added support for the XSAVE family of instructions, which > > includes the XSETBV instruction which allows setting the 'XCR0' > > register. > > > > But, when booting Linux kernels with XSAVE support enabled, I was > > getting very early crashes where the instruction pointer was set > > to 0x3. I tracked it down to a jump instruction generated by this: > > > > gen_jmp_im(s->pc - pc_start); > > > > where s->pc is pointing to the instruction after XSETBV and pc_start > > is pointing _at_ XSETBV. Subtract the two and you get 0x3. Whoops. > > > > The fix is to replace this typo with the pattern found everywhere > > else in the file when folks want to end the translation buffer. > > > > Richard Henderson confirmed that this is a bug and that this is the > > correct fix. > > > > Signed-off-by: Dave Hansen > > Cc: Paolo Bonzini > > Cc: Eduardo Habkost > > Cc: Richard Henderson > > --- > > target-i386/translate.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > Reviewed-by: Richard Henderson Thanks, queued and CCed qemu-stable. Paolo From MAILER-DAEMON Tue Jul 26 08:53:13 2016 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1bS1rF-0007fs-G0 for mharc-qemu-stable@gnu.org; Tue, 26 Jul 2016 08:53:13 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40190) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bS1rA-0007cc-1C for qemu-stable@nongnu.org; Tue, 26 Jul 2016 08:53:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bS1r9-0002mb-87 for qemu-stable@nongnu.org; Tue, 26 Jul 2016 08:53:08 -0400 Received: from smtp3.mundo-r.com ([212.51.32.191]:57133 helo=smtp4.mundo-r.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bS1r0-0002ko-RI; Tue, 26 Jul 2016 08:52:58 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A2D4BAAaXJdX/5tjdVteHAEBgyGOfZZKCAEBB5Jlgg+BfYYdAoE2OBQBAQEBAQEBXSdBEAGECwEBBDo/EAsYCSUPBSiIaQG3VQEBAQEBAQQBAQEBASKFYoUVgTkBg1KCYIIvAQSZMY5xCoFWAY1ojC2DeB42gh0mgTc6gXGHCgEBAQ X-IPAS-Result: A2D4BAAaXJdX/5tjdVteHAEBgyGOfZZKCAEBB5Jlgg+BfYYdAoE2OBQBAQEBAQEBXSdBEAGECwEBBDo/EAsYCSUPBSiIaQG3VQEBAQEBAQQBAQEBASKFYoUVgTkBg1KCYIIvAQSZMY5xCoFWAY1ojC2DeB42gh0mgTc6gXGHCgEBAQ X-IronPort-AV: E=Sophos;i="5.28,424,1464645600"; d="scan'208";a="88919521" Received: from fanzine.igalia.com ([91.117.99.155]) by smtp4.mundo-r.com with ESMTP; 26 Jul 2016 14:52:55 +0200 Received: from maestria.local.igalia.com ([192.168.10.14] helo=mail.igalia.com) by fanzine.igalia.com with esmtps (Cipher TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim) id 1bS1qw-0002s2-Cy; Tue, 26 Jul 2016 14:52:54 +0200 Received: from berto by mail.igalia.com with local (Exim) id 1bS1qw-0003oj-AG; Tue, 26 Jul 2016 14:52:54 +0200 Date: Tue, 26 Jul 2016 14:52:54 +0200 From: Alberto Garcia To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, qemu-stable@nongnu.org, Stefan Hajnoczi , Max Reitz Message-ID: <20160726125254.GA14135@igalia.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 212.51.32.191 Subject: Re: [Qemu-stable] [PATCH for-2.6 0/2] Fix regression with the default naming of throttling groups X-BeenThere: qemu-stable@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Jul 2016 12:53:11 -0000 On Fri, Jul 08, 2016 at 05:05:12PM +0300, Alberto Garcia wrote: > Hi, > > Stefan reported this, this is a regression caused by commit > efaa7c4eeb7490c6f37f3. > > I sent a separate series for the git master, this is the backport > for QEMU v2.6.0. ping Berto From MAILER-DAEMON Tue Jul 26 11:34:55 2016 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1bS4Nj-0007JH-27 for mharc-qemu-stable@gnu.org; Tue, 26 Jul 2016 11:34:55 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51263) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bS4Nc-0007Fw-QN for qemu-stable@nongnu.org; Tue, 26 Jul 2016 11:34:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bS4NY-0005hL-4F for qemu-stable@nongnu.org; Tue, 26 Jul 2016 11:34:48 -0400 Received: from mx1.redhat.com ([209.132.183.28]:52931) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bS4NC-0005eI-Q6; Tue, 26 Jul 2016 11:34:22 -0400 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B23507F6BB; Tue, 26 Jul 2016 15:34:21 +0000 (UTC) Received: from [10.3.116.185] (ovpn-116-185.phx2.redhat.com [10.3.116.185]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u6QFYIGo009945 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 26 Jul 2016 11:34:20 -0400 To: Alberto Garcia , qemu-devel@nongnu.org References: <20160726125254.GA14135@igalia.com> Cc: qemu-block@nongnu.org, qemu-stable@nongnu.org, Stefan Hajnoczi From: Max Reitz Message-ID: <3e44ef27-7c67-c4ac-dc66-e29306421a73@redhat.com> Date: Tue, 26 Jul 2016 17:34:18 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: <20160726125254.GA14135@igalia.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="P8iS0aU1q8lB1MF34jH6PEo6Wwnid5eWs" X-Scanned-By: MIMEDefang 2.68 on 10.5.11.26 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Tue, 26 Jul 2016 15:34:21 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: Re: [Qemu-stable] [PATCH for-2.6 0/2] Fix regression with the default naming of throttling groups X-BeenThere: qemu-stable@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Jul 2016 15:34:53 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --P8iS0aU1q8lB1MF34jH6PEo6Wwnid5eWs Content-Type: multipart/mixed; boundary="UstXcx1cNiktwsmTwLFijqkvJcUOVJJHX" From: Max Reitz To: Alberto Garcia , qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, qemu-stable@nongnu.org, Stefan Hajnoczi Message-ID: <3e44ef27-7c67-c4ac-dc66-e29306421a73@redhat.com> Subject: Re: [PATCH for-2.6 0/2] Fix regression with the default naming of throttling groups References: <20160726125254.GA14135@igalia.com> In-Reply-To: <20160726125254.GA14135@igalia.com> --UstXcx1cNiktwsmTwLFijqkvJcUOVJJHX Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable On 26.07.2016 14:52, Alberto Garcia wrote: > On Fri, Jul 08, 2016 at 05:05:12PM +0300, Alberto Garcia wrote: >> Hi, >> >> Stefan reported this, this is a regression caused by commit >> efaa7c4eeb7490c6f37f3. >> >> I sent a separate series for the git master, this is the backport >> for QEMU v2.6.0. >=20 > ping We don't have a tree for 2.6.0, do we? I thought it only got pulled in when the stable release is being prepared. Max --UstXcx1cNiktwsmTwLFijqkvJcUOVJJHX-- --P8iS0aU1q8lB1MF34jH6PEo6Wwnid5eWs Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQEvBAEBCAAZBQJXl4L6EhxtcmVpdHpAcmVkaGF0LmNvbQAKCRA7sUIC6DisrVss CACiOva2CoZyVJQ1pWwe8YTAzOEP+oc0wu/n/3pI2xHI1GK/507gARK5Ocs1jCZa m9HsPsazf7ffDNg6BNffBh6wjJ/a5SaRPw2tajjhm+8v8vXht5pSfjSTFfHRLCYK Sh/fqmw3m1x5bEszsGMHIMHkJPqXPwLKjf/Q/SwHDGxhIKK9D1PSbbO1bIj5o62c itPm6Dzv+EuewycFUNViwno3Vc5qqAWDIGnSriaRhefgYjbLI079DbFVbFDPRR3O tnD+oNM/YNYVTF2Ku7dvaIIdxam28Nl93uhT0WDsOM+0GjkpuVwDKkmiU5NMlYSW jQpqdJQo1IRP/mXNe8cAAwdm =SA4+ -----END PGP SIGNATURE----- --P8iS0aU1q8lB1MF34jH6PEo6Wwnid5eWs-- From MAILER-DAEMON Tue Jul 26 14:10:01 2016 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1bS6np-0005QF-EW for mharc-qemu-stable@gnu.org; Tue, 26 Jul 2016 14:10:01 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39416) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bS6ni-0005Lx-LQ for qemu-stable@nongnu.org; Tue, 26 Jul 2016 14:09:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bS6ng-0002Iw-KL for qemu-stable@nongnu.org; Tue, 26 Jul 2016 14:09:53 -0400 Received: from mx1.redhat.com ([209.132.183.28]:58251) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bS6nX-0002Di-Ac; Tue, 26 Jul 2016 14:09:43 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 0186B7F7A5; Tue, 26 Jul 2016 18:09:43 +0000 (UTC) Received: from scv.usersys.redhat.com (dhcp-17-171.bos.redhat.com [10.18.17.171]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u6QI9fAS032457; Tue, 26 Jul 2016 14:09:42 -0400 To: Max Reitz , Alberto Garcia , qemu-devel@nongnu.org References: <20160726125254.GA14135@igalia.com> <3e44ef27-7c67-c4ac-dc66-e29306421a73@redhat.com> Cc: Stefan Hajnoczi , qemu-stable@nongnu.org, qemu-block@nongnu.org, Michael Roth From: John Snow Message-ID: <32cb75ec-51fc-9898-516e-95c28f602225@redhat.com> Date: Tue, 26 Jul 2016 14:09:41 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.1.1 MIME-Version: 1.0 In-Reply-To: <3e44ef27-7c67-c4ac-dc66-e29306421a73@redhat.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Tue, 26 Jul 2016 18:09:43 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: Re: [Qemu-stable] [Qemu-block] [PATCH for-2.6 0/2] Fix regression with the default naming of throttling groups X-BeenThere: qemu-stable@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Jul 2016 18:09:59 -0000 On 07/26/2016 11:34 AM, Max Reitz wrote: > On 26.07.2016 14:52, Alberto Garcia wrote: >> On Fri, Jul 08, 2016 at 05:05:12PM +0300, Alberto Garcia wrote: >>> Hi, >>> >>> Stefan reported this, this is a regression caused by commit >>> efaa7c4eeb7490c6f37f3. >>> >>> I sent a separate series for the git master, this is the backport >>> for QEMU v2.6.0. >> >> ping > > We don't have a tree for 2.6.0, do we? I thought it only got pulled in > when the stable release is being prepared. > > Max > Yeah, we don't really have a 2.6-stable tree except for the brief period of time that Michael Roth is working actively on the release. Usually CCing qemu-stable is good enough. --js From MAILER-DAEMON Wed Jul 27 10:51:57 2016 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1bSQBh-0002Lf-1m for mharc-qemu-stable@gnu.org; Wed, 27 Jul 2016 10:51:57 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59144) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bSQBf-0002Jk-7h for qemu-stable@nongnu.org; Wed, 27 Jul 2016 10:51:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bSQBd-0002h3-HF for qemu-stable@nongnu.org; Wed, 27 Jul 2016 10:51:54 -0400 Received: from mx1.redhat.com ([209.132.183.28]:45708) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bSQBX-0002ft-Nt; Wed, 27 Jul 2016 10:51:47 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 303C461E42; Wed, 27 Jul 2016 14:51:47 +0000 (UTC) Received: from scv.usersys.redhat.com (vpn-60-161.rdu2.redhat.com [10.10.60.161]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u6REpjDa031169; Wed, 27 Jul 2016 10:51:46 -0400 From: John Snow To: qemu-stable@nongnu.org Cc: pbonzini@redhat.com, lersek@redhat.com, qemu-devel@nongnu.org, armbru@redhat.com, mreitz@redhat.com, John Snow Date: Wed, 27 Jul 2016 10:51:44 -0400 Message-Id: <1469631104-7972-2-git-send-email-jsnow@redhat.com> In-Reply-To: <1469631104-7972-1-git-send-email-jsnow@redhat.com> References: <1469631104-7972-1-git-send-email-jsnow@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Wed, 27 Jul 2016 14:51:47 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-stable] [RESEND PATCH 1/1] ide: fix halted IO segfault at reset X-BeenThere: qemu-stable@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 Jul 2016 14:51:56 -0000 If one attempts to perform a system_reset after a failed IO request that causes the VM to enter a paused state, QEMU will segfault trying to free up the pending IO requests. These requests have already been completed and freed, though, so all we need to do is NULL them before we enter the paused state. Existing AHCI tests verify that halted requests are still resumed successfully after a STOP event. Analyzed-by: Laszlo Ersek --- hw/ide/core.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/ide/core.c b/hw/ide/core.c index 081c9eb..d117b7c 100644 --- a/hw/ide/core.c +++ b/hw/ide/core.c @@ -823,6 +823,7 @@ static void ide_dma_cb(void *opaque, int ret) } if (ret < 0) { if (ide_handle_rw_error(s, -ret, ide_dma_cmd_to_retry(s->dma_cmd))) { + s->bus->dma->aiocb = NULL; return; } } -- 2.7.4 From MAILER-DAEMON Wed Jul 27 10:51:58 2016 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1bSQBi-0002Me-8M for mharc-qemu-stable@gnu.org; Wed, 27 Jul 2016 10:51:58 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59148) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bSQBf-0002Jo-7l for qemu-stable@nongnu.org; Wed, 27 Jul 2016 10:51:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bSQBd-0002hF-QM for qemu-stable@nongnu.org; Wed, 27 Jul 2016 10:51:54 -0400 Received: from mx1.redhat.com ([209.132.183.28]:60620) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bSQBX-0002fh-6N; Wed, 27 Jul 2016 10:51:47 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 65F96C057FA6; Wed, 27 Jul 2016 14:51:46 +0000 (UTC) Received: from scv.usersys.redhat.com (vpn-60-161.rdu2.redhat.com [10.10.60.161]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u6REpjDZ031169; Wed, 27 Jul 2016 10:51:45 -0400 From: John Snow To: qemu-stable@nongnu.org Cc: pbonzini@redhat.com, lersek@redhat.com, qemu-devel@nongnu.org, armbru@redhat.com, mreitz@redhat.com, John Snow Date: Wed, 27 Jul 2016 10:51:43 -0400 Message-Id: <1469631104-7972-1-git-send-email-jsnow@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Wed, 27 Jul 2016 14:51:46 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-stable] [RESEND PATCH 0/1] ide: fix halted IO segfault at reset X-BeenThere: qemu-stable@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 Jul 2016 14:51:56 -0000 Resending for qemu-stable, fixing commit message in the process. Patch is identical to the version tagged for-2.7. ________________________________________________________________________________ For convenience, this branch is available at: https://github.com/jnsnow/qemu.git branch ide-reset-segfault https://github.com/jnsnow/qemu/tree/ide-reset-segfault This version is tagged ide-reset-segfault-v1: https://github.com/jnsnow/qemu/releases/tag/ide-reset-segfault-v1 John Snow (1): ide: fix halted IO segfault at reset hw/ide/core.c | 1 + 1 file changed, 1 insertion(+) -- 2.7.4 From MAILER-DAEMON Wed Jul 27 11:13:44 2016 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1bSQWm-0006kC-BU for mharc-qemu-stable@gnu.org; Wed, 27 Jul 2016 11:13:44 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35333) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bSQWk-0006co-AN for qemu-stable@nongnu.org; Wed, 27 Jul 2016 11:13:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bSQWg-0000lL-3v for qemu-stable@nongnu.org; Wed, 27 Jul 2016 11:13:41 -0400 Received: from mx1.redhat.com ([209.132.183.28]:53470) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bSQWf-0000l3-UE for qemu-stable@nongnu.org; Wed, 27 Jul 2016 11:13:38 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 778ED3919A0; Wed, 27 Jul 2016 15:13:37 +0000 (UTC) Received: from localhost (ovpn-112-45.ams2.redhat.com [10.36.112.45]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u6RFDXkX018697; Wed, 27 Jul 2016 11:13:34 -0400 From: Stefan Hajnoczi To: "Michael S. Tsirkin" Cc: sstabellini@kernel.org, Michael Roth , secalert@redhat.com, Peter Maydell , qemu-stable@nongnu.org, zhenhaohong@gmail.com, tangqinghao@360.cn, pmatouse@redhat.com, Paolo Bonzini , Stefan Hajnoczi Date: Wed, 27 Jul 2016 16:13:32 +0100 Message-Id: <1469632413-7230-1-git-send-email-stefanha@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Wed, 27 Jul 2016 15:13:37 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-stable] [PULL 0/1] Cve 2016 5403 virtio unbounded allocation patches X-BeenThere: qemu-stable@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 Jul 2016 15:13:43 -0000 The following changes since commit f49ee630d73729ecaeecf4b38a8df11bc613914d: Merge remote-tracking branch 'remotes/dgibson/tags/ppc-for-2.7-20160726' into staging (2016-07-26 11:53:47 +0100) are available in the git repository at: git://github.com/stefanha/qemu.git tags/CVE-2016-5403-virtio-unbounded-allocation-pull-request for you to fetch changes up to afd9096eb1882f23929f5b5c177898ed231bac66: virtio: error out if guest exceeds virtqueue size (2016-07-27 14:04:40 +0100) ---------------------------------------------------------------- ---------------------------------------------------------------- Stefan Hajnoczi (1): virtio: error out if guest exceeds virtqueue size hw/virtio/virtio.c | 5 +++++ 1 file changed, 5 insertions(+) -- 2.7.4 From MAILER-DAEMON Wed Jul 27 11:13:46 2016 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1bSQWo-0006mB-Hb for mharc-qemu-stable@gnu.org; Wed, 27 Jul 2016 11:13:46 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35335) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bSQWk-0006cp-AO for qemu-stable@nongnu.org; Wed, 27 Jul 2016 11:13:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bSQWf-0000l9-Sv for qemu-stable@nongnu.org; Wed, 27 Jul 2016 11:13:41 -0400 Received: from mx1.redhat.com ([209.132.183.28]:37334) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bSQWf-0000kk-Nk for qemu-stable@nongnu.org; Wed, 27 Jul 2016 11:13:37 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 00D3480F7D; Wed, 27 Jul 2016 15:13:37 +0000 (UTC) Received: from localhost (ovpn-112-45.ams2.redhat.com [10.36.112.45]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u6RFDZXj022717; Wed, 27 Jul 2016 11:13:36 -0400 From: Stefan Hajnoczi To: "Michael S. Tsirkin" Cc: sstabellini@kernel.org, Michael Roth , secalert@redhat.com, Peter Maydell , qemu-stable@nongnu.org, zhenhaohong@gmail.com, tangqinghao@360.cn, pmatouse@redhat.com, Paolo Bonzini , Stefan Hajnoczi Date: Wed, 27 Jul 2016 16:13:33 +0100 Message-Id: <1469632413-7230-2-git-send-email-stefanha@redhat.com> In-Reply-To: <1469632413-7230-1-git-send-email-stefanha@redhat.com> References: <1469632413-7230-1-git-send-email-stefanha@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Wed, 27 Jul 2016 15:13:37 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-stable] [PULL 1/1] virtio: error out if guest exceeds virtqueue size X-BeenThere: qemu-stable@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 Jul 2016 15:13:43 -0000 A broken or malicious guest can submit more requests than the virtqueue size permits, causing unbounded memory allocation in QEMU. The guest can submit requests without bothering to wait for completion and is therefore not bound by virtqueue size. This requires reusing vring descriptors in more than one request, which is not allowed by the VIRTIO 1.0 specification. In "3.2.1 Supplying Buffers to The Device", the VIRTIO 1.0 specification says: 1. The driver places the buffer into free descriptor(s) in the descriptor table, chaining as necessary and Note that the above code does not take precautions against the available ring buffer wrapping around: this is not possible since the ring buffer is the same size as the descriptor table, so step (1) will prevent such a condition. This implies that placing more buffers into the virtqueue than the descriptor table size is not allowed. QEMU is missing the check to prevent this case. Processing a request allocates a VirtQueueElement leading to unbounded memory allocation controlled by the guest. Exit with an error if the guest provides more requests than the virtqueue size permits. This bounds memory allocation and makes the buggy guest visible to the user. This patch fixes CVE-2016-5403 and was reported by Zhenhao Hong from 360 Marvel Team, China. Reported-by: Zhenhao Hong Signed-off-by: Stefan Hajnoczi --- hw/virtio/virtio.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c index 752b271..28cf504 100644 --- a/hw/virtio/virtio.c +++ b/hw/virtio/virtio.c @@ -562,6 +562,11 @@ void *virtqueue_pop(VirtQueue *vq, size_t sz) max = vq->vring.num; + if (vq->inuse >= vq->vring.num) { + error_report("Virtqueue size exceeded"); + exit(1); + } + i = head = virtqueue_get_head(vq, vq->last_avail_idx++); if (virtio_vdev_has_feature(vdev, VIRTIO_RING_F_EVENT_IDX)) { vring_set_avail_event(vq, vq->last_avail_idx); -- 2.7.4 From MAILER-DAEMON Wed Jul 27 11:21:34 2016 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1bSQeL-0004c3-W2 for mharc-qemu-stable@gnu.org; Wed, 27 Jul 2016 11:21:34 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37063) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bSQeJ-0004Zp-R4 for qemu-stable@nongnu.org; Wed, 27 Jul 2016 11:21:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bSQeH-00028L-QY for qemu-stable@nongnu.org; Wed, 27 Jul 2016 11:21:30 -0400 Received: from mx1.redhat.com ([209.132.183.28]:44648) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bSQeC-00027K-KQ; Wed, 27 Jul 2016 11:21:24 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 27C7BC04D2B0; Wed, 27 Jul 2016 15:21:24 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (ovpn-116-70.ams2.redhat.com [10.36.116.70]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u6RFLLnX004097; Wed, 27 Jul 2016 11:21:22 -0400 To: John Snow , qemu-stable@nongnu.org References: <1469631104-7972-1-git-send-email-jsnow@redhat.com> <1469631104-7972-2-git-send-email-jsnow@redhat.com> Cc: pbonzini@redhat.com, qemu-devel@nongnu.org, armbru@redhat.com, mreitz@redhat.com From: Laszlo Ersek Message-ID: <8bc71999-ff55-7b83-a50a-426819633bae@redhat.com> Date: Wed, 27 Jul 2016 17:21:21 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: <1469631104-7972-2-git-send-email-jsnow@redhat.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Wed, 27 Jul 2016 15:21:24 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: Re: [Qemu-stable] [RESEND PATCH 1/1] ide: fix halted IO segfault at reset X-BeenThere: qemu-stable@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 Jul 2016 15:21:32 -0000 On 07/27/16 16:51, John Snow wrote: > If one attempts to perform a system_reset after a failed IO request > that causes the VM to enter a paused state, QEMU will segfault trying > to free up the pending IO requests. > > These requests have already been completed and freed, though, so all > we need to do is NULL them before we enter the paused state. > > Existing AHCI tests verify that halted requests are still resumed > successfully after a STOP event. > > Analyzed-by: Laszlo Ersek > --- > hw/ide/core.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/hw/ide/core.c b/hw/ide/core.c > index 081c9eb..d117b7c 100644 > --- a/hw/ide/core.c > +++ b/hw/ide/core.c > @@ -823,6 +823,7 @@ static void ide_dma_cb(void *opaque, int ret) > } > if (ret < 0) { > if (ide_handle_rw_error(s, -ret, ide_dma_cmd_to_retry(s->dma_cmd))) { > + s->bus->dma->aiocb = NULL; > return; > } > } > You forgot your S-o-b from the end of the commit message, and also my R-b from round #1. Looks like my un-orthodox Analyzed-by distracted you too much! ;) Care to resend once more with those two tags added? Thanks! Laszlo From MAILER-DAEMON Wed Jul 27 11:31:25 2016 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1bSQnt-0000s3-0x for mharc-qemu-stable@gnu.org; Wed, 27 Jul 2016 11:31:25 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39505) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bSQnn-0000n3-BZ for qemu-stable@nongnu.org; Wed, 27 Jul 2016 11:31:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bSQnl-00049l-DF for qemu-stable@nongnu.org; Wed, 27 Jul 2016 11:31:18 -0400 Received: from inet-orm.provo.novell.com ([137.65.248.124]:50649 helo=mail.novell.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bSQne-00048i-VH; Wed, 27 Jul 2016 11:31:11 -0400 Received: from brogers1.provo.novell.com ([137.65.132.242]) by mail.novell.com with ESMTP (NOT encrypted); Wed, 27 Jul 2016 09:30:53 -0600 From: Bruce Rogers To: qemu-devel@nongnu.org Cc: qemu-stable@nongnu.org, caoj.fnst@cn.fujitsu.com, anthony.perard@citrix.com, Bruce Rogers Date: Wed, 27 Jul 2016 09:30:48 -0600 Message-Id: <1469633448-10692-1-git-send-email-brogers@suse.com> X-Mailer: git-send-email 1.9.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 137.65.248.124 Subject: [Qemu-stable] [PATCH for-2.7] Xen PCI passthrough: fix passthrough failure when no interrupt pin X-BeenThere: qemu-stable@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 Jul 2016 15:31:23 -0000 Commit 5a11d0f7 mistakenly converted a log message into an error condition when no pin interrupt is found for the pci device being passed through. Revert that part of the commit. Signed-off-by: Bruce Rogers --- hw/xen/xen_pt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/xen/xen_pt.c b/hw/xen/xen_pt.c index f593b04..b6d71bb 100644 --- a/hw/xen/xen_pt.c +++ b/hw/xen/xen_pt.c @@ -842,7 +842,7 @@ static void xen_pt_realize(PCIDevice *d, Error **errp) goto err_out; } if (!scratch) { - error_setg(errp, "no pin interrupt"); + XEN_PT_LOG(d, "no pin interrupt\n"); goto out; } -- 1.9.0 From MAILER-DAEMON Wed Jul 27 11:43:20 2016 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1bSQzQ-0008I8-Kz for mharc-qemu-stable@gnu.org; Wed, 27 Jul 2016 11:43:20 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41737) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bSQzO-0008H8-9C for qemu-stable@nongnu.org; Wed, 27 Jul 2016 11:43:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bSQzM-0000Ng-F1 for qemu-stable@nongnu.org; Wed, 27 Jul 2016 11:43:17 -0400 Received: from mail-vk0-x22f.google.com ([2607:f8b0:400c:c05::22f]:34638) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bSQzL-0000NT-QI for qemu-stable@nongnu.org; Wed, 27 Jul 2016 11:43:16 -0400 Received: by mail-vk0-x22f.google.com with SMTP id s189so12107026vkh.1 for ; Wed, 27 Jul 2016 08:43:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=XAuAMuP2qGoM54BdMQlshVxMEwcqHEJs3Qavx80zLoE=; b=KSim1Y/zef5ERWeY++8vbiq+wkpt5vVxuzd3OhJsVIq3Xtz9FxqHUOLSs7cu3LfJ9P V2YSh1KlcHkEJr5Vge2EXICnxQhLjX/Ix0Xjsjdfo4WlXCjddwedZLDsO7YQRzuoo471 VpIQZHwXSYayrKC5N+UbzcIlvc/TrZKt3zyfo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=XAuAMuP2qGoM54BdMQlshVxMEwcqHEJs3Qavx80zLoE=; b=UW1vrxDQ2vBIUJhi/o8JQw+h8Kxogf1hj1A3Oh2VOWSNLmJVGQ/l36lg5Q/7ttTAgG rOImL5LssbtMVjaxUHOFOR1oIgj3cJd6VRYR24ubdfLV6FGRcLwu/wiqYB9tW3AGs7Ew i9vrVoW51INdRtHlAjoqwfUYyoXaqmSK1yd0iBn8ui7Ov+T0RFGIRQdV61ZlRqtrF4LN KqdeBJETpgBte8AryqoY7Cdlasy/ofa8y9skIi8FNZh8AJ7dSY8sZx2oQ/laZaqAciID GdSeNtN4u1kTtFqY/wdfqPmK6Jstyfu5y8qDjtrmrggZxJYdMKtg/f0qqrnlO/7ibwLs cdHQ== X-Gm-Message-State: AEkooutFHZ6D0sdg6P5nQt6pAMjbNYAy8Zoi817YNGbqoc336rIOWYZSd9Qjy7X4vZYsn6+N1pvCJ6j13JT9B/WR X-Received: by 10.31.88.70 with SMTP id m67mr12505922vkb.108.1469634195269; Wed, 27 Jul 2016 08:43:15 -0700 (PDT) MIME-Version: 1.0 Received: by 10.31.137.136 with HTTP; Wed, 27 Jul 2016 08:42:55 -0700 (PDT) In-Reply-To: <1469632413-7230-1-git-send-email-stefanha@redhat.com> References: <1469632413-7230-1-git-send-email-stefanha@redhat.com> From: Peter Maydell Date: Wed, 27 Jul 2016 16:42:55 +0100 Message-ID: To: Stefan Hajnoczi Cc: "Michael S. Tsirkin" , Stefano Stabellini , Michael Roth , secalert , qemu-stable , zhenhaohong@gmail.com, tangqinghao@360.cn, Petr Matousek , Paolo Bonzini Content-Type: text/plain; charset=UTF-8 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2607:f8b0:400c:c05::22f Subject: Re: [Qemu-stable] [PULL 0/1] Cve 2016 5403 virtio unbounded allocation patches X-BeenThere: qemu-stable@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 Jul 2016 15:43:19 -0000 On 27 July 2016 at 16:13, Stefan Hajnoczi wrote: > The following changes since commit f49ee630d73729ecaeecf4b38a8df11bc613914d: > > Merge remote-tracking branch 'remotes/dgibson/tags/ppc-for-2.7-20160726' into staging (2016-07-26 11:53:47 +0100) > > are available in the git repository at: > > git://github.com/stefanha/qemu.git tags/CVE-2016-5403-virtio-unbounded-allocation-pull-request > > for you to fetch changes up to afd9096eb1882f23929f5b5c177898ed231bac66: > > virtio: error out if guest exceeds virtqueue size (2016-07-27 14:04:40 +0100) > > ---------------------------------------------------------------- > > ---------------------------------------------------------------- > > Stefan Hajnoczi (1): > virtio: error out if guest exceeds virtqueue size > > hw/virtio/virtio.c | 5 +++++ > 1 file changed, 5 insertions(+) > > -- > 2.7.4 Did you forget to cc qemu-devel on this? thanks -- PMM From MAILER-DAEMON Wed Jul 27 12:00:12 2016 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1bSRFk-0003pT-Dl for mharc-qemu-stable@gnu.org; Wed, 27 Jul 2016 12:00:12 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44445) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bSRFi-0003l1-7Q for qemu-stable@nongnu.org; Wed, 27 Jul 2016 12:00:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bSRFh-0003nx-De for qemu-stable@nongnu.org; Wed, 27 Jul 2016 12:00:10 -0400 Received: from mx1.redhat.com ([209.132.183.28]:37204) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bSRFc-0003iU-4c; Wed, 27 Jul 2016 12:00:04 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 82E8D80F72; Wed, 27 Jul 2016 16:00:03 +0000 (UTC) Received: from scv.usersys.redhat.com (vpn-60-161.rdu2.redhat.com [10.10.60.161]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u6RG029U029660; Wed, 27 Jul 2016 12:00:02 -0400 From: John Snow To: qemu-stable@nongnu.org Cc: lersek@redhat.com, qemu-devel@nongnu.org, John Snow Date: Wed, 27 Jul 2016 12:00:01 -0400 Message-Id: <1469635201-11918-2-git-send-email-jsnow@redhat.com> In-Reply-To: <1469635201-11918-1-git-send-email-jsnow@redhat.com> References: <1469635201-11918-1-git-send-email-jsnow@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Wed, 27 Jul 2016 16:00:03 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-stable] [PATCH v2 1/1] ide: fix halted IO segfault at reset X-BeenThere: qemu-stable@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 Jul 2016 16:00:11 -0000 If one attempts to perform a system_reset after a failed IO request that causes the VM to enter a paused state, QEMU will segfault trying to free up the pending IO requests. These requests have already been completed and freed, though, so all we need to do is NULL them before we enter the paused state. Existing AHCI tests verify that halted requests are still resumed successfully after a STOP event. Analyzed-by: Laszlo Ersek Reviewed-by: Laszlo Ersek Signed-off-by: John Snow --- hw/ide/core.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/ide/core.c b/hw/ide/core.c index 081c9eb..d117b7c 100644 --- a/hw/ide/core.c +++ b/hw/ide/core.c @@ -823,6 +823,7 @@ static void ide_dma_cb(void *opaque, int ret) } if (ret < 0) { if (ide_handle_rw_error(s, -ret, ide_dma_cmd_to_retry(s->dma_cmd))) { + s->bus->dma->aiocb = NULL; return; } } -- 2.7.4 From MAILER-DAEMON Wed Jul 27 12:00:18 2016 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1bSRFq-0003uO-NF for mharc-qemu-stable@gnu.org; Wed, 27 Jul 2016 12:00:18 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44483) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bSRFl-0003pL-Dc for qemu-stable@nongnu.org; Wed, 27 Jul 2016 12:00:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bSRFj-0003pN-F0 for qemu-stable@nongnu.org; Wed, 27 Jul 2016 12:00:12 -0400 Received: from mx1.redhat.com ([209.132.183.28]:40820) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bSRFb-0003iA-OF; Wed, 27 Jul 2016 12:00:03 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id F0157C056793; Wed, 27 Jul 2016 16:00:02 +0000 (UTC) Received: from scv.usersys.redhat.com (vpn-60-161.rdu2.redhat.com [10.10.60.161]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u6RG029T029660; Wed, 27 Jul 2016 12:00:02 -0400 From: John Snow To: qemu-stable@nongnu.org Cc: lersek@redhat.com, qemu-devel@nongnu.org, John Snow Date: Wed, 27 Jul 2016 12:00:00 -0400 Message-Id: <1469635201-11918-1-git-send-email-jsnow@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Wed, 27 Jul 2016 16:00:03 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-stable] [PATCH v2 0/1] ide: fix halted IO segfault at reset X-BeenThere: qemu-stable@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 Jul 2016 16:00:17 -0000 One last time, with feeling: Added Laszlo's R-B and properly re-affixed my S-O-B. ________________________________________________________________________________ For convenience, this branch is available at: https://github.com/jnsnow/qemu.git branch ide-reset-segfault https://github.com/jnsnow/qemu/tree/ide-reset-segfault This version is tagged ide-reset-segfault-v2: https://github.com/jnsnow/qemu/releases/tag/ide-reset-segfault-v2 John Snow (1): ide: fix halted IO segfault at reset hw/ide/core.c | 1 + 1 file changed, 1 insertion(+) -- 2.7.4 From MAILER-DAEMON Wed Jul 27 12:45:57 2016 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1bSRy1-00060I-AK for mharc-qemu-stable@gnu.org; Wed, 27 Jul 2016 12:45:57 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59443) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bSRxy-0005vq-RR for qemu-stable@nongnu.org; Wed, 27 Jul 2016 12:45:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bSRxx-0001O6-2D for qemu-stable@nongnu.org; Wed, 27 Jul 2016 12:45:53 -0400 Received: from mx1.redhat.com ([209.132.183.28]:34618) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bSRxu-0001N8-4Y; Wed, 27 Jul 2016 12:45:50 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 1D98981227; Wed, 27 Jul 2016 16:45:48 +0000 (UTC) Received: from localhost (ovpn-112-21.ams2.redhat.com [10.36.112.21]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u6RGjhU4003622; Wed, 27 Jul 2016 12:45:44 -0400 From: Stefan Hajnoczi To: "Michael S. Tsirkin" Cc: sstabellini@kernel.org, Michael Roth , secalert@redhat.com, Peter Maydell , qemu-devel@nongnu.org, qemu-stable@nongnu.org, zhenhaohong@gmail.com, tangqinghao@360.cn, pmatouse@redhat.com, Paolo Bonzini , Stefan Hajnoczi Date: Wed, 27 Jul 2016 17:43:48 +0100 Message-Id: <1469637829-8105-1-git-send-email-stefanha@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Wed, 27 Jul 2016 16:45:49 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-stable] [PULL 0/1] Cve 2016 5403 virtio unbounded allocation patches X-BeenThere: qemu-stable@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 Jul 2016 16:45:56 -0000 The following changes since commit f49ee630d73729ecaeecf4b38a8df11bc613914d: Merge remote-tracking branch 'remotes/dgibson/tags/ppc-for-2.7-20160726' into staging (2016-07-26 11:53:47 +0100) are available in the git repository at: git://github.com/stefanha/qemu.git tags/CVE-2016-5403-virtio-unbounded-allocation-pull-request for you to fetch changes up to afd9096eb1882f23929f5b5c177898ed231bac66: virtio: error out if guest exceeds virtqueue size (2016-07-27 14:04:40 +0100) ---------------------------------------------------------------- ---------------------------------------------------------------- Stefan Hajnoczi (1): virtio: error out if guest exceeds virtqueue size hw/virtio/virtio.c | 5 +++++ 1 file changed, 5 insertions(+) -- 2.7.4 From MAILER-DAEMON Wed Jul 27 12:46:00 2016 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1bSRy4-00062n-8p for mharc-qemu-stable@gnu.org; Wed, 27 Jul 2016 12:46:00 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59449) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bSRxz-0005wK-Eo for qemu-stable@nongnu.org; Wed, 27 Jul 2016 12:45:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bSRxx-0001OB-7a for qemu-stable@nongnu.org; Wed, 27 Jul 2016 12:45:54 -0400 Received: from mx1.redhat.com ([209.132.183.28]:33956) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bSRxs-0001Mz-Tu; Wed, 27 Jul 2016 12:45:49 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 024F5811AC; Wed, 27 Jul 2016 16:45:48 +0000 (UTC) Received: from localhost (ovpn-112-21.ams2.redhat.com [10.36.112.21]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u6RGjkdh013890; Wed, 27 Jul 2016 12:45:47 -0400 From: Stefan Hajnoczi To: "Michael S. Tsirkin" Cc: sstabellini@kernel.org, Michael Roth , secalert@redhat.com, Peter Maydell , qemu-devel@nongnu.org, qemu-stable@nongnu.org, zhenhaohong@gmail.com, tangqinghao@360.cn, pmatouse@redhat.com, Paolo Bonzini , Stefan Hajnoczi Date: Wed, 27 Jul 2016 17:43:49 +0100 Message-Id: <1469637829-8105-2-git-send-email-stefanha@redhat.com> In-Reply-To: <1469637829-8105-1-git-send-email-stefanha@redhat.com> References: <1469637829-8105-1-git-send-email-stefanha@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Wed, 27 Jul 2016 16:45:48 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-stable] [PULL 1/1] virtio: error out if guest exceeds virtqueue size X-BeenThere: qemu-stable@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 Jul 2016 16:45:57 -0000 A broken or malicious guest can submit more requests than the virtqueue size permits, causing unbounded memory allocation in QEMU. The guest can submit requests without bothering to wait for completion and is therefore not bound by virtqueue size. This requires reusing vring descriptors in more than one request, which is not allowed by the VIRTIO 1.0 specification. In "3.2.1 Supplying Buffers to The Device", the VIRTIO 1.0 specification says: 1. The driver places the buffer into free descriptor(s) in the descriptor table, chaining as necessary and Note that the above code does not take precautions against the available ring buffer wrapping around: this is not possible since the ring buffer is the same size as the descriptor table, so step (1) will prevent such a condition. This implies that placing more buffers into the virtqueue than the descriptor table size is not allowed. QEMU is missing the check to prevent this case. Processing a request allocates a VirtQueueElement leading to unbounded memory allocation controlled by the guest. Exit with an error if the guest provides more requests than the virtqueue size permits. This bounds memory allocation and makes the buggy guest visible to the user. This patch fixes CVE-2016-5403 and was reported by Zhenhao Hong from 360 Marvel Team, China. Reported-by: Zhenhao Hong Signed-off-by: Stefan Hajnoczi --- hw/virtio/virtio.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c index 752b271..28cf504 100644 --- a/hw/virtio/virtio.c +++ b/hw/virtio/virtio.c @@ -562,6 +562,11 @@ void *virtqueue_pop(VirtQueue *vq, size_t sz) max = vq->vring.num; + if (vq->inuse >= vq->vring.num) { + error_report("Virtqueue size exceeded"); + exit(1); + } + i = head = virtqueue_get_head(vq, vq->last_avail_idx++); if (virtio_vdev_has_feature(vdev, VIRTIO_RING_F_EVENT_IDX)) { vring_set_avail_event(vq, vq->last_avail_idx); -- 2.7.4 From MAILER-DAEMON Wed Jul 27 13:18:30 2016 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1bSSTW-0004GH-RA for mharc-qemu-stable@gnu.org; Wed, 27 Jul 2016 13:18:30 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45519) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bSSTU-0004Cd-BQ for qemu-stable@nongnu.org; Wed, 27 Jul 2016 13:18:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bSSTT-0004HW-Ie for qemu-stable@nongnu.org; Wed, 27 Jul 2016 13:18:28 -0400 Received: from mail-vk0-x234.google.com ([2607:f8b0:400c:c05::234]:33952) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bSSTT-0004Ga-7c for qemu-stable@nongnu.org; Wed, 27 Jul 2016 13:18:27 -0400 Received: by mail-vk0-x234.google.com with SMTP id s189so14099519vkh.1 for ; Wed, 27 Jul 2016 10:18:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=HEdZaDicwVX1uRRZFJSEF/2DBJPxpsuskA1eL59DUvQ=; b=Qnoe4LS7TqWMR2csqhCVtdp4JBEtb0lnDbGxgY/kFRXCHI+3wGdIJr6uqkTySSprPA h2wCNL+iEtCNND65TfgcENO/H+77e5UsG3be/60eaLeOXrfQ87PB6B1HSglaAlK1il+C 1sioSIrcBvAfkWalYTPQMGHzlCC4DDfpr3pN4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=HEdZaDicwVX1uRRZFJSEF/2DBJPxpsuskA1eL59DUvQ=; b=GG1H6C5Z5kJKc+1h06SchDfxMcXTQfu2NuzZTCtgZuvJ+G/PLb4+6ti8r2PrcW7+9j OBzeZytp93WmKoiSXZHLS6LB+VWcLqw/lHXMrruZlabfgyY3dk0aeggewkSHAGNNQ5Q7 baytBKbIob2hupGJK13ZN++1L9i7G+9f87ShMOtOYM2tKuDqdhNYEmF/wi1fGOUV9j0g IMtx8KaSuqNzEnPpvCcGFdhNB8/y4Gk/X5W3w9SnMzWD+b1kKy9XrlcFVNI6rdxgZsMR jMIO87Ty23jjGo8ko6qBUGNBHX8v5UzwB+Mn9hwa3YCAxQ62U0UwMYOZKEGF1E1jdAm5 aY2A== X-Gm-Message-State: AEkoousXmcKPYNHUGmgG7JHFQJXAr4hPCyB0kwv9mZ9kFqs3jPDOpAHv4E6iavHlBhAWl4b45AZl1NIIbwbAIH9b X-Received: by 10.31.7.8 with SMTP id 8mr12963383vkh.157.1469639906698; Wed, 27 Jul 2016 10:18:26 -0700 (PDT) MIME-Version: 1.0 Received: by 10.31.137.136 with HTTP; Wed, 27 Jul 2016 10:18:07 -0700 (PDT) In-Reply-To: <1469637829-8105-1-git-send-email-stefanha@redhat.com> References: <1469637829-8105-1-git-send-email-stefanha@redhat.com> From: Peter Maydell Date: Wed, 27 Jul 2016 18:18:07 +0100 Message-ID: To: Stefan Hajnoczi Cc: "Michael S. Tsirkin" , Stefano Stabellini , Michael Roth , secalert , QEMU Developers , qemu-stable , zhenhaohong@gmail.com, tangqinghao@360.cn, Petr Matousek , Paolo Bonzini Content-Type: text/plain; charset=UTF-8 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2607:f8b0:400c:c05::234 Subject: Re: [Qemu-stable] [PULL 0/1] Cve 2016 5403 virtio unbounded allocation patches X-BeenThere: qemu-stable@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 Jul 2016 17:18:29 -0000 On 27 July 2016 at 17:43, Stefan Hajnoczi wrote: > The following changes since commit f49ee630d73729ecaeecf4b38a8df11bc613914d: > > Merge remote-tracking branch 'remotes/dgibson/tags/ppc-for-2.7-20160726' into staging (2016-07-26 11:53:47 +0100) > > are available in the git repository at: > > git://github.com/stefanha/qemu.git tags/CVE-2016-5403-virtio-unbounded-allocation-pull-request > > for you to fetch changes up to afd9096eb1882f23929f5b5c177898ed231bac66: > > virtio: error out if guest exceeds virtqueue size (2016-07-27 14:04:40 +0100) > > ---------------------------------------------------------------- > > ---------------------------------------------------------------- > > Stefan Hajnoczi (1): > virtio: error out if guest exceeds virtqueue size > > hw/virtio/virtio.c | 5 +++++ > 1 file changed, 5 insertions(+) Applied, thanks. -- PMM From MAILER-DAEMON Thu Jul 28 01:30:45 2016 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1bSdu8-0005r2-Us for mharc-qemu-stable@gnu.org; Thu, 28 Jul 2016 01:30:44 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45800) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bSbbe-0003gL-0C for qemu-stable@nongnu.org; Wed, 27 Jul 2016 23:03:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bSbbc-00065F-0p for qemu-stable@nongnu.org; Wed, 27 Jul 2016 23:03:28 -0400 Received: from [59.151.112.132] (port=32660 helo=heian.cn.fujitsu.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bSbbT-00062R-JQ; Wed, 27 Jul 2016 23:03:22 -0400 X-IronPort-AV: E=Sophos;i="5.22,518,1449504000"; d="scan'208";a="9175191" Received: from unknown (HELO cn.fujitsu.com) ([10.167.33.5]) by heian.cn.fujitsu.com with ESMTP; 28 Jul 2016 11:03:10 +0800 Received: from G08CNEXCHPEKD03.g08.fujitsu.local (unknown [10.167.33.85]) by cn.fujitsu.com (Postfix) with ESMTP id E012B42984C2; Thu, 28 Jul 2016 11:03:10 +0800 (CST) Received: from [10.167.226.69] (10.167.226.69) by G08CNEXCHPEKD03.g08.fujitsu.local (10.167.33.89) with Microsoft SMTP Server (TLS) id 14.3.279.2; Thu, 28 Jul 2016 11:03:10 +0800 To: Bruce Rogers , References: <1469633448-10692-1-git-send-email-brogers@suse.com> CC: , From: Cao jin Message-ID: <579977B8.4090600@cn.fujitsu.com> Date: Thu, 28 Jul 2016 11:10:48 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.1.0 MIME-Version: 1.0 In-Reply-To: <1469633448-10692-1-git-send-email-brogers@suse.com> Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.167.226.69] X-yoursite-MailScanner-ID: E012B42984C2.A6ADC X-yoursite-MailScanner: Found to be clean X-yoursite-MailScanner-From: caoj.fnst@cn.fujitsu.com X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 59.151.112.132 X-Mailman-Approved-At: Thu, 28 Jul 2016 01:30:43 -0400 Subject: Re: [Qemu-stable] [PATCH for-2.7] Xen PCI passthrough: fix passthrough failure when no interrupt pin X-BeenThere: qemu-stable@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Jul 2016 03:03:31 -0000 hello bruce, AFAIK, the message in error object will be printed to stderr or current monitor according whether we have a monitor. I just checked XEN_PT_LOG, message is only printed to stderr. If Xen pt device can be hotplugged via monitor command device_add, I guess using error object is right. Yours Sincerely, Cao jin On 07/27/2016 11:30 PM, Bruce Rogers wrote: > Commit 5a11d0f7 mistakenly converted a log message into an error > condition when no pin interrupt is found for the pci device being > passed through. Revert that part of the commit. > > Signed-off-by: Bruce Rogers > --- > hw/xen/xen_pt.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/hw/xen/xen_pt.c b/hw/xen/xen_pt.c > index f593b04..b6d71bb 100644 > --- a/hw/xen/xen_pt.c > +++ b/hw/xen/xen_pt.c > @@ -842,7 +842,7 @@ static void xen_pt_realize(PCIDevice *d, Error **errp) > goto err_out; > } > if (!scratch) { > - error_setg(errp, "no pin interrupt"); > + XEN_PT_LOG(d, "no pin interrupt\n"); > goto out; > } > > From MAILER-DAEMON Thu Jul 28 23:15:17 2016 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1bSyGb-00055U-JK for mharc-qemu-stable@gnu.org; Thu, 28 Jul 2016 23:15:17 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39158) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bSyGV-00050K-V2 for qemu-stable@nongnu.org; Thu, 28 Jul 2016 23:15:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bSyGT-0002Vp-Nl for qemu-stable@nongnu.org; Thu, 28 Jul 2016 23:15:11 -0400 Received: from mx1.redhat.com ([209.132.183.28]:37112) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bSyGP-0002Pe-5o; Thu, 28 Jul 2016 23:15:05 -0400 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8101061E4C; Fri, 29 Jul 2016 03:15:03 +0000 (UTC) Received: from redhat.com (vpn1-4-254.ams2.redhat.com [10.36.4.254]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with SMTP id u6T3EwxM006123; Thu, 28 Jul 2016 23:14:59 -0400 Date: Fri, 29 Jul 2016 06:14:58 +0300 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Gerd Hoffmann , qemu-stable@nongnu.org, Benjamin Herrenschmidt , Marcel Apfelbaum Message-ID: <1469762011-7902-2-git-send-email-mst@redhat.com> References: <1469762011-7902-1-git-send-email-mst@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1469762011-7902-1-git-send-email-mst@redhat.com> X-Mutt-Fcc: =sent X-Scanned-By: MIMEDefang 2.68 on 10.5.11.26 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Fri, 29 Jul 2016 03:15:03 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-stable] [PULL 01/41] pcie: fix link active status bit migration X-BeenThere: qemu-stable@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Jul 2016 03:15:16 -0000 We changed link status register in pci express endpoint capability over time. Specifically, commit b2101eae63ea57b571cee4a9075a4287d24ba4a4 ("pcie: Set the "link active" in the link status register") set data link layer link active bit in this register without adding compatibility to old machine types. When migrating from qemu 2.3 and older this affects xhci devices which under machine type 2.0 and older have a pci express endpoint capability even if they are on a pci bus. Add compatibility flags to make this bit value match what it was under 2.3. Additionally, to avoid breaking migration from qemu 2.3 and up, suppress checking link status during migration: this seems sane since hardware can change link status at any time. https://bugzilla.redhat.com/show_bug.cgi?id=1352860 Reported-by: Gerd Hoffmann Fixes: b2101eae63ea57b571cee4a9075a4287d24ba4a4 ("pcie: Set the "link active" in the link status register") Cc: qemu-stable@nongnu.org Cc: Benjamin Herrenschmidt Signed-off-by: Michael S. Tsirkin --- include/hw/compat.h | 4 ++++ include/hw/pci/pci.h | 3 +++ hw/pci/pci.c | 2 ++ hw/pci/pcie.c | 24 ++++++++++++++++++------ 4 files changed, 27 insertions(+), 6 deletions(-) diff --git a/include/hw/compat.h b/include/hw/compat.h index 9914e7a..e5113dc 100644 --- a/include/hw/compat.h +++ b/include/hw/compat.h @@ -80,6 +80,10 @@ .driver = "virtio-rng-pci",\ .property = "any_layout",\ .value = "off",\ + },{\ + .driver = TYPE_PCI_DEVICE,\ + .property = "x-pcie-lnksta-dllla",\ + .value = "off",\ }, #define HW_COMPAT_2_2 \ diff --git a/include/hw/pci/pci.h b/include/hw/pci/pci.h index 74d797d..929ec2f 100644 --- a/include/hw/pci/pci.h +++ b/include/hw/pci/pci.h @@ -174,6 +174,9 @@ enum { /* PCI Express capability - Power Controller Present */ #define QEMU_PCIE_SLTCAP_PCP_BITNR 7 QEMU_PCIE_SLTCAP_PCP = (1 << QEMU_PCIE_SLTCAP_PCP_BITNR), + /* Link active status in endpoint capability is always set */ +#define QEMU_PCIE_LNKSTA_DLLLA_BITNR 8 + QEMU_PCIE_LNKSTA_DLLLA = (1 << QEMU_PCIE_LNKSTA_DLLLA_BITNR), }; #define TYPE_PCI_DEVICE "pci-device" diff --git a/hw/pci/pci.c b/hw/pci/pci.c index 728c6d4..24fae16 100644 --- a/hw/pci/pci.c +++ b/hw/pci/pci.c @@ -62,6 +62,8 @@ static Property pci_props[] = { QEMU_PCI_CAP_MULTIFUNCTION_BITNR, false), DEFINE_PROP_BIT("command_serr_enable", PCIDevice, cap_present, QEMU_PCI_CAP_SERR_BITNR, true), + DEFINE_PROP_BIT("x-pcie-lnksta-dllla", PCIDevice, cap_present, + QEMU_PCIE_LNKSTA_DLLLA_BITNR, true), DEFINE_PROP_END_OF_LIST() }; diff --git a/hw/pci/pcie.c b/hw/pci/pcie.c index 9599fde..99cfb45 100644 --- a/hw/pci/pcie.c +++ b/hw/pci/pcie.c @@ -45,8 +45,11 @@ */ static void -pcie_cap_v1_fill(uint8_t *exp_cap, uint8_t port, uint8_t type, uint8_t version) +pcie_cap_v1_fill(PCIDevice *dev, uint8_t port, uint8_t type, uint8_t version) { + uint8_t *exp_cap = dev->config + dev->exp.exp_cap; + uint8_t *cmask = dev->cmask + dev->exp.exp_cap; + /* capability register interrupt message number defaults to 0 */ pci_set_word(exp_cap + PCI_EXP_FLAGS, @@ -69,7 +72,18 @@ pcie_cap_v1_fill(uint8_t *exp_cap, uint8_t port, uint8_t type, uint8_t version) PCI_EXP_LNK_LS_25); pci_set_word(exp_cap + PCI_EXP_LNKSTA, - PCI_EXP_LNK_MLW_1 | PCI_EXP_LNK_LS_25 |PCI_EXP_LNKSTA_DLLLA); + PCI_EXP_LNK_MLW_1 | PCI_EXP_LNK_LS_25); + + if (dev->cap_present & QEMU_PCIE_LNKSTA_DLLLA) { + pci_word_test_and_set_mask(exp_cap + PCI_EXP_LNKSTA, + PCI_EXP_LNKSTA_DLLLA); + } + + /* We changed link status bits over time, and changing them across + * migrations is generally fine as hardware changes them too. + * Let's not bother checking. + */ + pci_set_word(cmask + PCI_EXP_LNKSTA, 0); } int pcie_cap_init(PCIDevice *dev, uint8_t offset, uint8_t type, uint8_t port) @@ -88,7 +102,7 @@ int pcie_cap_init(PCIDevice *dev, uint8_t offset, uint8_t type, uint8_t port) exp_cap = dev->config + pos; /* Filling values common with v1 */ - pcie_cap_v1_fill(exp_cap, port, type, PCI_EXP_FLAGS_VER2); + pcie_cap_v1_fill(dev, port, type, PCI_EXP_FLAGS_VER2); /* Filling v2 specific values */ pci_set_long(exp_cap + PCI_EXP_DEVCAP2, @@ -103,7 +117,6 @@ int pcie_cap_v1_init(PCIDevice *dev, uint8_t offset, uint8_t type, { /* PCIe cap v1 init */ int pos; - uint8_t *exp_cap; assert(pci_is_express(dev)); @@ -112,9 +125,8 @@ int pcie_cap_v1_init(PCIDevice *dev, uint8_t offset, uint8_t type, return pos; } dev->exp.exp_cap = pos; - exp_cap = dev->config + pos; - pcie_cap_v1_fill(exp_cap, port, type, PCI_EXP_FLAGS_VER1); + pcie_cap_v1_fill(dev, port, type, PCI_EXP_FLAGS_VER1); return pos; } -- MST