From nobody Mon May 13 04:49:26 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=reject dis=none) header.from=linux.ibm.com ARC-Seal: i=1; a=rsa-sha256; t=1710203080; cv=none; d=zohomail.com; s=zohoarc; b=mXxZxt+khLx2xv3HUtv4zoZHCbeHCav3BcDB7T+jA4bLcwFz8qrS3ZlZCEYdEGSUc7RpvyYaDQswFQ8f8yTeG/zCefJ0tFL6QaT8tAqQ27xgHLM6BAnzFq/Bg4WMn9c9u5xE465lkznsOYk40F6wBsBWSiSaKYImPA0nK8gsIdo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1710203080; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=E0VnF5RdCII/XkCClG1U7GdlEOyLZcvZnRXhohhBrG8=; b=Vl8Z0/ak7f1BqWJLGcpbv6rQhBm8khnr39Z52unGtaySV4F5/3OyW8qmMzK2EIxBfJMf+9Uo/Rd7oPg93arQ8RkgwJYYaNeZknxmEWW3TuB0+n9x+M7KbA5oDTgrFMFj7LdKqo5UUt2uIp5gxjNJ0y9sWBaCj2RQApTmk0n86+0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1710203080936584.7091906555105; Mon, 11 Mar 2024 17:24:40 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rjpwM-0001RH-P7; Mon, 11 Mar 2024 20:24:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rjpwJ-0001Qm-AU for qemu-devel@nongnu.org; Mon, 11 Mar 2024 20:24:19 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rjpwF-000389-1h for qemu-devel@nongnu.org; Mon, 11 Mar 2024 20:24:18 -0400 Received: from pps.filterd (m0360072.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 42C0Ac10010519; Tue, 12 Mar 2024 00:24:11 GMT Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3wtc55r65q-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 12 Mar 2024 00:24:10 +0000 Received: from m0360072.ppops.net (m0360072.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 42C0OABD002859; Tue, 12 Mar 2024 00:24:10 GMT Received: from ppma12.dal12v.mail.ibm.com (dc.9e.1632.ip4.static.sl-reverse.com [50.22.158.220]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3wtc55r65k-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 12 Mar 2024 00:24:10 +0000 Received: from pps.filterd (ppma12.dal12v.mail.ibm.com [127.0.0.1]) by ppma12.dal12v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 42BLDnU0018143; Tue, 12 Mar 2024 00:24:09 GMT Received: from smtprelay05.fra02v.mail.ibm.com ([9.218.2.225]) by ppma12.dal12v.mail.ibm.com (PPS) with ESMTPS id 3ws23t42mf-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 12 Mar 2024 00:24:09 +0000 Received: from smtpav01.fra02v.mail.ibm.com (smtpav01.fra02v.mail.ibm.com [10.20.54.100]) by smtprelay05.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 42C0O5GT49217792 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 12 Mar 2024 00:24:07 GMT Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 9E4D720040; Tue, 12 Mar 2024 00:24:05 +0000 (GMT) Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 070D32004B; Tue, 12 Mar 2024 00:24:05 +0000 (GMT) Received: from heavy.ibm.com (unknown [9.171.72.107]) by smtpav01.fra02v.mail.ibm.com (Postfix) with ESMTP; Tue, 12 Mar 2024 00:24:04 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : mime-version : content-transfer-encoding; s=pp1; bh=E0VnF5RdCII/XkCClG1U7GdlEOyLZcvZnRXhohhBrG8=; b=eTRWfKFbTY/7wt3xZMUwmZM0UBMXLNKchd6/pUJ8Hc/hg1JzLeAGH+9RMUOMb/+jNMM+ /LvRe44/Fxc8IPveO2eAq4IYmR6ocn1JxYRFcY/cxQsL6ajq8cpRgydnwqW4TukVqcfC jqj06m62q+MCOj7SR3WkcPh99/jxtXehrx/4GmVkRIU0kP3rgoo0iLEYjaI+0L/Ssv24 oJeMXyD6/z/riCNZZE/iLCbhdP474EMj4OfL3KRuAEXphr7sotDoGmGlG8s4cHYHxbRn hQOm1H8R5mpyrUpuiW7tTuRzKd3kskr36q7kATMbZ40aSK+qdPbQO9IMwrdR0ZLxDwQb cg== From: Ilya Leoshkevich To: Warner Losh , Laurent Vivier , Paolo Bonzini Cc: Kyle Evans , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Thomas Huth , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Richard Henderson , qemu-devel@nongnu.org, Ilya Leoshkevich Subject: [PATCH] meson: Make DEBUG_REMAP a meson option Date: Tue, 12 Mar 2024 01:23:30 +0100 Message-ID: <20240312002402.14344-1-iii@linux.ibm.com> X-Mailer: git-send-email 2.44.0 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: 9zNDmOHFh98xb1Gb5EgrEvHJy9HYT_ZP X-Proofpoint-GUID: bsH09rus8mvTU3gi8nMQTjiZXy3KpbMv X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-03-11_12,2024-03-11_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1011 spamscore=0 mlxscore=0 phishscore=0 lowpriorityscore=0 malwarescore=0 mlxlogscore=999 priorityscore=1501 bulkscore=0 impostorscore=0 suspectscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2403120000 Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=148.163.158.5; envelope-from=iii@linux.ibm.com; helo=mx0b-001b2d01.pphosted.com X-Spam_score_int: -19 X-Spam_score: -2.0 X-Spam_bar: -- X-Spam_report: (-2.0 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 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-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @ibm.com) X-ZM-MESSAGEID: 1710203082445100001 Content-Type: text/plain; charset="utf-8" Currently DEBUG_REMAP is a macro that needs to be manually #defined to be activated, which makes it hard to have separate build directories dedicated to testing the code with it. Promote it to a meson option. Signed-off-by: Ilya Leoshkevich --- bsd-user/qemu.h | 6 ++---- linux-user/qemu.h | 4 +--- linux-user/uaccess.c | 4 ++-- meson.build | 4 ++++ meson_options.txt | 2 ++ scripts/meson-buildoptions.sh | 3 +++ 6 files changed, 14 insertions(+), 9 deletions(-) diff --git a/bsd-user/qemu.h b/bsd-user/qemu.h index 1b0a591d2d2..8629f0dcde9 100644 --- a/bsd-user/qemu.h +++ b/bsd-user/qemu.h @@ -22,8 +22,6 @@ #include "exec/cpu_ldst.h" #include "exec/exec-all.h" =20 -#undef DEBUG_REMAP - #include "exec/user/abitypes.h" =20 extern char **environ; @@ -437,7 +435,7 @@ static inline void *lock_user(int type, abi_ulong guest= _addr, long len, if (!access_ok(type, guest_addr, len)) { return NULL; } -#ifdef DEBUG_REMAP +#ifdef CONFIG_DEBUG_REMAP { void *addr; addr =3D g_malloc(len); @@ -461,7 +459,7 @@ static inline void unlock_user(void *host_ptr, abi_ulon= g guest_addr, long len) { =20 -#ifdef DEBUG_REMAP +#ifdef CONFIG_DEBUG_REMAP if (!host_ptr) { return; } diff --git a/linux-user/qemu.h b/linux-user/qemu.h index 32cd43d9eff..4777856b529 100644 --- a/linux-user/qemu.h +++ b/linux-user/qemu.h @@ -4,8 +4,6 @@ #include "cpu.h" #include "exec/cpu_ldst.h" =20 -#undef DEBUG_REMAP - #include "exec/user/abitypes.h" =20 #include "syscall_defs.h" @@ -332,7 +330,7 @@ void *lock_user(int type, abi_ulong guest_addr, ssize_t= len, bool copy); /* Unlock an area of guest memory. The first LEN bytes must be flushed back to guest memory. host_ptr =3D NULL is explicitly allowed and does nothing. */ -#ifndef DEBUG_REMAP +#ifndef CONFIG_DEBUG_REMAP static inline void unlock_user(void *host_ptr, abi_ulong guest_addr, ssize_t len) { diff --git a/linux-user/uaccess.c b/linux-user/uaccess.c index 425cbf677f7..27e841e6510 100644 --- a/linux-user/uaccess.c +++ b/linux-user/uaccess.c @@ -14,7 +14,7 @@ void *lock_user(int type, abi_ulong guest_addr, ssize_t l= en, bool copy) return NULL; } host_addr =3D g2h_untagged(guest_addr); -#ifdef DEBUG_REMAP +#ifdef CONFIG_DEBUG_REMAP if (copy) { host_addr =3D g_memdup(host_addr, len); } else { @@ -24,7 +24,7 @@ void *lock_user(int type, abi_ulong guest_addr, ssize_t l= en, bool copy) return host_addr; } =20 -#ifdef DEBUG_REMAP +#ifdef CONFIG_DEBUG_REMAP void unlock_user(void *host_ptr, abi_ulong guest_addr, ssize_t len) { void *host_ptr_conv; diff --git a/meson.build b/meson.build index f9dbe7634e5..1427e9f8811 100644 --- a/meson.build +++ b/meson.build @@ -2342,6 +2342,7 @@ config_host_data.set('CONFIG_DEBUG_GRAPH_LOCK', get_o= ption('debug_graph_lock')) config_host_data.set('CONFIG_DEBUG_MUTEX', get_option('debug_mutex')) config_host_data.set('CONFIG_DEBUG_STACK_USAGE', get_option('debug_stack_u= sage')) config_host_data.set('CONFIG_DEBUG_TCG', get_option('debug_tcg')) +config_host_data.set('CONFIG_DEBUG_REMAP', get_option('debug_remap')) config_host_data.set('CONFIG_LIVE_BLOCK_MIGRATION', get_option('live_block= _migration').allowed()) config_host_data.set('CONFIG_QOM_CAST_DEBUG', get_option('qom_cast_debug')) config_host_data.set('CONFIG_REPLICATION', get_option('replication').allow= ed()) @@ -4285,6 +4286,9 @@ if config_all_accel.has_key('CONFIG_TCG') endif summary_info +=3D {'TCG plugins': get_option('plugins')} summary_info +=3D {'TCG debug enabled': get_option('debug_tcg')} + if have_linux_user or have_bsd_user + summary_info +=3D {'syscall buffer debugging support': get_option('deb= ug_remap')} + endif endif summary_info +=3D {'target list': ' '.join(target_dirs)} if have_system diff --git a/meson_options.txt b/meson_options.txt index 0a99a059ec8..7cd48a88e6e 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -85,6 +85,8 @@ option('plugins', type: 'boolean', value: false, description: 'TCG plugins via shared library loading') option('debug_tcg', type: 'boolean', value: false, description: 'TCG debugging') +option('debug_remap', type: 'boolean', value: false, + description: 'syscall buffer debugging support') option('tcg_interpreter', type: 'boolean', value: false, description: 'TCG with bytecode interpreter (slow)') option('safe_stack', type: 'boolean', value: false, diff --git a/scripts/meson-buildoptions.sh b/scripts/meson-buildoptions.sh index 680fa3f581d..aff58275daf 100644 --- a/scripts/meson-buildoptions.sh +++ b/scripts/meson-buildoptions.sh @@ -29,6 +29,7 @@ meson_options_help() { printf "%s\n" ' --enable-debug-graph-lock' printf "%s\n" ' graph lock debugging support' printf "%s\n" ' --enable-debug-mutex mutex debugging support' + printf "%s\n" ' --enable-debug-remap syscall buffer debugging suppo= rt' printf "%s\n" ' --enable-debug-stack-usage' printf "%s\n" ' measure coroutine stack usage' printf "%s\n" ' --enable-debug-tcg TCG debugging' @@ -295,6 +296,8 @@ _meson_option_parse() { --disable-debug-graph-lock) printf "%s" -Ddebug_graph_lock=3Dfalse ;; --enable-debug-mutex) printf "%s" -Ddebug_mutex=3Dtrue ;; --disable-debug-mutex) printf "%s" -Ddebug_mutex=3Dfalse ;; + --enable-debug-remap) printf "%s" -Ddebug_remap=3Dtrue ;; + --disable-debug-remap) printf "%s" -Ddebug_remap=3Dfalse ;; --enable-debug-stack-usage) printf "%s" -Ddebug_stack_usage=3Dtrue ;; --disable-debug-stack-usage) printf "%s" -Ddebug_stack_usage=3Dfalse ;; --enable-debug-tcg) printf "%s" -Ddebug_tcg=3Dtrue ;; --=20 2.44.0