From nobody Thu May 2 14:57:24 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1566408648; cv=none; d=zoho.com; s=zohoarc; b=aYUPGMSTtxuYn1mMat70TagAfDkskIwk2agOfzo7IQdCiT0r2CK6DSjbEFPOCqa6Wr1KnAYZ8QS99QPFKOg+TTvqBNgeLRCE9SqZQ/oaOJSG81wXRIEgCrqr4GW457pnJX9/Miw4oQjnB+6DjHGRgaIFINe02PH7Nbc9waeVmtU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1566408648; h=Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=FgU2nY5MmK6rHYaC6PlgLHs+fz6Jb1ApcmbPuak/SwY=; b=G/yqtsLdtPoR+ZBp1IBHy6irOdRc9j9SEUhcEICKd9x0kZE4Ay7sqKaqprPb+AIEjt1HZEcaDXq63D24GgC08qmYWMkPwTJb43kApZ3UwP/etG+Cp2l8u/4Pz8yPpQIGDlflhsJmyPrapvrHlxvZSRXijLO2AjPbxUVud83YOpg= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1566408648685234.70795222201434; Wed, 21 Aug 2019 10:30:48 -0700 (PDT) Received: from localhost ([::1]:51088 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i0URY-0000Mz-BK for importer@patchew.org; Wed, 21 Aug 2019 13:30:44 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40221) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i0UPM-0006Ki-5b for qemu-devel@nongnu.org; Wed, 21 Aug 2019 13:28:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i0UPL-000527-2Q for qemu-devel@nongnu.org; Wed, 21 Aug 2019 13:28:28 -0400 Received: from mx1.redhat.com ([209.132.183.28]:53030) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1i0UPK-00051Z-T0 for qemu-devel@nongnu.org; Wed, 21 Aug 2019 13:28:27 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 3511530860A5 for ; Wed, 21 Aug 2019 17:28:26 +0000 (UTC) Received: from 640k.localdomain.com (ovpn-112-20.ams2.redhat.com [10.36.112.20]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6D47160E1C for ; Wed, 21 Aug 2019 17:28:25 +0000 (UTC) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 21 Aug 2019 19:28:09 +0200 Message-Id: <1566408501-48680-2-git-send-email-pbonzini@redhat.com> In-Reply-To: <1566408501-48680-1-git-send-email-pbonzini@redhat.com> References: <1566408501-48680-1-git-send-email-pbonzini@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.44]); Wed, 21 Aug 2019 17:28:26 +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-devel] [PULL 01/13] qemu-ga: clean up TOOLS variable X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 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" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" qemu-ga is included in the TOOLS variable without the .exe suffix, and this= is then worked around twice in the Makefile. Do the right thing in configure instead. Signed-off-by: Paolo Bonzini --- Makefile | 4 ++-- configure | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 85862fb..00825cd 100644 --- a/Makefile +++ b/Makefile @@ -681,7 +681,7 @@ clean: recurse-clean ! -path ./roms/edk2/BaseTools/Source/Python/UPT/Dll/sqlite3.dll \ -exec rm {} + rm -f $(edk2-decompressed) - rm -f $(filter-out %.tlb,$(TOOLS)) $(HELPERS-y) qemu-ga$(EXESUF) TAGS csc= ope.* *.pod *~ */*~ + rm -f $(filter-out %.tlb,$(TOOLS)) $(HELPERS-y) TAGS cscope.* *.pod *~ */= *~ rm -f fsdev/*.pod scsi/*.pod rm -f qemu-img-cmds.h rm -f ui/shader/*-vert.h ui/shader/*-frag.h @@ -845,7 +845,7 @@ install: all $(if $(BUILD_DOCS),install-doc) install-da= tadir install-localstated $(if $(INSTALL_BLOBS),$(edk2-decompressed)) \ recurse-install ifneq ($(TOOLS),) - $(call install-prog,$(subst qemu-ga,qemu-ga$(EXESUF),$(TOOLS)),$(DESTDIR)= $(bindir)) + $(call install-prog,$(TOOLS),$(DESTDIR)$(bindir)) endif ifneq ($(CONFIG_MODULES),) $(INSTALL_DIR) "$(DESTDIR)$(qemu_moddir)" diff --git a/configure b/configure index 942a73b..e96981b 100755 --- a/configure +++ b/configure @@ -6129,7 +6129,7 @@ if [ "$guest_agent" !=3D "no" ]; then if [ "$softmmu" =3D no -a "$want_tools" =3D no ] ; then guest_agent=3Dno elif [ "$linux" =3D "yes" -o "$bsd" =3D "yes" -o "$solaris" =3D "yes" -o= "$mingw32" =3D "yes" ] ; then - tools=3D"qemu-ga $tools" + tools=3D"qemu-ga\$(EXESUF) $tools" guest_agent=3Dyes elif [ "$guest_agent" !=3D yes ]; then guest_agent=3Dno --=20 1.8.3.1 From nobody Thu May 2 14:57:24 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1566409391; cv=none; d=zoho.com; s=zohoarc; b=aAAUTREGyThVIxkrTFvHGQ1+7jrCikbS/flj+WxhgnzVTRcsItShiBMkrbYT3JJMNn3BPFQkv/aXO473M9t5q1uRb/uzBrxOxR7iBfWdzOS1Vi+GpljSefLVQUHBRFxPZkb2I6YFuKwJH9KLYJtvITkAMYtd4S6iyt7WDpIkpqY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1566409391; h=Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=ffNlRYpMtHhFHR1YLyjwFVailrbbMMRxwIQyx9VEE5Q=; b=hu54C+Md0+2qYjv5CQa0AByBbHiHXS7HG9liGsVLodLBg4jcNoHdJBhFtJJUfV/avEwfbCZljDiHa+BzMs/aNBmo07pC1JzD7pHDwVLiB75QIH0wSBt1KMssi9sPNUV7MNyCc6QG6DIHv63ughYTAyIG+IlH16rVRy3Ys72zjQY= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1566409391965627.5920996913977; Wed, 21 Aug 2019 10:43:11 -0700 (PDT) Received: from localhost ([::1]:51268 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i0Uda-0001Cl-IA for importer@patchew.org; Wed, 21 Aug 2019 13:43:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40240) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i0UPN-0006N6-DU for qemu-devel@nongnu.org; Wed, 21 Aug 2019 13:28:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i0UPM-00053p-7r for qemu-devel@nongnu.org; Wed, 21 Aug 2019 13:28:29 -0400 Received: from mx1.redhat.com ([209.132.183.28]:56272) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1i0UPM-000537-2V for qemu-devel@nongnu.org; Wed, 21 Aug 2019 13:28:28 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6C85A308FB9A for ; Wed, 21 Aug 2019 17:28:27 +0000 (UTC) Received: from 640k.localdomain.com (ovpn-112-20.ams2.redhat.com [10.36.112.20]) by smtp.corp.redhat.com (Postfix) with ESMTP id A583360F88 for ; Wed, 21 Aug 2019 17:28:26 +0000 (UTC) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 21 Aug 2019 19:28:10 +0200 Message-Id: <1566408501-48680-3-git-send-email-pbonzini@redhat.com> In-Reply-To: <1566408501-48680-1-git-send-email-pbonzini@redhat.com> References: <1566408501-48680-1-git-send-email-pbonzini@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.43]); Wed, 21 Aug 2019 17:28:27 +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-devel] [PULL 02/13] configure: define CONFIG_TOOLS here X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 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" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Defining CONFIG_TOOLS on the basis of $(TOOLS) has the disadvantage of including it also if e.g. qemu-ga is requested. The correct information is available in configure, define it there. This also has the benefit of not installing the manpages for block layer tools if the only "tool" being built is the guest agent. Signed-off-by: Paolo Bonzini --- Makefile | 5 ++--- configure | 3 +++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 00825cd..574fede 100644 --- a/Makefile +++ b/Makefile @@ -84,8 +84,7 @@ endif =20 include $(SRC_PATH)/rules.mak =20 -# notempy and lor are defined in rules.mak -CONFIG_TOOLS :=3D $(call notempty,$(TOOLS)) +# lor is defined in rules.mak CONFIG_BLOCK :=3D $(call lor,$(CONFIG_SOFTMMU),$(CONFIG_TOOLS)) =20 # Create QEMU_PKGVERSION and FULL_VERSION strings @@ -809,7 +808,7 @@ ifdef CONFIG_POSIX $(INSTALL_DATA) docs/interop/qemu-qmp-ref.7 "$(DESTDIR)$(mandir)/man7" $(INSTALL_DATA) docs/qemu-block-drivers.7 "$(DESTDIR)$(mandir)/man7" $(INSTALL_DATA) docs/qemu-cpu-models.7 "$(DESTDIR)$(mandir)/man7" -ifneq ($(TOOLS),) +ifeq ($(CONFIG_TOOLS),y) $(INSTALL_DATA) qemu-img.1 "$(DESTDIR)$(mandir)/man1" $(INSTALL_DIR) "$(DESTDIR)$(mandir)/man8" $(INSTALL_DATA) qemu-nbd.8 "$(DESTDIR)$(mandir)/man8" diff --git a/configure b/configure index e96981b..b7f4283 100755 --- a/configure +++ b/configure @@ -6617,6 +6617,9 @@ fi if test "$profiler" =3D "yes" ; then echo "CONFIG_PROFILER=3Dy" >> $config_host_mak fi +if test "$want_tools" =3D "yes" ; then + echo "CONFIG_TOOLS=3Dy" >> $config_host_mak +fi if test "$slirp" !=3D "no"; then echo "CONFIG_SLIRP=3Dy" >> $config_host_mak echo "CONFIG_SMBD_COMMAND=3D\"$smbd\"" >> $config_host_mak --=20 1.8.3.1 From nobody Thu May 2 14:57:24 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1566408648; cv=none; d=zoho.com; s=zohoarc; b=lbvhbXqkNo+lnCuLvbP65G0rP1Nfl1vJ5R2kqDuQdAsmzM5JLW+d/luWo/c0FybipGWM8SDSkyTjlDacGsp9fXqFStLtZU9wqdL7YAyWra1tdvmuDL7hVHJDtyMjsgZUtXx/v5WkIV5nVq8UQNJcuVNJfG3lICQxdfHml+0NQuU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1566408648; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=gX6iQrPe+R58+XdgSFci297NASYzTdRvyzSM68EjsDM=; b=LncxlxUWTNRgRMY+FKyDfyJVxf9HzGKUMtKfOqwZyRjijG1/3jt/wXTkMYlj8umJQSKqabHML1E2epb/M4D0qgyDMqM90YHxYL4MkqdcQ0R4Xi4rEwI3nVXOie6EbsgzK7Mz1bzx7lbiZj2Sn7C1lqmRIW59IhMCo41iSh6uMNY= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1566408648459381.4781566106283; Wed, 21 Aug 2019 10:30:48 -0700 (PDT) Received: from localhost ([::1]:51086 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i0URX-0000Lm-9u for importer@patchew.org; Wed, 21 Aug 2019 13:30:43 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40253) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i0UPR-0006Tk-9M for qemu-devel@nongnu.org; Wed, 21 Aug 2019 13:28:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i0UPQ-00057R-8E for qemu-devel@nongnu.org; Wed, 21 Aug 2019 13:28:33 -0400 Received: from mx1.redhat.com ([209.132.183.28]:51882) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1i0UPQ-00056q-36 for qemu-devel@nongnu.org; Wed, 21 Aug 2019 13:28:32 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 77E5B315C005 for ; Wed, 21 Aug 2019 17:28:31 +0000 (UTC) Received: from 640k.localdomain.com (ovpn-112-20.ams2.redhat.com [10.36.112.20]) by smtp.corp.redhat.com (Postfix) with ESMTP id DE24860F88; Wed, 21 Aug 2019 17:28:27 +0000 (UTC) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 21 Aug 2019 19:28:11 +0200 Message-Id: <1566408501-48680-4-git-send-email-pbonzini@redhat.com> In-Reply-To: <1566408501-48680-1-git-send-email-pbonzini@redhat.com> References: <1566408501-48680-1-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.41]); Wed, 21 Aug 2019 17:28:31 +0000 (UTC) Content-Transfer-Encoding: quoted-printable 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-devel] [PULL 03/13] module: use g_hash_table_add() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Marc-Andr=C3=A9 Lureau The hashtable is used like a set, use the convenience g_hash_table_add() function. Signed-off-by: Marc-Andr=C3=A9 Lureau Signed-off-by: Paolo Bonzini --- util/module.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/util/module.c b/util/module.c index 142db7e..ca9885c 100644 --- a/util/module.c +++ b/util/module.c @@ -179,11 +179,10 @@ void module_load_one(const char *prefix, const char *= lib_name) =20 module_name =3D g_strdup_printf("%s%s", prefix, lib_name); =20 - if (g_hash_table_lookup(loaded_modules, module_name)) { + if (!g_hash_table_add(loaded_modules, module_name)) { g_free(module_name); return; } - g_hash_table_insert(loaded_modules, module_name, module_name); =20 exec_dir =3D qemu_get_exec_dir(); search_dir =3D getenv("QEMU_MODULE_DIR"); --=20 1.8.3.1 From nobody Thu May 2 14:57:24 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1566408961; cv=none; d=zoho.com; s=zohoarc; b=RaAesDdWWv1jmxXR5DH3B9VC/7mI6thEpDYNjIa27e2R+Y0d9MnQyGHMdPgU+aueWCHjhCpXP2FvpDI+dWlkBziOh+TZzveMnOiWAtkwT2kW1hcBDTJIPvNy/n/z9M9OW1tPHcUHj6Uzz8n+nsieA7Tc2UYDSfcqjZFN3nXxR6Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1566408961; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=JTodTtHHLqn+brQoM9xtoknkJ1VGdhPpgVAK2EbTc6I=; b=SoVttz1ogImznnu2iZkRIeT37Etw9Y2HJIWbby65mTaWnaHqkkxlAP8blPNcK/Gmb/Nz6tsMouBJEa6FV2Do34VHBQ1+Y4RrHVEoiI3tyP1q3K+MBksg+N4TwXTv5+3MeoIxCz9GLhltNr5xVz5AujRQ6hcZ2Ce9OdhZRanv3Rg= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1566408961640263.37469761591524; Wed, 21 Aug 2019 10:36:01 -0700 (PDT) Received: from localhost ([::1]:51144 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i0UWZ-00078b-MH for importer@patchew.org; Wed, 21 Aug 2019 13:35:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40266) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i0UPS-0006X4-Rh for qemu-devel@nongnu.org; Wed, 21 Aug 2019 13:28:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i0UPR-0005AB-PM for qemu-devel@nongnu.org; Wed, 21 Aug 2019 13:28:34 -0400 Received: from mx1.redhat.com ([209.132.183.28]:54737) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1i0UPR-000592-Jw for qemu-devel@nongnu.org; Wed, 21 Aug 2019 13:28:33 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id EED7F191C687 for ; Wed, 21 Aug 2019 17:28:32 +0000 (UTC) Received: from 640k.localdomain.com (ovpn-112-20.ams2.redhat.com [10.36.112.20]) by smtp.corp.redhat.com (Postfix) with ESMTP id E990260F88; Wed, 21 Aug 2019 17:28:31 +0000 (UTC) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 21 Aug 2019 19:28:12 +0200 Message-Id: <1566408501-48680-5-git-send-email-pbonzini@redhat.com> In-Reply-To: <1566408501-48680-1-git-send-email-pbonzini@redhat.com> References: <1566408501-48680-1-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.6.2 (mx1.redhat.com [10.5.110.70]); Wed, 21 Aug 2019 17:28:32 +0000 (UTC) Content-Transfer-Encoding: quoted-printable 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-devel] [PULL 04/13] module: return success on module load X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Marc-Andr=C3=A9 Lureau Let the caller know of load success. Note that this also changes slightly the behaviour of the function to try loading on subsequent calls if the previous ones failed. Signed-off-by: Marc-Andr=C3=A9 Lureau Signed-off-by: Paolo Bonzini --- include/qemu/module.h | 2 +- util/module.c | 14 +++++++++++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/include/qemu/module.h b/include/qemu/module.h index db30653..65ba596 100644 --- a/include/qemu/module.h +++ b/include/qemu/module.h @@ -65,6 +65,6 @@ void register_module_init(void (*fn)(void), module_init_t= ype type); void register_dso_module_init(void (*fn)(void), module_init_type type); =20 void module_call_init(module_init_type type); -void module_load_one(const char *prefix, const char *lib_name); +bool module_load_one(const char *prefix, const char *lib_name); =20 #endif diff --git a/util/module.c b/util/module.c index ca9885c..e9fe3e5 100644 --- a/util/module.c +++ b/util/module.c @@ -156,8 +156,10 @@ out: } #endif =20 -void module_load_one(const char *prefix, const char *lib_name) +bool module_load_one(const char *prefix, const char *lib_name) { + bool success =3D false; + #ifdef CONFIG_MODULES char *fname =3D NULL; char *exec_dir; @@ -170,7 +172,7 @@ void module_load_one(const char *prefix, const char *li= b_name) =20 if (!g_module_supported()) { fprintf(stderr, "Module is not supported by system.\n"); - return; + return false; } =20 if (!loaded_modules) { @@ -181,7 +183,7 @@ void module_load_one(const char *prefix, const char *li= b_name) =20 if (!g_hash_table_add(loaded_modules, module_name)) { g_free(module_name); - return; + return true; } =20 exec_dir =3D qemu_get_exec_dir(); @@ -205,13 +207,19 @@ void module_load_one(const char *prefix, const char *= lib_name) fname =3D NULL; /* Try loading until loaded a module file */ if (!ret) { + success =3D true; break; } } =20 + if (!success) { + g_hash_table_remove(loaded_modules, module_name); + } + for (i =3D 0; i < n_dirs; i++) { g_free(dirs[i]); } =20 #endif + return success; } --=20 1.8.3.1 From nobody Thu May 2 14:57:24 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1566409577; cv=none; d=zoho.com; s=zohoarc; b=Xt7GP7wvrDQY3apX2zjv4Ru0hi+m63auJ6AqJ6Bj3S5EombnG4cfMmTQaaKZ2kTGGDWqxlxat7E8Uei9vVqhvuTmQnNaKJj7xonmaWvAG9uLO5MiQP8she2UfSc2BiT4LivvftIMJPnmR7q3DACK3iL4E134dadnWsOT7nKKKwY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1566409577; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=IMIUD75YLlkj/SZ3oxT+/tNq4Dz9fiDsC1wZuo6yS80=; b=BoY2i8uv7lwCcxTL4+O4aMRG+bt6MYfN5sIopv5CzIEUbkUn9OqOYhFx+Ef7ohuyLGveTLZyC/ECWqojGq9dLaG5eg2Z90KaBUD17npxra3aYRnetYpiCuX8YJk/uOhPoTqJOpWf7/HTFSL25CJjC8ZAQkyxWv/f1izn9ID0f+Y= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1566409577864604.842203172726; Wed, 21 Aug 2019 10:46:17 -0700 (PDT) Received: from localhost ([::1]:51286 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i0UgZ-0004Wk-Qv for importer@patchew.org; Wed, 21 Aug 2019 13:46:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40288) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i0UPW-0006eM-GX for qemu-devel@nongnu.org; Wed, 21 Aug 2019 13:28:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i0UPV-0005E4-5f for qemu-devel@nongnu.org; Wed, 21 Aug 2019 13:28:38 -0400 Received: from mx1.redhat.com ([209.132.183.28]:53118) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1i0UPU-0005Ct-TD for qemu-devel@nongnu.org; Wed, 21 Aug 2019 13:28:37 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 3F6F630833A1 for ; Wed, 21 Aug 2019 17:28:36 +0000 (UTC) Received: from 640k.localdomain.com (ovpn-112-20.ams2.redhat.com [10.36.112.20]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6A0E260F9F; Wed, 21 Aug 2019 17:28:33 +0000 (UTC) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 21 Aug 2019 19:28:13 +0200 Message-Id: <1566408501-48680-6-git-send-email-pbonzini@redhat.com> In-Reply-To: <1566408501-48680-1-git-send-email-pbonzini@redhat.com> References: <1566408501-48680-1-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.44]); Wed, 21 Aug 2019 17:28:36 +0000 (UTC) Content-Transfer-Encoding: quoted-printable 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-devel] [PULL 05/13] tests: add module loading test X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Marc-Andr=C3=A9 Lureau This test will simply check that modules can be loaded, and no symbols are missing. Signed-off-by: Marc-Andr=C3=A9 Lureau Signed-off-by: Paolo Bonzini --- qtest.c | 9 +++++++ tests/Makefile.include | 1 + tests/libqtest.c | 6 +++++ tests/libqtest.h | 2 ++ tests/modules-test.c | 71 ++++++++++++++++++++++++++++++++++++++++++++++= ++++ 5 files changed, 89 insertions(+) create mode 100644 tests/modules-test.c diff --git a/qtest.c b/qtest.c index d8b4857..8b50e27 100644 --- a/qtest.c +++ b/qtest.c @@ -661,6 +661,15 @@ static void qtest_process_command(CharBackend *chr, gc= har **words) qtest_send_prefix(chr); qtest_sendf(chr, "OK %"PRIi64"\n", (int64_t)qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL)); + } else if (strcmp(words[0], "module_load") =3D=3D 0) { + g_assert(words[1] && words[2]); + + qtest_send_prefix(chr); + if (module_load_one(words[1], words[2])) { + qtest_sendf(chr, "OK\n"); + } else { + qtest_sendf(chr, "FAIL\n"); + } } else if (qtest_enabled() && strcmp(words[0], "clock_set") =3D=3D 0) { int64_t ns; int ret; diff --git a/tests/Makefile.include b/tests/Makefile.include index 6f02dfc..39bed75 100644 --- a/tests/Makefile.include +++ b/tests/Makefile.include @@ -149,6 +149,7 @@ check-block-$(call land,$(CONFIG_POSIX),$(CONFIG_SOFTMM= U)) +=3D tests/check-block. =20 check-qtest-generic-y +=3D tests/qmp-test$(EXESUF) check-qtest-generic-y +=3D tests/qmp-cmd-test$(EXESUF) +check-qtest-generic-$(CONFIG_MODULES) +=3D tests/modules-test$(EXESUF) =20 check-qtest-generic-y +=3D tests/device-introspect-test$(EXESUF) check-qtest-generic-y +=3D tests/cdrom-test$(EXESUF) diff --git a/tests/libqtest.c b/tests/libqtest.c index eb971d0..2713b86 100644 --- a/tests/libqtest.c +++ b/tests/libqtest.c @@ -811,6 +811,12 @@ bool qtest_get_irq(QTestState *s, int num) return s->irq_level[num]; } =20 +void qtest_module_load(QTestState *s, const char *prefix, const char *libn= ame) +{ + qtest_sendf(s, "module_load %s %s\n", prefix, libname); + qtest_rsp(s, 0); +} + static int64_t qtest_clock_rsp(QTestState *s) { gchar **words; diff --git a/tests/libqtest.h b/tests/libqtest.h index 7833148..07ea358 100644 --- a/tests/libqtest.h +++ b/tests/libqtest.h @@ -262,6 +262,8 @@ char *qtest_hmp(QTestState *s, const char *fmt, ...) GC= C_FMT_ATTR(2, 3); char *qtest_vhmp(QTestState *s, const char *fmt, va_list ap) GCC_FMT_ATTR(2, 0); =20 +void qtest_module_load(QTestState *s, const char *prefix, const char *libn= ame); + /** * qtest_get_irq: * @s: #QTestState instance to operate on. diff --git a/tests/modules-test.c b/tests/modules-test.c new file mode 100644 index 0000000..3aef0e5 --- /dev/null +++ b/tests/modules-test.c @@ -0,0 +1,71 @@ +#include "qemu/osdep.h" +#include "libqtest.h" + +static void test_modules_load(const void *data) +{ + QTestState *qts; + const char **args =3D data; + + qts =3D qtest_init(NULL); + qtest_module_load(qts, args[0], args[1]); + qtest_quit(qts); +} + +int main(int argc, char *argv[]) +{ + const char *modules[] =3D { +#ifdef CONFIG_CURL + "block-", "curl", +#endif +#ifdef CONFIG_GLUSTERFS + "block-", "gluster", +#endif +#ifdef CONFIG_LIBISCSI + "block-", "iscsi", +#endif +#ifdef CONFIG_LIBNFS + "block-", "nfs", +#endif +#ifdef CONFIG_LIBSSH + "block-", "ssh", +#endif +#ifdef CONFIG_RBD + "block-", "rbd", +#endif +#ifdef CONFIG_AUDIO_ALSA + "audio-", "alsa", +#endif +#ifdef CONFIG_AUDIO_OSS + "audio-", "oss", +#endif +#ifdef CONFIG_AUDIO_PA + "audio-", "pa", +#endif +#ifdef CONFIG_AUDIO_SDL + "audio-", "sdl", +#endif +#ifdef CONFIG_CURSES + "ui-", "curses", +#endif +#if defined(CONFIG_GTK) && defined(CONFIG_VTE) + "ui-", "gtk", +#endif +#ifdef CONFIG_SDL + "ui-", "sdl", +#endif +#if defined(CONFIG_SPICE) && defined(CONFIG_GIO) + "ui-", "spice-app", +#endif + }; + int i; + + g_test_init(&argc, &argv, NULL); + + for (i =3D 0; i < G_N_ELEMENTS(modules); i +=3D 2) { + char *testname =3D g_strdup_printf("/module/load/%s", modules[i + = 1]); + qtest_add_data_func(testname, modules + i, test_modules_load); + g_free(testname); + } + + return g_test_run(); +} --=20 1.8.3.1 From nobody Thu May 2 14:57:24 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1566409112; cv=none; d=zoho.com; s=zohoarc; b=OEa35Xlixw3M1F49tH4dbk3LvLRw85p+EQaxkVRUqDtoFmqp42AbaVvoQV7r+nauVA5L33R9azKTcUBZ9UR6H4BsjbeRXOvcr8oIAWftNuRsLaQutUARJM3x3zXGUFf0bYHt4URnXpdfsfNL0/4LeGLWqPdRuFWhcZ0nJoiTEb0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1566409112; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=+mZR08kBzdMeG+cnWnXy0YmOmo48hK4Ro5pYC100UEs=; b=YLmKKntpEOQTEKx7QhGzT0m/0EB9HtvBo8RWzh8cSZ7EDyoLKnipOIuJbANs2+tqmTvo36zaNnrKr5s2cJUbLidrwf21TzWhDOoRsokqaOgwZCVLd6HUwEQ5Y2kpR9x57Z/GEU+a8EQgWIp2jwekJ7BD6/N5J+qeQedWjd3+B6I= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1566409112542656.4160658308651; Wed, 21 Aug 2019 10:38:32 -0700 (PDT) Received: from localhost ([::1]:51194 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i0UZ5-0002kJ-2J for importer@patchew.org; Wed, 21 Aug 2019 13:38:31 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40307) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i0UPX-0006gi-Ki for qemu-devel@nongnu.org; Wed, 21 Aug 2019 13:28:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i0UPW-0005Gy-I5 for qemu-devel@nongnu.org; Wed, 21 Aug 2019 13:28:39 -0400 Received: from mx1.redhat.com ([209.132.183.28]:20236) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1i0UPW-0005Fb-Cd for qemu-devel@nongnu.org; Wed, 21 Aug 2019 13:28:38 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B500D8980E1 for ; Wed, 21 Aug 2019 17:28:37 +0000 (UTC) Received: from 640k.localdomain.com (ovpn-112-20.ams2.redhat.com [10.36.112.20]) by smtp.corp.redhat.com (Postfix) with ESMTP id B0E3660E1C; Wed, 21 Aug 2019 17:28:36 +0000 (UTC) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 21 Aug 2019 19:28:14 +0200 Message-Id: <1566408501-48680-7-git-send-email-pbonzini@redhat.com> In-Reply-To: <1566408501-48680-1-git-send-email-pbonzini@redhat.com> References: <1566408501-48680-1-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.6.2 (mx1.redhat.com [10.5.110.67]); Wed, 21 Aug 2019 17:28:37 +0000 (UTC) Content-Transfer-Encoding: quoted-printable 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-devel] [PULL 06/13] configure: remove AUTOCONF_HOST X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Marc-Andr=C3=A9 Lureau This is a left-over from commit c12b6d70e384c769ca372e15ffd19b3e9f563662 ("pixman: drop submodule") Signed-off-by: Marc-Andr=C3=A9 Lureau Signed-off-by: Paolo Bonzini --- configure | 5 ----- 1 file changed, 5 deletions(-) diff --git a/configure b/configure index b7f4283..d7d6dfc 100755 --- a/configure +++ b/configure @@ -7366,11 +7366,6 @@ if test "$sparse" =3D "yes" ; then echo "HOST_CC :=3D REAL_CC=3D\"\$(HOST_CC)\" cgcc" >> $config_host= _mak echo "QEMU_CFLAGS +=3D -Wbitwise -Wno-transparent-union -Wno-old-initia= lizer -Wno-non-pointer-null" >> $config_host_mak fi -if test "$cross_prefix" !=3D ""; then - echo "AUTOCONF_HOST :=3D --host=3D${cross_prefix%-}" >> $config_host= _mak -else - echo "AUTOCONF_HOST :=3D " >> $config_host_m= ak -fi echo "LDFLAGS=3D$LDFLAGS" >> $config_host_mak echo "LDFLAGS_NOPIE=3D$LDFLAGS_NOPIE" >> $config_host_mak echo "QEMU_LDFLAGS=3D$QEMU_LDFLAGS" >> $config_host_mak --=20 1.8.3.1 From nobody Thu May 2 14:57:24 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1566408959; cv=none; d=zoho.com; s=zohoarc; b=QEeS5Q+cXsQZnPe26x3vwZptflP5EV6uPi38p0XYpkiRTEfQDIoQpMaonFvSltpuGhNqjOQMlPByP5PgJ0/S5myaXUVxGp4J3QFPpORUpi50vGBr7sn1i7n34S7FiMWr/gUGw8IiXtViffL08ImrXcKZs10lnjDZaPq/VtZb0cU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1566408959; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=8rotu9tS9bWAdhBJ3G/3KGLOx9SRCWP0lrZ0doFYjAE=; b=ebtsrhpwQsG/42OfFgTeRG6IkSaS2UiaaqqX1T660L/Xu7oA7n+mRBGE9aMxEQbfHQnVzkLGmnOx/sPfa2WQhFMycyv3sZb7Bn7rpX5FJT+1cNkhtA2m1Xx6i3EZv+d0iATKW+FqntmP9doMDxAuOXnW2OLrXfbuVta/FXgjt0c= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1566408959879618.9523106341039; Wed, 21 Aug 2019 10:35:59 -0700 (PDT) Received: from localhost ([::1]:51140 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i0UWX-00073S-V8 for importer@patchew.org; Wed, 21 Aug 2019 13:35:53 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40326) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i0UPZ-0006jY-0h for qemu-devel@nongnu.org; Wed, 21 Aug 2019 13:28:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i0UPY-0005Ji-1V for qemu-devel@nongnu.org; Wed, 21 Aug 2019 13:28:40 -0400 Received: from mx1.redhat.com ([209.132.183.28]:38440) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1i0UPX-0005IZ-Re for qemu-devel@nongnu.org; Wed, 21 Aug 2019 13:28:39 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 36F6C3082E55 for ; Wed, 21 Aug 2019 17:28:39 +0000 (UTC) Received: from 640k.localdomain.com (ovpn-112-20.ams2.redhat.com [10.36.112.20]) by smtp.corp.redhat.com (Postfix) with ESMTP id 30F7360F9F; Wed, 21 Aug 2019 17:28:37 +0000 (UTC) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 21 Aug 2019 19:28:15 +0200 Message-Id: <1566408501-48680-8-git-send-email-pbonzini@redhat.com> In-Reply-To: <1566408501-48680-1-git-send-email-pbonzini@redhat.com> References: <1566408501-48680-1-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.46]); Wed, 21 Aug 2019 17:28:39 +0000 (UTC) Content-Transfer-Encoding: quoted-printable 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-devel] [PULL 07/13] minikconf: don't print CONFIG_FOO=n lines X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Marc-Andr=C3=A9 Lureau qemu in general doesn't define CONFIG_FOO if it's false. This also helps with the dumb kconfig parser from meson, as source_set considers any non-empty value as true. Signed-off-by: Marc-Andr=C3=A9 Lureau Signed-off-by: Paolo Bonzini --- scripts/minikconf.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/minikconf.py b/scripts/minikconf.py index 3109a81..40ae198 100644 --- a/scripts/minikconf.py +++ b/scripts/minikconf.py @@ -702,8 +702,8 @@ if __name__ =3D=3D '__main__': =20 config =3D data.compute_config() for key in sorted(config.keys()): - if key not in external_vars: - print ('CONFIG_%s=3D%s' % (key, ('y' if config[key] else 'n'))) + if key not in external_vars and config[key]: + print ('CONFIG_%s=3Dy' % key) =20 deps =3D open(argv[2], 'w') for fname in data.previously_included: --=20 1.8.3.1 From nobody Thu May 2 14:57:24 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1566408883; cv=none; d=zoho.com; s=zohoarc; b=Ad5iX2IJ4sqLz1PY/GgCubCoEqmsW8iyPvBcSWarM6Hbwmz91K+zoQDbi9KlYw8qhtVyzdesAEgCnaZALhpGoNCH2Wm3Zdis6wcQ6Sfjk1gaKuc/sjvIQwYF1NNt25ffGkLgcoNEIkS5ouCI8stMJ+Qjs5gw/6mf8KBKgMT8H44= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1566408883; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=QKSD8G+RcfaklpbXJ9wQCtoQ7LtIOmI+VzWuRVDWnd0=; b=Cq50B0HZc7ZuYi5IQrdasvyAB8kgKQwdjbg3FLtQmiJDjYgCG4+O5bFf+uVpFVB0lOZyaKSTcqFwj1yoLHyXYpg2KdlqolMsRE01ptJqwHH2DgAwBgP+F6KdhCJMT6XUg8le/hAoqWVo9KPEAnww86YdFxfWsp2dQF/9Im2r864= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1566408883959186.32033934294395; Wed, 21 Aug 2019 10:34:43 -0700 (PDT) Received: from localhost ([::1]:51128 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i0UVO-0005fx-Nv for importer@patchew.org; Wed, 21 Aug 2019 13:34:42 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40338) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i0UPc-0006rL-SQ for qemu-devel@nongnu.org; Wed, 21 Aug 2019 13:28:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i0UPb-0005Pn-Th for qemu-devel@nongnu.org; Wed, 21 Aug 2019 13:28:44 -0400 Received: from mx1.redhat.com ([209.132.183.28]:56320) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1i0UPb-0005P0-OK for qemu-devel@nongnu.org; Wed, 21 Aug 2019 13:28:43 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 1C385308FC20 for ; Wed, 21 Aug 2019 17:28:43 +0000 (UTC) Received: from 640k.localdomain.com (ovpn-112-20.ams2.redhat.com [10.36.112.20]) by smtp.corp.redhat.com (Postfix) with ESMTP id A4F2760E1C; Wed, 21 Aug 2019 17:28:39 +0000 (UTC) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 21 Aug 2019 19:28:16 +0200 Message-Id: <1566408501-48680-9-git-send-email-pbonzini@redhat.com> In-Reply-To: <1566408501-48680-1-git-send-email-pbonzini@redhat.com> References: <1566408501-48680-1-git-send-email-pbonzini@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.43]); Wed, 21 Aug 2019 17:28: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: [Qemu-devel] [PULL 08/13] memory: Refactor memory_region_clear_coalescing X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Xu Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Peter Xu Removing the update variable and quit earlier if the memory region has no coalesced range. This prepares for the next patch. Fixes: 3ac7d43a6fbb5d4a3 Signed-off-by: Peter Xu Message-Id: <20190820141328.10009-4-peterx@redhat.com> Signed-off-by: Paolo Bonzini --- memory.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/memory.c b/memory.c index 4aa38eb..9a1193a 100644 --- a/memory.c +++ b/memory.c @@ -2281,7 +2281,10 @@ void memory_region_add_coalescing(MemoryRegion *mr, void memory_region_clear_coalescing(MemoryRegion *mr) { CoalescedMemoryRange *cmr; - bool updated =3D false; + + if (QTAILQ_EMPTY(&mr->coalesced)) { + return; + } =20 qemu_flush_coalesced_mmio_buffer(); mr->flush_coalesced_mmio =3D false; @@ -2290,12 +2293,9 @@ void memory_region_clear_coalescing(MemoryRegion *mr) cmr =3D QTAILQ_FIRST(&mr->coalesced); QTAILQ_REMOVE(&mr->coalesced, cmr, link); g_free(cmr); - updated =3D true; } =20 - if (updated) { - memory_region_update_coalesced_range(mr); - } + memory_region_update_coalesced_range(mr); } =20 void memory_region_set_flush_coalesced(MemoryRegion *mr) --=20 1.8.3.1 From nobody Thu May 2 14:57:24 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1566409040; cv=none; d=zoho.com; s=zohoarc; b=dYJFCFfIpBPNmM9f51yL8SVn3dloPA2nEDo5UCB6H8veWcnmpoVFTZal0WGx1iQGGtCt6GuDfkNyIj+Q21X1kY9PFJQlIEUpTVK6XZOTpVwNI1hkakaENQR3UJtKfRsT6bCVC98gsIVcj+55WgbwhBU/OQodYepJN6nJ9M2lhPU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1566409040; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=q0WIpxt/Gb95FjDlw8upNG/PDQFdd4b7BdvQBJiEi0M=; b=buy24PGbSuSVj/Eb0dlNHpVDORTLj3jLCmeb5pI2gSaVb1O35RlmIyQjXUXsBUVw3iGXyAjd8I05iMecoB3qSA405/L1kxgs1/JznpnHAn7nzTMW4ypVlDWAgfGfVnNYg9wg1/GZnEFrXSiVrD4TVRGMYV2qu8/LUMGHlCAqrIE= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1566409040898762.3703908670389; Wed, 21 Aug 2019 10:37:20 -0700 (PDT) Received: from localhost ([::1]:51181 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i0UXv-0001B3-Bh for importer@patchew.org; Wed, 21 Aug 2019 13:37:19 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40355) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i0UPe-0006vL-OP for qemu-devel@nongnu.org; Wed, 21 Aug 2019 13:28:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i0UPd-0005Rd-Fu for qemu-devel@nongnu.org; Wed, 21 Aug 2019 13:28:46 -0400 Received: from mx1.redhat.com ([209.132.183.28]:33624) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1i0UPd-0005QU-78 for qemu-devel@nongnu.org; Wed, 21 Aug 2019 13:28:45 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 917211089041 for ; Wed, 21 Aug 2019 17:28:44 +0000 (UTC) Received: from 640k.localdomain.com (ovpn-112-20.ams2.redhat.com [10.36.112.20]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8E1EF60E1C; Wed, 21 Aug 2019 17:28:43 +0000 (UTC) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 21 Aug 2019 19:28:17 +0200 Message-Id: <1566408501-48680-10-git-send-email-pbonzini@redhat.com> In-Reply-To: <1566408501-48680-1-git-send-email-pbonzini@redhat.com> References: <1566408501-48680-1-git-send-email-pbonzini@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.6.2 (mx1.redhat.com [10.5.110.64]); Wed, 21 Aug 2019 17:28: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-devel] [PULL 09/13] memory: Split zones when do coalesced_io_del() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Xu Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Peter Xu It is a workaround of current KVM's KVM_UNREGISTER_COALESCED_MMIO interface. The kernel interface only allows to unregister an mmio device with exactly the zone size when registered, or any smaller zone that is included in the device mmio zone. It does not support the userspace to specify a very large zone to remove all the small mmio devices within the zone covered. Logically speaking it would be nicer to fix this from KVM side, though in all cases we still need to coop with old kernels so let's do this. Fixes: 3ac7d43a6fbb5d4a3 Signed-off-by: Peter Xu Message-Id: <20190820141328.10009-2-peterx@redhat.com> Signed-off-by: Paolo Bonzini --- memory.c | 49 +++++++++++++++++++++++++++++++++++-------------- 1 file changed, 35 insertions(+), 14 deletions(-) diff --git a/memory.c b/memory.c index 9a1193a..7124274 100644 --- a/memory.c +++ b/memory.c @@ -855,8 +855,39 @@ static void address_space_update_ioeventfds(AddressSpa= ce *as) flatview_unref(view); } =20 +/* + * Notify the memory listeners about the coalesced IO change events of + * range `cmr'. Only the part that has intersection of the specified + * FlatRange will be sent. + */ +static void flat_range_coalesced_io_notify(FlatRange *fr, AddressSpace *as, + CoalescedMemoryRange *cmr, bool= add) +{ + AddrRange tmp; + + tmp =3D addrrange_shift(cmr->addr, + int128_sub(fr->addr.start, + int128_make64(fr->offset_in_region))); + if (!addrrange_intersects(tmp, fr->addr)) { + return; + } + tmp =3D addrrange_intersection(tmp, fr->addr); + + if (add) { + MEMORY_LISTENER_UPDATE_REGION(fr, as, Forward, coalesced_io_add, + int128_get64(tmp.start), + int128_get64(tmp.size)); + } else { + MEMORY_LISTENER_UPDATE_REGION(fr, as, Reverse, coalesced_io_del, + int128_get64(tmp.start), + int128_get64(tmp.size)); + } +} + static void flat_range_coalesced_io_del(FlatRange *fr, AddressSpace *as) { + CoalescedMemoryRange *cmr; + if (!fr->has_coalesced_range) { return; } @@ -865,16 +896,15 @@ static void flat_range_coalesced_io_del(FlatRange *fr= , AddressSpace *as) return; } =20 - MEMORY_LISTENER_UPDATE_REGION(fr, as, Reverse, coalesced_io_del, - int128_get64(fr->addr.start), - int128_get64(fr->addr.size)); + QTAILQ_FOREACH(cmr, &fr->mr->coalesced, link) { + flat_range_coalesced_io_notify(fr, as, cmr, false); + } } =20 static void flat_range_coalesced_io_add(FlatRange *fr, AddressSpace *as) { MemoryRegion *mr =3D fr->mr; CoalescedMemoryRange *cmr; - AddrRange tmp; =20 if (QTAILQ_EMPTY(&mr->coalesced)) { return; @@ -885,16 +915,7 @@ static void flat_range_coalesced_io_add(FlatRange *fr,= AddressSpace *as) } =20 QTAILQ_FOREACH(cmr, &mr->coalesced, link) { - tmp =3D addrrange_shift(cmr->addr, - int128_sub(fr->addr.start, - int128_make64(fr->offset_in_regio= n))); - if (!addrrange_intersects(tmp, fr->addr)) { - continue; - } - tmp =3D addrrange_intersection(tmp, fr->addr); - MEMORY_LISTENER_UPDATE_REGION(fr, as, Forward, coalesced_io_add, - int128_get64(tmp.start), - int128_get64(tmp.size)); + flat_range_coalesced_io_notify(fr, as, cmr, true); } } =20 --=20 1.8.3.1 From nobody Thu May 2 14:57:24 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1566409779; cv=none; d=zoho.com; s=zohoarc; b=TBdo2jWaBTnOiYb1ylqo6zShoU1Mj7KrTDK+Q6uHpSlGBssSluDXXQqx/CJKS8/6lo0YTqx64McE83VNo2Xfle0OpqXRdUqRl8xiZPIv3r3cUStyEt2PI29+StQ7LAgRSKWlA08NMODHr7I7It6zoeSuifpIplejLP+uWET94Gc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1566409779; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=iJQKQj5WAS7C3ZlFwy/kbJrSSwLgVOsTFdZl6ts5ZYU=; b=YrlcXAEUX3tLLBZ1sVmTl+3/KwVR2sdQioppgbe1lw29AvYCu1VGxuU0ASINKnI9V+CWSVquZx/yvD/vVWQ4Z6dyn5pPeQOGfbennEz32o3VFM96owwG4fp0uwakwhoD6AJlxZ3f4liDDkNgQWCm94JQrgZQCh6UxyD92N5zY44= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1566409779870522.9971095024803; Wed, 21 Aug 2019 10:49:39 -0700 (PDT) Received: from localhost ([::1]:51324 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i0Ujq-0000g9-EH for importer@patchew.org; Wed, 21 Aug 2019 13:49:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40401) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i0UPi-00071v-6o for qemu-devel@nongnu.org; Wed, 21 Aug 2019 13:28:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i0UPg-0005VR-U2 for qemu-devel@nongnu.org; Wed, 21 Aug 2019 13:28:50 -0400 Received: from mx1.redhat.com ([209.132.183.28]:30267) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1i0UPg-0005Un-OI for qemu-devel@nongnu.org; Wed, 21 Aug 2019 13:28:48 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 072FD180158C for ; Wed, 21 Aug 2019 17:28:48 +0000 (UTC) Received: from 640k.localdomain.com (ovpn-112-20.ams2.redhat.com [10.36.112.20]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0EEB960E1C; Wed, 21 Aug 2019 17:28:44 +0000 (UTC) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 21 Aug 2019 19:28:18 +0200 Message-Id: <1566408501-48680-11-git-send-email-pbonzini@redhat.com> In-Reply-To: <1566408501-48680-1-git-send-email-pbonzini@redhat.com> References: <1566408501-48680-1-git-send-email-pbonzini@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.6.2 (mx1.redhat.com [10.5.110.63]); Wed, 21 Aug 2019 17:28: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-devel] [PULL 10/13] memory: Remove has_coalesced_range counter X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Xu Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Peter Xu The has_coalesced_range could potentially be problematic in that it only works for additions of coalesced mmio ranges but not deletions. The reason is that has_coalesced_range information can be lost when the FlatView updates the topology again when the updated region is not covering the coalesced regions. When that happens, due to flatrange_equal() is not checking against has_coalesced_range, the new FlatRange will be seen as the same one as the old and the new instance (whose has_coalesced_range will be zero) will replace the old instance (whose has_coalesced_range _could_ be non-zero). The counter was originally used to make sure every FlatRange will only notify once for coalesced_io_{add|del} memory listeners, because each FlatRange can be used by multiple address spaces, so logically speaking it could be called multiple times. However we should not limit that, because memory listeners should will only be registered with specific address space rather than multiple address spaces. So let's fix this up by simply removing the whole has_coalesced_range. Fixes: 3ac7d43a6fbb5d4a3 Signed-off-by: Peter Xu Message-Id: <20190820141328.10009-3-peterx@redhat.com> Signed-off-by: Paolo Bonzini --- memory.c | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/memory.c b/memory.c index 7124274..6e4b06e 100644 --- a/memory.c +++ b/memory.c @@ -217,7 +217,6 @@ struct FlatRange { bool romd_mode; bool readonly; bool nonvolatile; - int has_coalesced_range; }; =20 #define FOR_EACH_FLAT_RANGE(var, view) \ @@ -654,7 +653,6 @@ static void render_memory_region(FlatView *view, fr.romd_mode =3D mr->romd_mode; fr.readonly =3D readonly; fr.nonvolatile =3D nonvolatile; - fr.has_coalesced_range =3D 0; =20 /* Render the region itself into any gaps left by the current view. */ for (i =3D 0; i < view->nr && int128_nz(remain); ++i) { @@ -888,14 +886,6 @@ static void flat_range_coalesced_io_del(FlatRange *fr,= AddressSpace *as) { CoalescedMemoryRange *cmr; =20 - if (!fr->has_coalesced_range) { - return; - } - - if (--fr->has_coalesced_range > 0) { - return; - } - QTAILQ_FOREACH(cmr, &fr->mr->coalesced, link) { flat_range_coalesced_io_notify(fr, as, cmr, false); } @@ -910,10 +900,6 @@ static void flat_range_coalesced_io_add(FlatRange *fr,= AddressSpace *as) return; } =20 - if (fr->has_coalesced_range++) { - return; - } - QTAILQ_FOREACH(cmr, &mr->coalesced, link) { flat_range_coalesced_io_notify(fr, as, cmr, true); } --=20 1.8.3.1 From nobody Thu May 2 14:57:24 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1566409933; cv=none; d=zoho.com; s=zohoarc; b=SB/D8/D9hcE8SXvNUIQ6Ezjx0qi3k+VpaQcC+kk7gf6rdzV4zcm/9FwRatyvdJiP3boWPW1w+kNcPh42l8xzH4Gudvjz48TV1FyNP+yh0W1RCPPra/vwOI3H54lBnqIAR9EP/tl5pmj/vyq94SgcGSzKSfzolTjQUVuA7k+keKI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1566409933; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=9Hus6FJW0VW6sn0nmlBO7FFk2x4zd4T0VvmgIxasqd8=; b=NigPsJKPu8vWgMGrEXb/bV132QFrUie08IkIA7UYo/IQjemAnThBTH+bqy+vreeauOFklVpmU7fJddpln+wUJpxSQ3vI7A5aE0y2zikyyO6dB9KFMDW4MS55GPBp6Qt+MA+xemFNeBzRoSk0u2++uwMw4tcUeNgg/+mAYkrgrxI= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1566409933212677.3414706556957; Wed, 21 Aug 2019 10:52:13 -0700 (PDT) Received: from localhost ([::1]:51366 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i0UmJ-0004ZW-Gr for importer@patchew.org; Wed, 21 Aug 2019 13:52:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40424) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i0UPl-000777-0c for qemu-devel@nongnu.org; Wed, 21 Aug 2019 13:28:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i0UPj-0005ZA-PP for qemu-devel@nongnu.org; Wed, 21 Aug 2019 13:28:52 -0400 Received: from mx1.redhat.com ([209.132.183.28]:39024) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1i0UPj-0005Yc-Gl for qemu-devel@nongnu.org; Wed, 21 Aug 2019 13:28:51 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id DC46518C4260 for ; Wed, 21 Aug 2019 17:28:50 +0000 (UTC) Received: from 640k.localdomain.com (ovpn-112-20.ams2.redhat.com [10.36.112.20]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7942760E1C; Wed, 21 Aug 2019 17:28:48 +0000 (UTC) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 21 Aug 2019 19:28:19 +0200 Message-Id: <1566408501-48680-12-git-send-email-pbonzini@redhat.com> In-Reply-To: <1566408501-48680-1-git-send-email-pbonzini@redhat.com> References: <1566408501-48680-1-git-send-email-pbonzini@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.6.2 (mx1.redhat.com [10.5.110.62]); Wed, 21 Aug 2019 17:28:50 +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-devel] [PULL 11/13] memory: Fix up memory_region_{add|del}_coalescing X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Xu Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Peter Xu The old memory_region_{add|clear}_coalescing() has some defects because they both changed mr->coalesced before updating the regions using memory_region_update_coalesced_range_as(). Then when the regions were updated in memory_region_update_coalesced_range_as() the mr->coalesced will always be either one more or one less. So: - For memory_region_add_coalescing: it'll always trying to remove the newly added coalesced region while it shouldn't, and, - For memory_region_clear_coalescing: when it calls the update there will be no coalesced ranges on mr->coalesced because they were all removed before hand so the update will probably do nothing for real. Let's fix this. Now we've got flat_range_coalesced_io_notify() to notify a single CoalescedMemoryRange instance change, so use it in the existing memory_region_update_coalesced_range() logic by only notify either an addition or deletion. Then we hammer both the memory_region_{add|clear}_coalescing() to use it. Fixes: 3ac7d43a6fbb5d4a3 Signed-off-by: Peter Xu Message-Id: <20190820141328.10009-5-peterx@redhat.com> Signed-off-by: Paolo Bonzini --- memory.c | 36 +++++++++++++++++------------------- 1 file changed, 17 insertions(+), 19 deletions(-) diff --git a/memory.c b/memory.c index 6e4b06e..7fd93b1 100644 --- a/memory.c +++ b/memory.c @@ -2243,27 +2243,26 @@ void memory_region_ram_resize(MemoryRegion *mr, ram= _addr_t newsize, Error **errp qemu_ram_resize(mr->ram_block, newsize, errp); } =20 -static void memory_region_update_coalesced_range_as(MemoryRegion *mr, Addr= essSpace *as) +/* + * Call proper memory listeners about the change on the newly + * added/removed CoalescedMemoryRange. + */ +static void memory_region_update_coalesced_range(MemoryRegion *mr, + CoalescedMemoryRange *cmr, + bool add) { + AddressSpace *as; FlatView *view; FlatRange *fr; =20 - view =3D address_space_get_flatview(as); - FOR_EACH_FLAT_RANGE(fr, view) { - if (fr->mr =3D=3D mr) { - flat_range_coalesced_io_del(fr, as); - flat_range_coalesced_io_add(fr, as); - } - } - flatview_unref(view); -} - -static void memory_region_update_coalesced_range(MemoryRegion *mr) -{ - AddressSpace *as; - QTAILQ_FOREACH(as, &address_spaces, address_spaces_link) { - memory_region_update_coalesced_range_as(mr, as); + view =3D address_space_get_flatview(as); + FOR_EACH_FLAT_RANGE(fr, view) { + if (fr->mr =3D=3D mr) { + flat_range_coalesced_io_notify(fr, as, cmr, add); + } + } + flatview_unref(view); } } =20 @@ -2281,7 +2280,7 @@ void memory_region_add_coalescing(MemoryRegion *mr, =20 cmr->addr =3D addrrange_make(int128_make64(offset), int128_make64(size= )); QTAILQ_INSERT_TAIL(&mr->coalesced, cmr, link); - memory_region_update_coalesced_range(mr); + memory_region_update_coalesced_range(mr, cmr, true); memory_region_set_flush_coalesced(mr); } =20 @@ -2299,10 +2298,9 @@ void memory_region_clear_coalescing(MemoryRegion *mr) while (!QTAILQ_EMPTY(&mr->coalesced)) { cmr =3D QTAILQ_FIRST(&mr->coalesced); QTAILQ_REMOVE(&mr->coalesced, cmr, link); + memory_region_update_coalesced_range(mr, cmr, false); g_free(cmr); } - - memory_region_update_coalesced_range(mr); } =20 void memory_region_set_flush_coalesced(MemoryRegion *mr) --=20 1.8.3.1 From nobody Thu May 2 14:57:24 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1566409219; cv=none; d=zoho.com; s=zohoarc; b=Pvbxt+5Dyl4v8hDk9pjXNVqhq9PdMDpYhgFD9vghWDW5IZ3oIhwP5RLXXRuJD6YWaUd+9ymQaZCgb7TQYrqtGz37JCdR/K7QhXFnjrBeouUq77fDGOgTjG9kdppY7CPHvdBkD2lSK18u9JgAphq2Yc9FeO+wr+AFClmjb4pBFfE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1566409219; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=JcD3lazeulI4AUrzEzOnQ7CX8+nascq9J2QTgVhp1uw=; b=GYiuXHfdG5wxkr/373FHItINbD6YWI3s+8dIlRC59OgvCiU/qMxRAGax+iLoRQ03P6a14xkAMRrdVm10f0iK6FqOEQgDhXqK9DBnSPyOLyG+SBawHbeJ0PB0qB41d+J6WOnAkdMzpofVJAocuhBLVA7WK5jkKWV6n0W5SWufRwk= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1566409219060873.4367869771821; Wed, 21 Aug 2019 10:40:19 -0700 (PDT) Received: from localhost ([::1]:51238 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i0Uan-0004sQ-FU for importer@patchew.org; Wed, 21 Aug 2019 13:40:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40437) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i0UPm-0007Ad-Jh for qemu-devel@nongnu.org; Wed, 21 Aug 2019 13:28:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i0UPl-0005aL-6j for qemu-devel@nongnu.org; Wed, 21 Aug 2019 13:28:54 -0400 Received: from mx1.redhat.com ([209.132.183.28]:49244) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1i0UPl-0005Zj-1M for qemu-devel@nongnu.org; Wed, 21 Aug 2019 13:28:53 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 5C083308219F; Wed, 21 Aug 2019 17:28:52 +0000 (UTC) Received: from 640k.localdomain.com (ovpn-112-20.ams2.redhat.com [10.36.112.20]) by smtp.corp.redhat.com (Postfix) with ESMTP id 57C2460F88; Wed, 21 Aug 2019 17:28:51 +0000 (UTC) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 21 Aug 2019 19:28:20 +0200 Message-Id: <1566408501-48680-13-git-send-email-pbonzini@redhat.com> In-Reply-To: <1566408501-48680-1-git-send-email-pbonzini@redhat.com> References: <1566408501-48680-1-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.47]); Wed, 21 Aug 2019 17:28:52 +0000 (UTC) Content-Transfer-Encoding: quoted-printable 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-devel] [PULL 12/13] main-loop: Fix GSource leak in qio_task_thread_worker() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Alberto Garcia Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Alberto Garcia After g_source_attach() the GMainContext holds a reference to the GSource, so the caller does not need to keep it. qio_task_thread_worker() is not releasing its reference so the GSource is being leaked since a17536c594bfed94d05667b419f747b692f5fc7f. Signed-off-by: Alberto Garcia Reviewed-by: Daniel P. Berrang=C3=A9 Message-Id: <1565625509-404969-2-git-send-email-andrey.shinkevich@virtuozzo= .com> Signed-off-by: Paolo Bonzini --- io/task.c | 1 + 1 file changed, 1 insertion(+) diff --git a/io/task.c b/io/task.c index 64c4c71..1ae7b86 100644 --- a/io/task.c +++ b/io/task.c @@ -136,6 +136,7 @@ static gpointer qio_task_thread_worker(gpointer opaque) qio_task_thread_result, task, NULL); g_source_attach(task->thread->completion, task->thread->context); + g_source_unref(task->thread->completion); trace_qio_task_thread_source_attach(task, task->thread->completion); =20 qemu_cond_signal(&task->thread_cond); --=20 1.8.3.1 From nobody Thu May 2 14:57:24 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1566409109; cv=none; d=zoho.com; s=zohoarc; b=GZbY2K058pRc9Tsu+Nkn/8ciseK/j1Asiw+1OyRJH4xS3XQY2nAL6gjkhZS2DpEO3kkBFalG9Kw5mkgy4ohe0bX8ilB1DdG2iwoQwBFk5FxWo/8Fl3qFzEaYBc8hFA368D7l8mpezDKabKSf8Nr8ecNZdq142xTVKo/OPxIAUsg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1566409109; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=Of0lmw/xYEFMyObyQUHOy2BHTAMgM6Twz2t+HDawnOU=; b=AH9KVxycKn9ViXLhEpRL2mfMywr5ukTlHjaTfcKeO8kQbWgGRUp9cFrZ45sJw+pivYJrKLRzC7AF/M4WHvOF65eTY7QkWsqtHzdWZXZB22VbAEo0njCzBW/HA9agTjVCS6VjoaS/82dwI2jD9bI2HLp0a8dCyc4A+VuQRzF0mTc= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1566409109017423.62202266819656; Wed, 21 Aug 2019 10:38:29 -0700 (PDT) Received: from localhost ([::1]:51192 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i0UZ1-0002fJ-Bj for importer@patchew.org; Wed, 21 Aug 2019 13:38:27 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40455) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i0UPp-0007HX-Uq for qemu-devel@nongnu.org; Wed, 21 Aug 2019 13:28:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i0UPn-0005c5-E7 for qemu-devel@nongnu.org; Wed, 21 Aug 2019 13:28:57 -0400 Received: from mx1.redhat.com ([209.132.183.28]:57480) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1i0UPn-0005bQ-1t for qemu-devel@nongnu.org; Wed, 21 Aug 2019 13:28:55 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 33FB4A2F6B6; Wed, 21 Aug 2019 17:28:54 +0000 (UTC) Received: from 640k.localdomain.com (ovpn-112-20.ams2.redhat.com [10.36.112.20]) by smtp.corp.redhat.com (Postfix) with ESMTP id CC03860E1C; Wed, 21 Aug 2019 17:28:52 +0000 (UTC) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 21 Aug 2019 19:28:21 +0200 Message-Id: <1566408501-48680-14-git-send-email-pbonzini@redhat.com> In-Reply-To: <1566408501-48680-1-git-send-email-pbonzini@redhat.com> References: <1566408501-48680-1-git-send-email-pbonzini@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.6.2 (mx1.redhat.com [10.5.110.68]); Wed, 21 Aug 2019 17:28: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: [Qemu-devel] [PULL 13/13] char-socket: Lock tcp_chr_disconnect() and socket_reconnect_timeout() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Andrey Shinkevich , Alberto Garcia Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Alberto Garcia There's a race condition in which the tcp_chr_read() ioc handler can close a connection that is being written to from another thread. Running iotest 136 in a loop triggers this problem and crashes QEMU. (gdb) bt #0 0x00005558b842902d in object_get_class (obj=3D0x0) at qom/object.c:860 #1 0x00005558b84f92db in qio_channel_writev_full (ioc=3D0x0, iov=3D0x7ffc= 355decf0, niov=3D1, fds=3D0x0, nfds=3D0, errp=3D0x0) at io/channel.c:76 #2 0x00005558b84e0e9e in io_channel_send_full (ioc=3D0x0, buf=3D0x5558baf= 5beb0, len=3D138, fds=3D0x0, nfds=3D0) at chardev/char-io.c:123 #3 0x00005558b84e4a69 in tcp_chr_write (chr=3D0x5558ba460380, buf=3D0x555= 8baf5beb0 "...", len=3D138) at chardev/char-socket.c:135 #4 0x00005558b84dca55 in qemu_chr_write_buffer (s=3D0x5558ba460380, buf= =3D0x5558baf5beb0 "...", len=3D138, offset=3D0x7ffc355dedd0, write_all=3Dfa= lse) at chardev/char.c:112 #5 0x00005558b84dcbc2 in qemu_chr_write (s=3D0x5558ba460380, buf=3D0x5558= baf5beb0 "...", len=3D138, write_all=3Dfalse) at chardev/char.c:147 #6 0x00005558b84dfb26 in qemu_chr_fe_write (be=3D0x5558ba476610, buf=3D0x= 5558baf5beb0 "...", len=3D138) at chardev/char-fe.c:42 #7 0x00005558b8088c86 in monitor_flush_locked (mon=3D0x5558ba476610) at m= onitor.c:406 #8 0x00005558b8088e8c in monitor_puts (mon=3D0x5558ba476610, str=3D0x5558= ba921e49 "") at monitor.c:449 #9 0x00005558b8089178 in qmp_send_response (mon=3D0x5558ba476610, rsp=3D0= x5558bb161600) at monitor.c:498 #10 0x00005558b808920c in monitor_qapi_event_emit (event=3DQAPI_EVENT_SHUT= DOWN, qdict=3D0x5558bb161600) at monitor.c:526 #11 0x00005558b8089307 in monitor_qapi_event_queue_no_reenter (event=3DQAP= I_EVENT_SHUTDOWN, qdict=3D0x5558bb161600) at monitor.c:551 #12 0x00005558b80896c0 in qapi_event_emit (event=3DQAPI_EVENT_SHUTDOWN, qd= ict=3D0x5558bb161600) at monitor.c:626 #13 0x00005558b855f23b in qapi_event_send_shutdown (guest=3Dfalse, reason= =3DSHUTDOWN_CAUSE_HOST_QMP_QUIT) at qapi/qapi-events-run-state.c:43 #14 0x00005558b81911ef in qemu_system_shutdown (cause=3DSHUTDOWN_CAUSE_HOS= T_QMP_QUIT) at vl.c:1837 #15 0x00005558b8191308 in main_loop_should_exit () at vl.c:1885 #16 0x00005558b819140d in main_loop () at vl.c:1924 #17 0x00005558b8198c84 in main (argc=3D18, argv=3D0x7ffc355df3f8, envp=3D0= x7ffc355df490) at vl.c:4665 This patch adds a lock to protect tcp_chr_disconnect() and socket_reconnect_timeout() Signed-off-by: Alberto Garcia Signed-off-by: Andrey Shinkevich Message-Id: <1565625509-404969-3-git-send-email-andrey.shinkevich@virtuozzo= .com> Signed-off-by: Paolo Bonzini --- chardev/char-socket.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/chardev/char-socket.c b/chardev/char-socket.c index 7ca5d97..03f0340 100644 --- a/chardev/char-socket.c +++ b/chardev/char-socket.c @@ -150,7 +150,7 @@ static void tcp_chr_accept(QIONetListener *listener, void *opaque); =20 static int tcp_chr_read_poll(void *opaque); -static void tcp_chr_disconnect(Chardev *chr); +static void tcp_chr_disconnect_locked(Chardev *chr); =20 /* Called with chr_write_lock held. */ static int tcp_chr_write(Chardev *chr, const uint8_t *buf, int len) @@ -174,7 +174,7 @@ static int tcp_chr_write(Chardev *chr, const uint8_t *b= uf, int len) =20 if (ret < 0 && errno !=3D EAGAIN) { if (tcp_chr_read_poll(chr) <=3D 0) { - tcp_chr_disconnect(chr); + tcp_chr_disconnect_locked(chr); return len; } /* else let the read handler finish it properly */ } @@ -469,8 +469,9 @@ static void update_disconnected_filename(SocketChardev = *s) /* NB may be called even if tcp_chr_connect has not been * reached, due to TLS or telnet initialization failure, * so can *not* assume s->state =3D=3D TCP_CHARDEV_STATE_CONNECTED + * This must be called with chr->chr_write_lock held. */ -static void tcp_chr_disconnect(Chardev *chr) +static void tcp_chr_disconnect_locked(Chardev *chr) { SocketChardev *s =3D SOCKET_CHARDEV(chr); bool emit_close =3D s->state =3D=3D TCP_CHARDEV_STATE_CONNECTED; @@ -490,6 +491,13 @@ static void tcp_chr_disconnect(Chardev *chr) } } =20 +static void tcp_chr_disconnect(Chardev *chr) +{ + qemu_mutex_lock(&chr->chr_write_lock); + tcp_chr_disconnect_locked(chr); + qemu_mutex_unlock(&chr->chr_write_lock); +} + static gboolean tcp_chr_read(QIOChannel *chan, GIOCondition cond, void *op= aque) { Chardev *chr =3D CHARDEV(opaque); @@ -1131,8 +1139,10 @@ static gboolean socket_reconnect_timeout(gpointer op= aque) Chardev *chr =3D CHARDEV(opaque); SocketChardev *s =3D SOCKET_CHARDEV(opaque); =20 + qemu_mutex_lock(&chr->chr_write_lock); g_source_unref(s->reconnect_timer); s->reconnect_timer =3D NULL; + qemu_mutex_unlock(&chr->chr_write_lock); =20 if (chr->be_open) { return false; --=20 1.8.3.1