From nobody Fri May 3 05:56:17 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; dkim=fail spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1491248951202330.51507282233047; Mon, 3 Apr 2017 12:49:11 -0700 (PDT) Received: from localhost ([::1]:60927 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cv7yO-0000gO-TK for importer@patchew.org; Mon, 03 Apr 2017 15:49:08 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39177) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cv7ti-0005Gp-Ve for qemu-devel@nongnu.org; Mon, 03 Apr 2017 15:44:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cv7tg-00039j-BL for qemu-devel@nongnu.org; Mon, 03 Apr 2017 15:44:19 -0400 Received: from mail-wr0-x242.google.com ([2a00:1450:400c:c0c::242]:32812) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cv7tg-00039E-5Q for qemu-devel@nongnu.org; Mon, 03 Apr 2017 15:44:16 -0400 Received: by mail-wr0-x242.google.com with SMTP id u18so36374395wrc.0 for ; Mon, 03 Apr 2017 12:44:16 -0700 (PDT) Received: from donizetti.lan (94-39-184-28.adsl-ull.clienti.tiscali.it. [94.39.184.28]) by smtp.gmail.com with ESMTPSA id 18sm19436935wrt.52.2017.04.03.12.44.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 03 Apr 2017 12:44:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=/qZgfv7vw9BHIyVk6eWeDo3gg1Pw7YZ11HPVgVgtiO8=; b=rbEP9rA88gzCic3Kjf0+Lv4tFzNRXahhUuH56u1Rm/3W867EAzFGdHmkm/OI9RZmGX 2nf4s7Z1Wkh4YcapojdLRnuF10o2+2Hnk7/d/zVnmr85fjuNdc3JYGbcV/T27lI64HzL tz0R3RdXAfpops5BUQYFt6XgxZKHk0mr0Sn46UlELMuZUi4iMEDXIxNQjgUPSP+kKToP +QD24Bfc5rGZF2gMC7UvMH8gVVuED4fR1gURaczWDn0GARrl390IBOuB0TwJ/pwBKgVg lYJTIEtmNf/UwEMhdU1/JT3ntnkqs88OY1+vcNbr6pKmiCyquR02F6BGX3HboMLNNMAz naiQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=/qZgfv7vw9BHIyVk6eWeDo3gg1Pw7YZ11HPVgVgtiO8=; b=V0gb98UseOcshaoJmKKRRUr+ljdQ6LLpe47aeytS6GR/pzSnVpvmCzH067P2fTsYI/ Y90NzirYvgH/s+LHJwN2djMMfOp5MxoFcS98bxRpbBhjV6EyeFDrcMjcqtVL8FwxtIe7 dB4iLhCDqDzUymAJNkKOPV2Ge14R/VMjXS3iyWRXcMX/yUuczjz2nV1IMrtELIdjQ9wK jp/HGb904pnpYJX4CCihsHwiWfAzLTNXBieo+nNZsjr0JmVsuI8ZowJdj7TPT9h6EwZG CxpInPc2OlUZNtVrBrobvwwGSOM4tjcyQAa8C63oqYfrkA2/QbtIw82tKcG9BRcaqUzI 1Dvw== X-Gm-Message-State: AFeK/H23XwlXHCJNV1xJzbf+leAsR0r9ncRv4SXEeZELbU1UIEBGbIRKMVrUZ4FOF1WB1A== X-Received: by 10.223.133.1 with SMTP id 1mr10857265wrh.111.1491248655073; Mon, 03 Apr 2017 12:44:15 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Mon, 3 Apr 2017 21:44:04 +0200 Message-Id: <20170403194409.21276-2-pbonzini@redhat.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170403194409.21276-1-pbonzini@redhat.com> References: <20170403194409.21276-1-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::242 Subject: [Qemu-devel] [PULL 1/6] iscsi: drop unused IscsiAIOCB.qiov field X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Stefan Hajnoczi Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Stefan Hajnoczi The IscsiAIOCB.qiov field has been unused since commit 063c3378a9e3c25cc0afac3c72e4823d0621e352 ("block/iscsi: introduce bdrv_co_{readv, writev, flush_to_disk}") back in 2013. Signed-off-by: Stefan Hajnoczi Message-Id: <20170327165005.22038-1-stefanha@redhat.com> Reviewed-by: Eric Blake Signed-off-by: Paolo Bonzini --- block/iscsi.c | 1 - 1 file changed, 1 deletion(-) diff --git a/block/iscsi.c b/block/iscsi.c index 75d8905..716e74a 100644 --- a/block/iscsi.c +++ b/block/iscsi.c @@ -103,7 +103,6 @@ typedef struct IscsiTask { =20 typedef struct IscsiAIOCB { BlockAIOCB common; - QEMUIOVector *qiov; QEMUBH *bh; IscsiLun *iscsilun; struct scsi_task *task; --=20 1.8.3.1 From nobody Fri May 3 05:56:17 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; dkim=fail spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1491248758735853.5244492437419; Mon, 3 Apr 2017 12:45:58 -0700 (PDT) Received: from localhost ([::1]:60912 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cv7vJ-0006Us-Av for importer@patchew.org; Mon, 03 Apr 2017 15:45:57 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39179) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cv7ti-0005Gr-W0 for qemu-devel@nongnu.org; Mon, 03 Apr 2017 15:44:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cv7th-0003AY-Gq for qemu-devel@nongnu.org; Mon, 03 Apr 2017 15:44:19 -0400 Received: from mail-wr0-x244.google.com ([2a00:1450:400c:c0c::244]:34000) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cv7th-00039t-9F for qemu-devel@nongnu.org; Mon, 03 Apr 2017 15:44:17 -0400 Received: by mail-wr0-x244.google.com with SMTP id w43so36363138wrb.1 for ; Mon, 03 Apr 2017 12:44:17 -0700 (PDT) Received: from donizetti.lan (94-39-184-28.adsl-ull.clienti.tiscali.it. [94.39.184.28]) by smtp.gmail.com with ESMTPSA id 18sm19436935wrt.52.2017.04.03.12.44.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 03 Apr 2017 12:44:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=7iiTi/IV8wF9dF9btOPV+HmOX8boONcVmGxby6Us94Y=; b=LfDlvJ+NZtECcNVZUPJvFKvx3+ykmi/en/ZwEWwa1kRqKA3QO3KdjtZgUECxJuRMHP 5adevH9KgMf4UpfFaRwJxQgx3VycuTxlg4UIZtQgyj/Ke6bfQC4pXmHvdBtYPDQoJHDK prINcpJFav3ZpmVposvZ1mqahEw0j1GWWknoFcNBNF07N23ymvSBRhfeENUPwsxPVkjP WtxOVBOzjy/YiJ7W1GDTvhaNtOJmJlsFW0CuZNAFAundLYRPrPBTLxCSCpLBk8h89r5t 1qJQQRFwEfqPBfWPfVu1SOHNooIZZ9f0k6l9cpDsXBYhTPoN0+iSd3tQjMVrUTbQF+P0 KASw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=7iiTi/IV8wF9dF9btOPV+HmOX8boONcVmGxby6Us94Y=; b=p0uPMeG9zaR1QuLTPHBS/rwuSJ3oXhFBOsy27hDyhNbBrVJUYQ1IMo2l5GVGc/yS6T 5BwQMVOFFNqTKnISfLjzmNXPGXO0tyBA+U144uxlJetTY4l0BMzc/Kd3aZYj+vKeFhhy aM1mkH9FHoZ5kqsrY3Bs2lxqAPwqNaMKoYoXNedCbnmIpNNtDeLMWGBgIFVFjF8WDI/E /7w+/V8ZZy6BU65Ovr0Kh0e47MUEQjHe0r8LTjIJQfqDYKniwMG1nPYn5SIGsU+c5Oap 35oaG8kjkvBf6wOTiNy0oJXZUMofllpfanZ6aoKd8+Ua3uaLK8PLlyhYef0zzDxtbb5W tqaQ== X-Gm-Message-State: AFeK/H0ZaHOsUPASJqMzobpWZhccpVGYRWdYbkkcQ5OkYgzKcZfrdrhOBDili2MmkM0oKA== X-Received: by 10.223.183.29 with SMTP id l29mr17912466wre.42.1491248655911; Mon, 03 Apr 2017 12:44:15 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Mon, 3 Apr 2017 21:44:05 +0200 Message-Id: <20170403194409.21276-3-pbonzini@redhat.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170403194409.21276-1-pbonzini@redhat.com> References: <20170403194409.21276-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::244 Subject: [Qemu-devel] [PULL 2/6] target-i386: fix "info lapic" segfault on isapc X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Tejaswini Poluri Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 From: Tejaswini Poluri Start QEMU with "qemu-system-x86_64 -nographic -M isapc -serial none-monitor stdio" and enter "info lapic" at the monitor prompt =C3=A2=E2=80=A1=E2=80=99 Segmentation fault Signed-off-by: Tejaswini Poluri Message-Id: <1490685583-16987-1-git-send-email-tejaswinipoluri3@gmail.com> Signed-off-by: Paolo Bonzini --- target/i386/helper.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/target/i386/helper.c b/target/i386/helper.c index e2af340..f11cac6 100644 --- a/target/i386/helper.c +++ b/target/i386/helper.c @@ -326,6 +326,10 @@ void x86_cpu_dump_local_apic_state(CPUState *cs, FILE = *f, { X86CPU *cpu =3D X86_CPU(cs); APICCommonState *s =3D APIC_COMMON(cpu->apic_state); + if (!s) { + cpu_fprintf(f, "local apic state not available\n"); + return; + } uint32_t *lvt =3D s->lvt; =20 cpu_fprintf(f, "dumping local APIC state for CPU %-2u\n\n", --=20 1.8.3.1 From nobody Fri May 3 05:56:17 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; dkim=fail spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1491248896214914.6596020943438; Mon, 3 Apr 2017 12:48:16 -0700 (PDT) Received: from localhost ([::1]:60923 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cv7xW-0008Oj-R4 for importer@patchew.org; Mon, 03 Apr 2017 15:48:14 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39202) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cv7tj-0005HI-Lc for qemu-devel@nongnu.org; Mon, 03 Apr 2017 15:44:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cv7ti-0003BB-Hi for qemu-devel@nongnu.org; Mon, 03 Apr 2017 15:44:19 -0400 Received: from mail-wr0-x243.google.com ([2a00:1450:400c:c0c::243]:34005) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cv7ti-0003Ad-8c for qemu-devel@nongnu.org; Mon, 03 Apr 2017 15:44:18 -0400 Received: by mail-wr0-x243.google.com with SMTP id w43so36363335wrb.1 for ; Mon, 03 Apr 2017 12:44:18 -0700 (PDT) Received: from donizetti.lan (94-39-184-28.adsl-ull.clienti.tiscali.it. [94.39.184.28]) by smtp.gmail.com with ESMTPSA id 18sm19436935wrt.52.2017.04.03.12.44.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 03 Apr 2017 12:44:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=6xD5DFTDzNKhTqN+F3XKW0uaYnAOsby5kYGfgZ3dw/g=; b=VHQGSANGFK8Y3TbTdJhRr4bUmtoYlxC78Mo3my1BK+bI/jb0dRaT/OvIt9R+2+DubW 5X2skJE5MciBVFqZOwIDw6n2+5AV1CFoh2sJ2tS0aRIKn37El9/x6Zqc7Pjx9QZpDTN8 rc4fPc3an0x6s9ay7M4oU2riS4dFzXI9pzqN5c/swVGuAv1sdY/1+lvo6GPUkE1FxcPs m0mzHPhc0mAV3iQLCIPhBv4U4E2rjwdeJXVG/XEsBelpBXBFOyxFRkCWgbpNCP/fWR/y j2jyHlm790aF8TQFG9zopbUuTqMqQOqV/tAvG60D0Wh3Ge0dE1MGpmNAWwGj7hKIcVgG zFYA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=6xD5DFTDzNKhTqN+F3XKW0uaYnAOsby5kYGfgZ3dw/g=; b=KyxwlCfei6wKnmjocwpTtHq88Ut/j9eOTPHdI+FT2mbZ8cJCNrZV2HKJNfF2ZYVvW7 Nji5GMZapBAqaVQfu7sc42Kuvfmr91L1iN+OL2ksEpHPAsA1BMYbmAVLk4IXLV9lLcFv mQcHg2wMKJEADQai/Nk1QOcU/qZERSJc5e8tgj77VLTuwxW0NIv2o7Gvi3XjRFPNR70B 01jOR80F5ANzRS/5eILTu8o9oCoLui0/W/F8hkzxjEIUH4uhsd3Z23H7NHAgZGhYw+fx cBLNt3SFf58F72Xbg25EBUGWk/MGke4XXeKCIfj69Mg7LtSLrHaSze4i1/wmsxbgJDCH me7w== X-Gm-Message-State: AFeK/H0fOKfys18bIpV9IMjWMuJ5fSYQ4WvUW+DVWVt5PUpVHSVJWKcATg3PbwTBpiQgsg== X-Received: by 10.223.142.202 with SMTP id q68mr16780546wrb.180.1491248656982; Mon, 03 Apr 2017 12:44:16 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Mon, 3 Apr 2017 21:44:06 +0200 Message-Id: <20170403194409.21276-4-pbonzini@redhat.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170403194409.21276-1-pbonzini@redhat.com> References: <20170403194409.21276-1-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::243 Subject: [Qemu-devel] [PULL 3/6] ipmi: Fix macro issues X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Corey Minyard Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Corey Minyard Macro parameters should almost always have () around them when used. llvm reported an error on this. Remove redundant parenthesis and put parenthesis around the entire macros with assignments in case they are used in an expression. Remove some unused macros. Reported in https://bugs.launchpad.net/bugs/1651167 Signed-off-by: Corey Minyard Reviewed-by: Eric Blake Message-Id: <1490894892-8055-1-git-send-email-minyard@acm.org> Signed-off-by: Paolo Bonzini --- hw/ipmi/isa_ipmi_bt.c | 34 ++++++++++++---------------------- 1 file changed, 12 insertions(+), 22 deletions(-) diff --git a/hw/ipmi/isa_ipmi_bt.c b/hw/ipmi/isa_ipmi_bt.c index 1c69cb3..2fcc3d2 100644 --- a/hw/ipmi/isa_ipmi_bt.c +++ b/hw/ipmi/isa_ipmi_bt.c @@ -37,40 +37,30 @@ #define IPMI_BT_HBUSY_BIT 6 #define IPMI_BT_BBUSY_BIT 7 =20 -#define IPMI_BT_CLR_WR_MASK (1 << IPMI_BT_CLR_WR_BIT) #define IPMI_BT_GET_CLR_WR(d) (((d) >> IPMI_BT_CLR_WR_BIT) & 0x1) -#define IPMI_BT_SET_CLR_WR(d, v) (d) =3D (((d) & ~IPMI_BT_CLR_WR_MASK) |= \ - (((v & 1) << IPMI_BT_CLR_WR_BIT))) =20 -#define IPMI_BT_CLR_RD_MASK (1 << IPMI_BT_CLR_RD_BIT) #define IPMI_BT_GET_CLR_RD(d) (((d) >> IPMI_BT_CLR_RD_BIT) & 0x1) -#define IPMI_BT_SET_CLR_RD(d, v) (d) =3D (((d) & ~IPMI_BT_CLR_RD_MASK) |= \ - (((v & 1) << IPMI_BT_CLR_RD_BIT))) =20 -#define IPMI_BT_H2B_ATN_MASK (1 << IPMI_BT_H2B_ATN_BIT) #define IPMI_BT_GET_H2B_ATN(d) (((d) >> IPMI_BT_H2B_ATN_BIT) & 0x1) -#define IPMI_BT_SET_H2B_ATN(d, v) (d) =3D (((d) & ~IPMI_BT_H2B_ATN_MASK) = | \ - (((v & 1) << IPMI_BT_H2B_ATN_BIT))) =20 #define IPMI_BT_B2H_ATN_MASK (1 << IPMI_BT_B2H_ATN_BIT) #define IPMI_BT_GET_B2H_ATN(d) (((d) >> IPMI_BT_B2H_ATN_BIT) & 0x1) -#define IPMI_BT_SET_B2H_ATN(d, v) (d) =3D (((d) & ~IPMI_BT_B2H_ATN_MASK) = | \ - (((v & 1) << IPMI_BT_B2H_ATN_BIT))) +#define IPMI_BT_SET_B2H_ATN(d, v) ((d) =3D (((d) & ~IPMI_BT_B2H_ATN_MASK)= | \ + (((v) & 1) << IPMI_BT_B2H_ATN_BIT)= )) =20 #define IPMI_BT_SMS_ATN_MASK (1 << IPMI_BT_SMS_ATN_BIT) #define IPMI_BT_GET_SMS_ATN(d) (((d) >> IPMI_BT_SMS_ATN_BIT) & 0x1) -#define IPMI_BT_SET_SMS_ATN(d, v) (d) =3D (((d) & ~IPMI_BT_SMS_ATN_MASK) = | \ - (((v & 1) << IPMI_BT_SMS_ATN_BIT))) +#define IPMI_BT_SET_SMS_ATN(d, v) ((d) =3D (((d) & ~IPMI_BT_SMS_ATN_MASK)= | \ + (((v) & 1) << IPMI_BT_SMS_ATN_BIT)= )) =20 #define IPMI_BT_HBUSY_MASK (1 << IPMI_BT_HBUSY_BIT) #define IPMI_BT_GET_HBUSY(d) (((d) >> IPMI_BT_HBUSY_BIT) & 0x1) -#define IPMI_BT_SET_HBUSY(d, v) (d) =3D (((d) & ~IPMI_BT_HBUSY_MASK) | \ - (((v & 1) << IPMI_BT_HBUSY_BIT))) +#define IPMI_BT_SET_HBUSY(d, v) ((d) =3D (((d) & ~IPMI_BT_HBUSY_MASK) |= \ + (((v) & 1) << IPMI_BT_HBUSY_BIT))) =20 #define IPMI_BT_BBUSY_MASK (1 << IPMI_BT_BBUSY_BIT) -#define IPMI_BT_GET_BBUSY(d) (((d) >> IPMI_BT_BBUSY_BIT) & 0x1) -#define IPMI_BT_SET_BBUSY(d, v) (d) =3D (((d) & ~IPMI_BT_BBUSY_MASK) | \ - (((v & 1) << IPMI_BT_BBUSY_BIT))) +#define IPMI_BT_SET_BBUSY(d, v) ((d) =3D (((d) & ~IPMI_BT_BBUSY_MASK) |= \ + (((v) & 1) << IPMI_BT_BBUSY_BIT))) =20 =20 /* Mask register */ @@ -79,13 +69,13 @@ =20 #define IPMI_BT_B2H_IRQ_EN_MASK (1 << IPMI_BT_B2H_IRQ_EN_BIT) #define IPMI_BT_GET_B2H_IRQ_EN(d) (((d) >> IPMI_BT_B2H_IRQ_EN_BIT) & 0x= 1) -#define IPMI_BT_SET_B2H_IRQ_EN(d, v) (d) =3D (((d) & ~IPMI_BT_B2H_IRQ_EN_M= ASK) | \ - (((v & 1) << IPMI_BT_B2H_IRQ_EN_BI= T))) +#define IPMI_BT_SET_B2H_IRQ_EN(d, v) ((d) =3D (((d) & ~IPMI_BT_B2H_IRQ_EN_= MASK) |\ + (((v) & 1) << IPMI_BT_B2H_IRQ_EN_B= IT))) =20 #define IPMI_BT_B2H_IRQ_MASK (1 << IPMI_BT_B2H_IRQ_BIT) #define IPMI_BT_GET_B2H_IRQ(d) (((d) >> IPMI_BT_B2H_IRQ_BIT) & 0x1) -#define IPMI_BT_SET_B2H_IRQ(d, v) (d) =3D (((d) & ~IPMI_BT_B2H_IRQ_MASK= ) | \ - (((v & 1) << IPMI_BT_B2H_IRQ_BIT))) +#define IPMI_BT_SET_B2H_IRQ(d, v) ((d) =3D (((d) & ~IPMI_BT_B2H_IRQ_MAS= K) | \ + (((v) & 1) << IPMI_BT_B2H_IRQ_BIT)= )) =20 typedef struct IPMIBT { IPMIBmc *bmc; --=20 1.8.3.1 From nobody Fri May 3 05:56:17 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; dkim=fail spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1491249092596237.00896388310184; Mon, 3 Apr 2017 12:51:32 -0700 (PDT) Received: from localhost ([::1]:60938 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cv80h-0002hD-EQ for importer@patchew.org; Mon, 03 Apr 2017 15:51:31 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39228) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cv7tl-0005JF-QK for qemu-devel@nongnu.org; Mon, 03 Apr 2017 15:44:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cv7tj-0003Bd-9M for qemu-devel@nongnu.org; Mon, 03 Apr 2017 15:44:21 -0400 Received: from mail-wr0-x22c.google.com ([2a00:1450:400c:c0c::22c]:34972) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cv7tj-0003B4-2A for qemu-devel@nongnu.org; Mon, 03 Apr 2017 15:44:19 -0400 Received: by mail-wr0-x22c.google.com with SMTP id k6so179297808wre.2 for ; Mon, 03 Apr 2017 12:44:18 -0700 (PDT) Received: from donizetti.lan (94-39-184-28.adsl-ull.clienti.tiscali.it. [94.39.184.28]) by smtp.gmail.com with ESMTPSA id 18sm19436935wrt.52.2017.04.03.12.44.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 03 Apr 2017 12:44:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=eSbSbf99x5ZbjP/TvEbt6f4U4er83LbBx7jKJCL0Nac=; b=UOWQwfnX4UshqGrU3kViTXFS8dLGThVrAXmrGyFGpIncyzUEQb7XExoWuK11EPNjit tb587z3YbsiT2Unt2CFzSc5LkgZi6EV8bC+1ovyAqlJPDtf9LKtihSspDD62QciDjQwN 3OKsy3bW+v+4mI1qvoDvP19XJLKaPWI110wZpNbhXcksxnoOlwGOEc0rcJS4mydCvJ/n S2+RcJQG+xgxarvGcdGi0CqAnR1dbtN5NEtAsDJf4NHkFZtMETJOzHuVzmjt1xzxOyOC TIwA4jqZAnh2MFMGsVoPVL6gRLWorFFE/M05a6THikvK3rYcZ7fYRbOHGjPFv90IjZqR D8Ew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=eSbSbf99x5ZbjP/TvEbt6f4U4er83LbBx7jKJCL0Nac=; b=XKaG1IGYH1cq/qEevXWB1Wrjs0p1ac6JxZAOq51sf/dZe8ckxkn3pTy8dE9us/jfa7 tdxfpr/F1ZlM3Dan3HWt5ER5pSMCOe9Rtlnc+YebToSXZbWEMXzGNcUa/QGJbmp6MPtl WTGeGmu8gQPyvLeEwyUouCLiymq+IF/9bz+pyIh9Wx0AxnBFzKfYy1jLvg9JHMBZS8SN XN6RKU7cFa+C9KdqxG7DY59XmtT3/fzh+NMOzmJ+0NHHwlyCbOeXclf0kJeEfOZLlm2e Ja+G8kl42uVZ4M0QTmi/ytN1LWpLQW/kPGhp5S5VOtZL4zME7elK7f7DX8wTofbOT4/y vi0g== X-Gm-Message-State: AFeK/H0vSTktb1DPGDrByWju1lqnjeFH91KGbT0zZ3gcN8JHh4O5WE44jvWryDGVu7dXFQ== X-Received: by 10.223.153.142 with SMTP id y14mr16351032wrb.193.1491248657946; Mon, 03 Apr 2017 12:44:17 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Mon, 3 Apr 2017 21:44:07 +0200 Message-Id: <20170403194409.21276-5-pbonzini@redhat.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170403194409.21276-1-pbonzini@redhat.com> References: <20170403194409.21276-1-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::22c Subject: [Qemu-devel] [PULL 4/6] nbd: fix memory leak on socket_connect failed X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: yaolujing Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: yaolujing When TCP connection fails between nbd server and client, the local var, sioc, memory leak. This patch fixes the memory leak. Signed-off-by: yaolujing Reviewed-by: Eric Blake Message-Id: <1491005709-29989-1-git-send-email-yaolujing@huawei.com> Signed-off-by: Paolo Bonzini --- block/nbd.c | 1 + 1 file changed, 1 insertion(+) diff --git a/block/nbd.c b/block/nbd.c index 1b832c2..3150712 100644 --- a/block/nbd.c +++ b/block/nbd.c @@ -311,6 +311,7 @@ static QIOChannelSocket *nbd_establish_connection(Socke= tAddress *saddr, saddr, &local_err); if (local_err) { + object_unref(OBJECT(sioc)); error_propagate(errp, local_err); return NULL; } --=20 1.8.3.1 From nobody Fri May 3 05:56:17 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; dkim=fail spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 149124903631577.71952915984355; Mon, 3 Apr 2017 12:50:36 -0700 (PDT) Received: from localhost ([::1]:60937 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cv7zm-0001o2-PU for importer@patchew.org; Mon, 03 Apr 2017 15:50:34 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39222) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cv7tl-0005Is-IY for qemu-devel@nongnu.org; Mon, 03 Apr 2017 15:44:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cv7tk-0003CP-Fo for qemu-devel@nongnu.org; Mon, 03 Apr 2017 15:44:21 -0400 Received: from mail-wr0-x243.google.com ([2a00:1450:400c:c0c::243]:32829) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cv7tk-0003Bl-6H for qemu-devel@nongnu.org; Mon, 03 Apr 2017 15:44:20 -0400 Received: by mail-wr0-x243.google.com with SMTP id u18so36375016wrc.0 for ; Mon, 03 Apr 2017 12:44:20 -0700 (PDT) Received: from donizetti.lan (94-39-184-28.adsl-ull.clienti.tiscali.it. [94.39.184.28]) by smtp.gmail.com with ESMTPSA id 18sm19436935wrt.52.2017.04.03.12.44.17 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 03 Apr 2017 12:44:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:subject:date:message-id:in-reply-to:references; bh=NJ/NyLn71vhzB6KOOrmaYscNoOa2gVD40aq72JYipBI=; b=nSqQC8tq/bjmrByuOSW3qvBJuKquA475RplLSJ5psXzJPG4CM59Ul4WrAksX5NCrbm t0Bfk817Xo18hYC5YretdLjlK3XzMZ14loBzK3OMdXtZgIyE4Fu4WHkDMrKl3eXYHHld jqcI0aOuXXCzYc9t5RZIi3jBLMuqtAtRgtYMej0zAp1u4P6yUHS3iLAJVstkGvk+NkNv 1W4Bi5CYez/IBvHBNkLBSWHOzMXZATKChWGezk/1vKuyBhR/bieSs5eA5b7xyjaglygC o5Eg4AdmcHtUO5gvMYsVG25nGJF3ZJlmXdvhX01zGt64qFxi+QxdmT3ig63rfdz0RkMx bP/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:subject:date:message-id :in-reply-to:references; bh=NJ/NyLn71vhzB6KOOrmaYscNoOa2gVD40aq72JYipBI=; b=ftq+h8xakPJn5/RWDyNLS6O8SjbQL52WTawngXKXWnXce1mQYV4HeVfx4vzOaIOdM9 CbkPA1pL/+KumaQzrU3v+JMBHL2EPRgnuZVBlLnpklqX2PZMYLd2vsl32Bn9wLEtIruS TomZ1xIB3XUCpgGusqidNPdzcKcCG91vfnrKThi6X857eozczZr6bGivvk75DS8Smhc3 EPmpmy2S92ZUwB2RTGJOrIlxcDYzZJmvwZzbp5sTImfLJrxY+Vn3emmWNy2AYrptT92z PNbq82hCwT/qRurwWZSmI2iof8dEyXN5V3euaqQ80I2QXGn+eHuZzDQH0yEE3UP8xkiA +yIg== X-Gm-Message-State: AFeK/H2EwUq49ZK1IXZQ+obh25LVYwHDCnAdLoBelZuZlDch7wlMF/jKRjhH/vUIfSPp8w== X-Received: by 10.223.177.219 with SMTP id r27mr18332136wra.194.1491248658914; Mon, 03 Apr 2017 12:44:18 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Mon, 3 Apr 2017 21:44:08 +0200 Message-Id: <20170403194409.21276-6-pbonzini@redhat.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170403194409.21276-1-pbonzini@redhat.com> References: <20170403194409.21276-1-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::243 Subject: [Qemu-devel] [PULL 5/6] exec: revert MemoryRegionCache X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" MemoryRegionCache did not know about virtio support for IOMMUs (because the two features were developed at the same time). Revert MemoryRegionCache to "normal" address_space_* operations for 2.9, as it is simpler than undoing the virtio patches. Signed-off-by: Paolo Bonzini --- exec.c | 64 +++++++++--------------------------------------= ---- include/exec/memory.h | 10 ++++---- 2 files changed, 15 insertions(+), 59 deletions(-) diff --git a/exec.c b/exec.c index e57a8a2..c97ef4a 100644 --- a/exec.c +++ b/exec.c @@ -3236,75 +3236,33 @@ int64_t address_space_cache_init(MemoryRegionCache = *cache, hwaddr len, bool is_write) { - hwaddr l, xlat; - MemoryRegion *mr; - void *ptr; - - assert(len > 0); - - l =3D len; - mr =3D address_space_translate(as, addr, &xlat, &l, is_write); - if (!memory_access_is_direct(mr, is_write)) { - return -EINVAL; - } - - l =3D address_space_extend_translation(as, addr, len, mr, xlat, l, is_= write); - ptr =3D qemu_ram_ptr_length(mr->ram_block, xlat, &l); - - cache->xlat =3D xlat; - cache->is_write =3D is_write; - cache->mr =3D mr; - cache->ptr =3D ptr; - cache->len =3D l; - memory_region_ref(cache->mr); - - return l; + cache->len =3D len; + cache->as =3D as; + cache->xlat =3D addr; + return len; } =20 void address_space_cache_invalidate(MemoryRegionCache *cache, hwaddr addr, hwaddr access_len) { - assert(cache->is_write); - invalidate_and_set_dirty(cache->mr, addr + cache->xlat, access_len); } =20 void address_space_cache_destroy(MemoryRegionCache *cache) { - if (!cache->mr) { - return; - } - - if (xen_enabled()) { - xen_invalidate_map_cache_entry(cache->ptr); - } - memory_region_unref(cache->mr); - cache->mr =3D NULL; -} - -/* Called from RCU critical section. This function has the same - * semantics as address_space_translate, but it only works on a - * predefined range of a MemoryRegion that was mapped with - * address_space_cache_init. - */ -static inline MemoryRegion *address_space_translate_cached( - MemoryRegionCache *cache, hwaddr addr, hwaddr *xlat, - hwaddr *plen, bool is_write) -{ - assert(addr < cache->len && *plen <=3D cache->len - addr); - *xlat =3D addr + cache->xlat; - return cache->mr; + cache->as =3D NULL; } =20 #define ARG1_DECL MemoryRegionCache *cache #define ARG1 cache #define SUFFIX _cached -#define TRANSLATE(...) address_space_translate_cached(cache, __V= A_ARGS__) +#define TRANSLATE(addr, ...) \ + address_space_translate(cache->as, cache->xlat + (addr), __VA_ARGS__) #define IS_DIRECT(mr, is_write) true -#define MAP_RAM(mr, ofs) (cache->ptr + (ofs - cache->xlat)) -#define INVALIDATE(mr, ofs, len) ((void)0) -#define RCU_READ_LOCK() ((void)0) -#define RCU_READ_UNLOCK() ((void)0) +#define MAP_RAM(mr, ofs) qemu_map_ram_ptr((mr)->ram_block, ofs) +#define INVALIDATE(mr, ofs, len) invalidate_and_set_dirty(mr, ofs, len) +#define RCU_READ_LOCK() rcu_read_lock() +#define RCU_READ_UNLOCK() rcu_read_unlock() #include "memory_ldst.inc.c" =20 /* virtual memory access for debug (includes writing to ROM) */ diff --git a/include/exec/memory.h b/include/exec/memory.h index e39256a..f20b191 100644 --- a/include/exec/memory.h +++ b/include/exec/memory.h @@ -1426,13 +1426,11 @@ void stq_be_phys(AddressSpace *as, hwaddr addr, uin= t64_t val); =20 struct MemoryRegionCache { hwaddr xlat; - void *ptr; hwaddr len; - MemoryRegion *mr; - bool is_write; + AddressSpace *as; }; =20 -#define MEMORY_REGION_CACHE_INVALID ((MemoryRegionCache) { .mr =3D NULL }) +#define MEMORY_REGION_CACHE_INVALID ((MemoryRegionCache) { .as =3D NULL }) =20 /* address_space_cache_init: prepare for repeated access to a physical * memory region @@ -1688,7 +1686,7 @@ address_space_read_cached(MemoryRegionCache *cache, h= waddr addr, void *buf, int len) { assert(addr < cache->len && len <=3D cache->len - addr); - memcpy(buf, cache->ptr + addr, len); + address_space_read(cache->as, cache->xlat + addr, MEMTXATTRS_UNSPECIFI= ED, buf, len); } =20 /** @@ -1704,7 +1702,7 @@ address_space_write_cached(MemoryRegionCache *cache, = hwaddr addr, void *buf, int len) { assert(addr < cache->len && len <=3D cache->len - addr); - memcpy(cache->ptr + addr, buf, len); + address_space_write(cache->as, cache->xlat + addr, MEMTXATTRS_UNSPECIF= IED, buf, len); } =20 #endif --=20 1.8.3.1 From nobody Fri May 3 05:56:17 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; dkim=fail spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1491248765617386.65676886915344; Mon, 3 Apr 2017 12:46:05 -0700 (PDT) Received: from localhost ([::1]:60914 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cv7vQ-0006ZY-2t for importer@patchew.org; Mon, 03 Apr 2017 15:46:04 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39244) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cv7tm-0005Jw-EL for qemu-devel@nongnu.org; Mon, 03 Apr 2017 15:44:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cv7tl-0003Ce-5A for qemu-devel@nongnu.org; Mon, 03 Apr 2017 15:44:22 -0400 Received: from mail-wr0-x244.google.com ([2a00:1450:400c:c0c::244]:36142) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cv7tk-0003CI-U2 for qemu-devel@nongnu.org; Mon, 03 Apr 2017 15:44:21 -0400 Received: by mail-wr0-x244.google.com with SMTP id k6so35038858wre.3 for ; Mon, 03 Apr 2017 12:44:20 -0700 (PDT) Received: from donizetti.lan (94-39-184-28.adsl-ull.clienti.tiscali.it. [94.39.184.28]) by smtp.gmail.com with ESMTPSA id 18sm19436935wrt.52.2017.04.03.12.44.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 03 Apr 2017 12:44:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=rG/k0UDpWkpw3ShFdWmJ28xR6NVjiObIg6Jkg3b/MAs=; b=M3pcvNYAP5Fe+odZTN9VOBqOP8lu/Yp6Xav7+ezvUqZ9x3B5hU8b1OdaBkrI9r1BiT G2RQ0lEYfZ7SeG/nWGVmNVyLEuhUA9HF4GTrFrZju5s9FlZBgi2oOfI9uiS893bGtV7l 2Wo+zzdzTBCf46P7NCPpZypaxPpPs0J5lIfAmbbwyyLQ7oZ7ie9iGqNduVJ+fQ27YfKc IYC/t9ELuCO4QQtsm+hw2m2ILxHD0+pUqLhRrQcxWLAF9PLnBffuNJT/kgFTRHCxVOd2 2VACMf7viUrBLNMFr5IE6Nsseypu2JWIMZVsZ7JDAh8+iis1WsCmlxVKUqZ5SRu/7D24 LX8Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=rG/k0UDpWkpw3ShFdWmJ28xR6NVjiObIg6Jkg3b/MAs=; b=UorKRny3oXniyLDuuJiONzuKEkpG/ziz13DuXMnJ5FBAqOkdnxn/FTzPIb993yhd5H PloHDA/0p6IJ+CwpazyHJC2RfoXf7xR8m1rp+PxGlnBRcajCgWPhMA14uXKH+3Z5eB3E 14et3O0Mvk84Jee2Xy1GYWSC6KrjbaTIdBNXgV49d6Bi66hMoh9cQlgUhCuT1T6rLsD8 Mqz1pEkzVOpioPqk/Aa5BkgQRucFLGF5fHeIF8Wq20G2dloAN7vK2ve7r5GRfSClgMjL es5oZX6OCJtze3t+coqp8Q4cKWtn7C0PAfc2VOrnhTfh8344xrzqIq8LuEF3wd19m3NA h6lg== X-Gm-Message-State: AFeK/H13AP72+LSIilVTWh9tkXjN1J3p9b9Jw1fNAORkTpJ71fqHjn/N cBipyM8O3FuoJQ== X-Received: by 10.28.208.72 with SMTP id h69mr11184532wmg.100.1491248659866; Mon, 03 Apr 2017 12:44:19 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Mon, 3 Apr 2017 21:44:09 +0200 Message-Id: <20170403194409.21276-7-pbonzini@redhat.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170403194409.21276-1-pbonzini@redhat.com> References: <20170403194409.21276-1-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::244 Subject: [Qemu-devel] [PULL 6/6] main-loop: Acquire main_context lock around os_host_main_loop_wait. X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Richard W.M. Jones" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: "Richard W.M. Jones" When running virt-rescue the serial console hangs from time to time. Virt-rescue runs an ordinary Linux kernel "appliance", but there is only a single idle process running inside, so the qemu main loop is largely idle. With virt-rescue >=3D 1.37 you may be able to observe the hang by doing: $ virt-rescue -e ^] --scratch > while true; do ls -l /usr/bin; done The hang in virt-rescue can be resolved by pressing a key on the serial console. Possibly with the same root cause, we also observed hangs during very early boot of regular Linux VMs with a serial console. Those hangs are extremely rare, but you may be able to observe them by running this command on baremetal for a sufficiently long time: $ while libguestfs-test-tool -t 60 >& /tmp/log ; do echo -n . ; done (Check in /tmp/log that the failure was caused by a hang during early boot, and not some other reason) During investigation of this bug, Paolo Bonzini wrote: > glib is expecting QEMU to use g_main_context_acquire around accesses to > GMainContext. However QEMU is not doing that, instead it is taking its > own mutex. So we should add g_main_context_acquire and > g_main_context_release in the two implementations of > os_host_main_loop_wait; these should undo the effect of Frediano's > glib patch. This patch exactly implements Paolo's suggestion in that paragraph. This fixes the serial console hang in my testing, across 3 different physical machines (AMD, Intel Core i7 and Intel Xeon), over many hours of automated testing. I wasn't able to reproduce the early boot hangs (but as noted above, these are extremely rare in any case). Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=3D1435432 Reported-by: Richard W.M. Jones Tested-by: Richard W.M. Jones Signed-off-by: Richard W.M. Jones Message-Id: <20170331205133.23906-1-rjones@redhat.com> [Paolo: this is actually a glib bug: recent glib versions are also expecting g_main_context_acquire around g_poll---but that is not documented and probably not even intended]. Signed-off-by: Paolo Bonzini --- util/main-loop.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/util/main-loop.c b/util/main-loop.c index 4534c89..19cad6b 100644 --- a/util/main-loop.c +++ b/util/main-loop.c @@ -218,9 +218,12 @@ static void glib_pollfds_poll(void) =20 static int os_host_main_loop_wait(int64_t timeout) { + GMainContext *context =3D g_main_context_default(); int ret; static int spin_counter; =20 + g_main_context_acquire(context); + glib_pollfds_fill(&timeout); =20 /* If the I/O thread is very busy or we are incorrectly busy waiting in @@ -256,6 +259,9 @@ static int os_host_main_loop_wait(int64_t timeout) } =20 glib_pollfds_poll(); + + g_main_context_release(context); + return ret; } #else @@ -412,12 +418,15 @@ static int os_host_main_loop_wait(int64_t timeout) fd_set rfds, wfds, xfds; int nfds; =20 + g_main_context_acquire(context); + /* XXX: need to suppress polling by better using win32 events */ ret =3D 0; for (pe =3D first_polling_entry; pe !=3D NULL; pe =3D pe->next) { ret |=3D pe->func(pe->opaque); } if (ret !=3D 0) { + g_main_context_release(context); return ret; } =20 @@ -472,6 +481,8 @@ static int os_host_main_loop_wait(int64_t timeout) g_main_context_dispatch(context); } =20 + g_main_context_release(context); + return select_ret || g_poll_ret; } #endif --=20 1.8.3.1