From nobody Mon Dec 30 14:50:40 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 172672949388351.818569435471545; Thu, 19 Sep 2024 00:04:53 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id C613D151C; Thu, 19 Sep 2024 03:04:52 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id E2D90178E; Thu, 19 Sep 2024 03:04:22 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 1F33814D3; Thu, 19 Sep 2024 03:04:19 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id A58F414B8 for ; Thu, 19 Sep 2024 03:04:18 -0400 (EDT) Received: from mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-298-lBn9v7EbPdaQ57yaLNJzUg-1; Thu, 19 Sep 2024 03:04:16 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id E88091955E8C for ; Thu, 19 Sep 2024 07:04:15 +0000 (UTC) Received: from maggie.brq.redhat.com (unknown [10.43.3.102]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 3A6DD3000238 for ; Thu, 19 Sep 2024 07:04:14 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.5 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=3.4.4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1726729458; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=t4AIsGHH2X3OXMWHuyZg6oUj+ov4ep4dfyDulHuobNA=; b=MlR4gc2Ev8D8KJMRBdZBxDzVvRbFloUQ3BKo/R9UmunPiuMoILOz4XGzLR+MngEQUqbJQ9 c2iDvzKlKL3pjMoyH7oRU38Kp2aJAbp7tTyAJGTPjzgzU4vpKtR5udpqjupPvYlCveeUs3 jcpQeFjAldJqbEc9/JDldGvT2Aexw+4= X-MC-Unique: lBn9v7EbPdaQ57yaLNJzUg-1 From: Michal Privoznik To: devel@lists.libvirt.org Subject: [PATCH 1/2] qemu.conf.in: Fix dumpCore capitalization Date: Thu, 19 Sep 2024 09:04:10 +0200 Message-ID: <4591b07ee2c76e68f683f2dfab533bc1fbe8c6c6.1726729439.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: SKVRGKGFR5CPD5HQPBSBEMVQFOOGKPSC X-Message-ID-Hash: SKVRGKGFR5CPD5HQPBSBEMVQFOOGKPSC X-MailFrom: mprivozn@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1726729495509116600 Content-Type: text/plain; charset="utf-8"; x-default="true" In qemu.conf.in we give examples of enabling/disabling core dumps in domain XML. But the attribute is spelled wrong. Signed-off-by: Michal Privoznik --- src/qemu/qemu.conf.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/qemu/qemu.conf.in b/src/qemu/qemu.conf.in index 6bc2140dcb..e1f3046177 100644 --- a/src/qemu/qemu.conf.in +++ b/src/qemu/qemu.conf.in @@ -692,7 +692,7 @@ # guest RAM, if the 'dump_guest_core' setting has been enabled, # or if the guest XML contains # -# ...guest ram... +# ...guest ram... # # If guest RAM is to be included, ensure the max_core limit # is set to at least the size of the largest expected guest @@ -714,7 +714,7 @@ # be included in QEMU core dumps. # # This setting will be ignored if the guest XML has set the -# dumpcore attribute on the element. +# dumpCore attribute on the element. # #dump_guest_core =3D 1 =20 --=20 2.44.2 From nobody Mon Dec 30 14:50:40 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1726729512954323.69356345813253; Thu, 19 Sep 2024 00:05:12 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id D4CCE154E; Thu, 19 Sep 2024 03:05:11 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 9126D1AA0; Thu, 19 Sep 2024 03:04:30 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id D106B159A; Thu, 19 Sep 2024 03:04:25 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 561BC1526 for ; Thu, 19 Sep 2024 03:04:21 -0400 (EDT) Received: from mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-261--nPnK9DSMfGVYvm8QtgQDg-1; Thu, 19 Sep 2024 03:04:19 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 290811944DEA for ; Thu, 19 Sep 2024 07:04:17 +0000 (UTC) Received: from maggie.brq.redhat.com (unknown [10.43.3.102]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 59ED330001A1 for ; Thu, 19 Sep 2024 07:04:16 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.5 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=3.4.4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1726729461; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=8cHASXP2c8cyTUMbxpva31i203ye/Srq6S+/nAJe0wA=; b=ayy9UzZCYnKrihEcwUBnDpRGG6nFnuGoY+0coDlaRLpumjY/woU+SyjWZ0klTwujfJcHwR BZQ3rZg3gD8rO78tFHgu8VdQI5GP2n0qHqB7TAm0DHwVSNVI8PMPfpNA8RN0E5mikib3Qf MBCmwGkxxRorYYrgDM1Uf00G/otM938= X-MC-Unique: -nPnK9DSMfGVYvm8QtgQDg-1 From: Michal Privoznik To: devel@lists.libvirt.org Subject: [PATCH 2/2] qemu: Provide sane default for dump_guest_core Date: Thu, 19 Sep 2024 09:04:11 +0200 Message-ID: <434187bc7751a0d596cd15f871d77f69d15a0a46.1726729439.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: U4PS3XUP7JOMZZTQ7VEDFT35FKEYZZRO X-Message-ID-Hash: U4PS3XUP7JOMZZTQ7VEDFT35FKEYZZRO X-MailFrom: mprivozn@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1726729513621116600 Content-Type: text/plain; charset="utf-8"; x-default="true" QEMU uses Linux extensions to madvise() to include/exclue guest memory from core dump. These are obviously not available everywhere. Currently, users have two options: 1) configure in domain XML, or 2) configure dump_guest_core in qemu.conf While these work, they may harm user experience as "things just don't work" out of the box. Provide sane default in virQEMUDriverConfigNew() so neither of two options is required. To have predictable results in tests, explicitly set cfg->dumpGuestCore to false in qemuTestDriverInit() (which creates cfg object for tests). Resolves: https://gitlab.com/libvirt/libvirt/-/issues/679 Signed-off-by: Michal Privoznik --- meson.build | 1 + src/qemu/qemu_conf.c | 11 +++++++++++ tests/testutilsqemu.c | 2 ++ 3 files changed, 14 insertions(+) diff --git a/meson.build b/meson.build index 4c6e5a088e..aa6b8ce5aa 100644 --- a/meson.build +++ b/meson.build @@ -676,6 +676,7 @@ headers =3D [ 'sched.h', 'sys/auxv.h', 'sys/ioctl.h', + 'sys/mman.h', 'sys/mount.h', 'sys/syscall.h', 'sys/ucred.h', diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c index b36bede6c3..2c4e6a74cb 100644 --- a/src/qemu/qemu_conf.c +++ b/src/qemu/qemu_conf.c @@ -26,6 +26,10 @@ #include #include =20 +#ifdef WITH_SYS_MMAN_H +# include +#endif + #include "virerror.h" #include "qemu_conf.h" #include "qemu_capabilities.h" @@ -287,6 +291,13 @@ virQEMUDriverConfig *virQEMUDriverConfigNew(bool privi= leged, cfg->deprecationBehavior =3D g_strdup("none"); cfg->storageUseNbdkit =3D USE_NBDKIT_DEFAULT; =20 +#ifndef MADV_DONTDUMP + /* QEMU uses Linux extensions to madvise() (MADV_DODUMP/MADV_DONTDUMP)= to + * include/exclude guest memory from core dump. These might be unavail= able + * on some systems. Provide sane default. */ + cfg->dumpGuestCore =3D true; +#endif + return g_steal_pointer(&cfg); } =20 diff --git a/tests/testutilsqemu.c b/tests/testutilsqemu.c index ee6cae218a..4daee432e5 100644 --- a/tests/testutilsqemu.c +++ b/tests/testutilsqemu.c @@ -407,6 +407,8 @@ int qemuTestDriverInit(virQEMUDriver *driver) cfg->hugetlbfs[0].deflt =3D true; cfg->hugetlbfs[1].size =3D 1048576; =20 + cfg->dumpGuestCore =3D false; + driver->privileged =3D true; =20 return 0; --=20 2.44.2