From nobody Thu Apr 25 21:54:34 2024 Delivered-To: importer@patchew.org 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; Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1574976520; cv=none; d=zohomail.com; s=zohoarc; b=lbpIQrvi7EOnG2wzAmCkcSQ+IwR9p5miKPuX3MPewstJJart1RL1a8J4QZ/w58yQDJ+t/7tuUxx1cgjTzIClAnoMkTZqkfJnDP3L2iITj4fJd5EYcnNxHw7l9nHz74ItBRAx+GM8acIxGNvA7UOPa1K33vIySkdSHPs1cazImF4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1574976520; 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; bh=cHVkaylNoydLTY4nbj39jRtqYAY0ZylLt+xXhgtOIDo=; b=UioaFHCjY6ky+WbVzEtX7BPUL72z2e+hB0z9DuTFJ0ae4xSTIbhmlFbXA+Ki6olvOW+4C1MT/IFraq3mc3/V21dNXxz3MXWor30krBPb/wJSuoHu5xick1Jti9Lx/EDD0d0Co6oFGcpSfmhRKomcN4GnEQqUEiyyD19w8ynxuTY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; 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=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 157497652022746.53241158948492; Thu, 28 Nov 2019 13:28:40 -0800 (PST) Received: from localhost ([::1]:53370 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iaRL3-0004PE-ER for importer@patchew.org; Thu, 28 Nov 2019 16:28:37 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:49415) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iaPpO-0005h1-8d for qemu-devel@nongnu.org; Thu, 28 Nov 2019 14:51:55 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iaPkT-0006Wc-2V for qemu-devel@nongnu.org; Thu, 28 Nov 2019 14:46:47 -0500 Received: from mail-wm1-x343.google.com ([2a00:1450:4864:20::343]:38497) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iaPjw-0004uS-R1 for qemu-devel@nongnu.org; Thu, 28 Nov 2019 14:46:44 -0500 Received: by mail-wm1-x343.google.com with SMTP id z19so12823187wmk.3 for ; Thu, 28 Nov 2019 11:46:08 -0800 (PST) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id p9sm24335043wrs.55.2019.11.28.11.46.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Nov 2019 11:46:04 -0800 (PST) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 8D84A1FF8C; Thu, 28 Nov 2019 19:46:03 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=cHVkaylNoydLTY4nbj39jRtqYAY0ZylLt+xXhgtOIDo=; b=aq5bJ/2tZo0aALMDdwz2F9WXwqSRrwAxd+JPToJf42+vwWV/v7XiEDIuau/L+SpIIx R8N2zkgVL+IRJtg2xe96v6YPXIVIoenjIJL/MGDKBBr7k0kRRSSm9kk+5O/HnQL9Gsfm ICcnJhEiWbbVCvRnsuxUf+Ga3c/F1NH/EXovxm5YmM5R3Cd+Zvus2+b5dTmmJJpJI5HR EZXKy5v6bZnPQTv6uL1eJ0ZQnWMrk5P/PWa7LVW6Iil+DoSEztDPqjQFmQPJwtAEvrAN Tga8AruCWC0r/RxZ5SHeNHrUFM2c/JPciRNaest/7P4GBnOJ8hTaD+S/+2eAQy3+tBtg B/BQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=cHVkaylNoydLTY4nbj39jRtqYAY0ZylLt+xXhgtOIDo=; b=qgXXkRegy4V+oU/n7sgB0fkft+qgQnJhh1WbWK+1RMYUjWN3fplHl+/Cy/mKsYJwHD w4jqml+Q7oVL/ccnR07WDkZ3PINZsCnwp1CiqYGjVFGYopv4Pax/zD4aYeGFpgHy5luG Wtd4/vLuuZnObdkyErMMPpD+T0IOUxqhYKJf8jMXeJtyfYceO09/ZRercWjJccSnq0NH sQWy2TQqKRwVVNFsrIAnYG+eEVP51rH4XozX0sbbI2d922QX88l3E5fDTF1nkM/eL9bZ FRQooW7u/PT3mpCACg6NiB461fAHqqM+HBylBhT5dooaupIpLo2mqXVkV1rtoFnGuGF8 klvw== X-Gm-Message-State: APjAAAX05fGGi5o1DMM3mVSigSWeK22sXcDF11YX1bBAvFzQfJtuvIgG 1Xb8HYUBvcH+6+BcUXYrHx1n8A== X-Google-Smtp-Source: APXvYqxgva5Fbsr15ZBZx/gLGLlrh0LNutneNJiwPoII/GI6nQzPk5fBOOo5bTq3WBNimIDU1oEBww== X-Received: by 2002:a7b:c055:: with SMTP id u21mr11456859wmc.55.1574970365731; Thu, 28 Nov 2019 11:46:05 -0800 (PST) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Subject: [PATCH v1 1/5] linux-user: convert target_mprotect debug to tracepoint Date: Thu, 28 Nov 2019 19:45:59 +0000 Message-Id: <20191128194603.24818-2-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191128194603.24818-1-alex.bennee@linaro.org> References: <20191128194603.24818-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::343 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: Riku Voipio , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Laurent Vivier Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) It is a pain to re-compile when you need to debug and tracepoints are a fairly low impact way to instrument QEMU. Signed-off-by: Alex Benn=C3=A9e --- linux-user/mmap.c | 17 +++++++++-------- linux-user/trace-events | 3 +++ 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/linux-user/mmap.c b/linux-user/mmap.c index 46a6e3a761a..66868762519 100644 --- a/linux-user/mmap.c +++ b/linux-user/mmap.c @@ -17,7 +17,7 @@ * along with this program; if not, see . */ #include "qemu/osdep.h" - +#include "trace.h" #include "qemu.h" =20 //#define DEBUG_MMAP @@ -66,13 +66,14 @@ int target_mprotect(abi_ulong start, abi_ulong len, int= prot) abi_ulong end, host_start, host_end, addr; int prot1, ret; =20 -#ifdef DEBUG_MMAP - printf("mprotect: start=3D0x" TARGET_ABI_FMT_lx - "len=3D0x" TARGET_ABI_FMT_lx " prot=3D%c%c%c\n", start, len, - prot & PROT_READ ? 'r' : '-', - prot & PROT_WRITE ? 'w' : '-', - prot & PROT_EXEC ? 'x' : '-'); -#endif + if (TRACE_TARGET_MPROTECT_ENABLED) { + char prot_str[4]; + prot_str[0] =3D prot & PROT_READ ? 'r' : '-'; + prot_str[1] =3D prot & PROT_WRITE ? 'w' : '-'; + prot_str[2] =3D prot & PROT_EXEC ? 'x' : '-'; + prot_str[3] =3D 0; + trace_target_mprotect(start, len, prot_str); + } =20 if ((start & ~TARGET_PAGE_MASK) !=3D 0) return -TARGET_EINVAL; diff --git a/linux-user/trace-events b/linux-user/trace-events index 6df234bbb67..41d72e61abb 100644 --- a/linux-user/trace-events +++ b/linux-user/trace-events @@ -11,3 +11,6 @@ user_handle_signal(void *env, int target_sig) "env=3D%p s= ignal %d" user_host_signal(void *env, int host_sig, int target_sig) "env=3D%p signal= %d (target %d(" user_queue_signal(void *env, int target_sig) "env=3D%p signal %d" user_s390x_restore_sigregs(void *env, uint64_t sc_psw_addr, uint64_t env_p= sw_addr) "env=3D%p frame psw.addr 0x%"PRIx64 " current psw.addr 0x%"PRIx64 + +# mmap.c +target_mprotect(uint64_t start, uint64_t len, char *flags) "start=3D0x%"PR= Ix64 " len=3D0x%"PRIx64 " prot=3D%s" --=20 2.20.1 From nobody Thu Apr 25 21:54:34 2024 Delivered-To: importer@patchew.org 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; Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1574978091; cv=none; d=zohomail.com; s=zohoarc; b=LebmcxclV4tgmUqgA32FAjBjwgKa0Lxq6LKg8+4/J0eNUGXODG/WO2B5D3kxSvIPlylPYcl3TDjMwmqiRNqPklaoR6Gtt5eBxni2RFDXt7hFYfcrVIfaiQ5UcPRHJk3DDHjXIhGcyaTWN2wLazq3WhrDpRGgAmrM6s7Do0ktkp0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1574978091; 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; bh=MNn7wi779g5wDhZisTPTovBof5tUb05aT8JmY/Sn4ZM=; b=bKgeJ16BcoT1PmxtVjGirGSbsrv/XHcl1zsj2iG2Na9gW3iidgNEpnWnGKOBpNCgpU0LGKtqh+JuBDpPS1EbszyMZOgGBAJ7Q4b/uxAQhdLrFGPntAaXS5Enw3J4vQUOCZJ0xq8t+cbheSz0PSCIvyNqERwcPzAQJ/IuFjFgO1A= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; 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=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 1574978091083558.4493060881464; Thu, 28 Nov 2019 13:54:51 -0800 (PST) Received: from localhost ([::1]:53510 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iaRkO-00077J-ER for importer@patchew.org; Thu, 28 Nov 2019 16:54:48 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:49585) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iaPpR-0005iK-NP for qemu-devel@nongnu.org; Thu, 28 Nov 2019 14:53:02 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iaPk0-0005Dh-J0 for qemu-devel@nongnu.org; Thu, 28 Nov 2019 14:46:20 -0500 Received: from mail-wm1-x343.google.com ([2a00:1450:4864:20::343]:39814) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iaPjz-00050w-AD for qemu-devel@nongnu.org; Thu, 28 Nov 2019 14:46:15 -0500 Received: by mail-wm1-x343.google.com with SMTP id s14so5983685wmh.4 for ; Thu, 28 Nov 2019 11:46:09 -0800 (PST) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id d20sm25667791wra.4.2019.11.28.11.46.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Nov 2019 11:46:04 -0800 (PST) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id A36471FF8F; Thu, 28 Nov 2019 19:46:03 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=MNn7wi779g5wDhZisTPTovBof5tUb05aT8JmY/Sn4ZM=; b=Xk19NKkJuv3ddzTRqZvOv6E+lh6JikLWMvvdvU2iUdCCS1BT4SPGudnI9KaiktsVE9 NCp8jG7Yo7tdnd5Q9WjhlS4SRw5byo8p/mWuoYeymXyo2uTdwi88hWSx2zj+28uWdXHg Low/RnLOYJ0kWZNbQQQnh9w9v0xaoNtvLLlBcogdVK5dZONbPA02QylYT93pPbw6xJFp xoLLDkxqKT8dGPA89pZsZ/b310zLOVGXlG+zDXhYWPVFsv3UZNx3tzfak4gSqvZNf2ir 5/0zZu4K6jAiWm/mPOgsQLgTeta0eXVrCRQ+6FGym3wbxGtLZk4wc/C5smM6jv98Jjuv XCSQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=MNn7wi779g5wDhZisTPTovBof5tUb05aT8JmY/Sn4ZM=; b=EPYd9im8AC/zOBGSoCw897WdrstZpZsPTXnn7sqw305hTQflS4VM9Qq2/iwxoN7TEk AYXq0NuWs8KNVAnm5G8Ades5Ue1Z1PutuYlAL+mzJWcwsrXyTZg/nR07b5Ch+DGbfsVJ 8J9HAZCZfqZmmehj5QENRW3GB63CGvO7MyVZLudFcdcPjt5fj7btaJYDFnfOLGLN0Rv9 KLsiPdl6yXv/F7HkT6Z9DDKYGHZAU/QA+rZ0gEM3VYRDhF3fnW3c1V3xHpQmUU7/TPtv WNJ4hEmi6JCEFWEsQx/eVVF6K+gqeTCbjGpiTGywfQVAZntA64WP7RVct5VT2HQNb2wg jrrA== X-Gm-Message-State: APjAAAU2LD3HcyOjf2nVsbaEopEE9HhWJUl2+2SAR1yMEqyCZRhqEDIR 0vtYgdVp2Y/emXi0t/6WRSXmPdXrK64= X-Google-Smtp-Source: APXvYqza2m5Rq4xbgsu5S6cOGsn728vrFXE+VcLGsMrZRv3tVmTbP5tqc8bXYq7zfQvYrHoVExSJ3A== X-Received: by 2002:a1c:b7c4:: with SMTP id h187mr5439956wmf.105.1574970368433; Thu, 28 Nov 2019 11:46:08 -0800 (PST) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Subject: [PATCH v1 2/5] linux-user: convert target_mmap debug to tracepoint Date: Thu, 28 Nov 2019 19:46:00 +0000 Message-Id: <20191128194603.24818-3-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191128194603.24818-1-alex.bennee@linaro.org> References: <20191128194603.24818-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::343 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: Riku Voipio , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Laurent Vivier Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) It is a pain to re-compile when you need to debug and tracepoints are a fairly low impact way to instrument QEMU. Signed-off-by: Alex Benn=C3=A9e --- linux-user/mmap.c | 51 +++++++++++++++++++++++------------------ linux-user/trace-events | 1 + 2 files changed, 30 insertions(+), 22 deletions(-) diff --git a/linux-user/mmap.c b/linux-user/mmap.c index 66868762519..c81fd85fbd2 100644 --- a/linux-user/mmap.c +++ b/linux-user/mmap.c @@ -60,6 +60,15 @@ void mmap_fork_end(int child) pthread_mutex_unlock(&mmap_mutex); } =20 +/* mmap prot pretty printer */ +static void pp_prot(char (*str)[4], int prot) +{ + (*str)[0] =3D prot & PROT_READ ? 'r' : '-'; + (*str)[1] =3D prot & PROT_WRITE ? 'w' : '-'; + (*str)[2] =3D prot & PROT_EXEC ? 'x' : '-'; + (*str)[3] =3D 0; +} + /* NOTE: all the constants are the HOST ones, but addresses are target. */ int target_mprotect(abi_ulong start, abi_ulong len, int prot) { @@ -68,10 +77,7 @@ int target_mprotect(abi_ulong start, abi_ulong len, int = prot) =20 if (TRACE_TARGET_MPROTECT_ENABLED) { char prot_str[4]; - prot_str[0] =3D prot & PROT_READ ? 'r' : '-'; - prot_str[1] =3D prot & PROT_WRITE ? 'w' : '-'; - prot_str[2] =3D prot & PROT_EXEC ? 'x' : '-'; - prot_str[3] =3D 0; + pp_prot(&prot_str, prot); trace_target_mprotect(start, len, prot_str); } =20 @@ -370,32 +376,33 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, = int prot, abi_ulong ret, end, real_start, real_end, retaddr, host_offset, host_l= en; =20 mmap_lock(); -#ifdef DEBUG_MMAP - { - printf("mmap: start=3D0x" TARGET_ABI_FMT_lx - " len=3D0x" TARGET_ABI_FMT_lx " prot=3D%c%c%c flags=3D", - start, len, - prot & PROT_READ ? 'r' : '-', - prot & PROT_WRITE ? 'w' : '-', - prot & PROT_EXEC ? 'x' : '-'); - if (flags & MAP_FIXED) - printf("MAP_FIXED "); - if (flags & MAP_ANONYMOUS) - printf("MAP_ANON "); - switch(flags & MAP_TYPE) { + if (TRACE_TARGET_MMAP_ENABLED) { + char prot_str[4]; + g_autoptr(GString) flag_str =3D g_string_new(NULL); + + pp_prot(&prot_str, prot); + + if (flags & MAP_FIXED) { + g_string_append(flag_str, "MAP_FIXED "); + } + if (flags & MAP_ANONYMOUS) { + g_string_append(flag_str, "MAP_ANON "); + } + + switch (flags & MAP_TYPE) { case MAP_PRIVATE: - printf("MAP_PRIVATE "); + g_string_append(flag_str, "MAP_PRIVATE "); break; case MAP_SHARED: - printf("MAP_SHARED "); + g_string_append(flag_str, "MAP_SHARED "); break; default: - printf("[MAP_TYPE=3D0x%x] ", flags & MAP_TYPE); + g_string_append_printf(flag_str, "[MAP_TYPE=3D0x%x] ", + flags & MAP_TYPE); break; } - printf("fd=3D%d offset=3D" TARGET_ABI_FMT_lx "\n", fd, offset); + trace_target_mmap(start, len, prot_str, flag_str->str, fd, offset); } -#endif =20 if (!len) { errno =3D EINVAL; diff --git a/linux-user/trace-events b/linux-user/trace-events index 41d72e61abb..9411ab357c9 100644 --- a/linux-user/trace-events +++ b/linux-user/trace-events @@ -14,3 +14,4 @@ user_s390x_restore_sigregs(void *env, uint64_t sc_psw_add= r, uint64_t env_psw_add =20 # mmap.c target_mprotect(uint64_t start, uint64_t len, char *flags) "start=3D0x%"PR= Ix64 " len=3D0x%"PRIx64 " prot=3D%s" +target_mmap(uint64_t start, uint64_t len, char *pflags, char *mflags, int = fd, uint64_t offset) "start=3D0x%"PRIx64 " len=3D0x%"PRIx64 " prot=3D%s fla= gs=3D%s fd=3D%d offset=3D0x%"PRIx64 --=20 2.20.1 From nobody Thu Apr 25 21:54:34 2024 Delivered-To: importer@patchew.org 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; Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1574971797; cv=none; d=zohomail.com; s=zohoarc; b=a9nYVVG9bGyStbLXlAzqSy6BhjVNCqlIZLnVMjF38Ehfa4RREEg2YdlcjAKlZqf6Uy6c0dV+EZ40jloaTHUsajeTWW47gOP6i9zJ82kZ21VCQzuUZAo6o1oW/4UmzUGB/Mo/n1uXPGZHHB+uYMo7UE2Jil88khi8SWtP2kMll6M= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1574971797; 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; bh=Xd6QfwNiUuZdPTT7wpujCjGiQ2e91NoQmlqER4ZPXuQ=; b=UFJk8RMAI7wJjjDZiAVyF5oREtSjo/+luh5K7YSmksFpglDgIyREC2p+jQzmzgZCyxB8Ai3wEOtUT7QKPw1/NrLTEJ2cOlC/iAkPEVljyHA2Hba0MGDLB+072HX2HjC9GBZn0MNaZ8isjPeVvGhMmO3drFbk3HaCkRPdedgTJnA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; 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=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 1574971797684774.9082075937337; Thu, 28 Nov 2019 12:09:57 -0800 (PST) Received: from localhost ([::1]:52920 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iaQ6s-0004mq-BL for importer@patchew.org; Thu, 28 Nov 2019 15:09:55 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:49989) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iaPpR-0005lQ-4e for qemu-devel@nongnu.org; Thu, 28 Nov 2019 14:52:00 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iaPk4-0005Ja-Kq for qemu-devel@nongnu.org; Thu, 28 Nov 2019 14:46:23 -0500 Received: from mail-wm1-x342.google.com ([2a00:1450:4864:20::342]:52562) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iaPk0-00052o-3b for qemu-devel@nongnu.org; Thu, 28 Nov 2019 14:46:16 -0500 Received: by mail-wm1-x342.google.com with SMTP id l1so12033441wme.2 for ; Thu, 28 Nov 2019 11:46:11 -0800 (PST) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id v188sm801710wma.10.2019.11.28.11.46.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Nov 2019 11:46:06 -0800 (PST) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id B86CB1FF90; Thu, 28 Nov 2019 19:46:03 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Xd6QfwNiUuZdPTT7wpujCjGiQ2e91NoQmlqER4ZPXuQ=; b=JpSpTaCwy7M3rrf1KrlwDUZKqph0ZZLFcsYpaw9TPn68evSYwfZZzQ+VHXdahJgONJ qqrfXpBZHmOk0y5u4lapig6U01UJrjCvTCyPhnlGjSxpKeLr5CG3jeXcUpO87K1XzLes sZa79T7/HBZbNb8WDrxjX0tPP16E9+ebyC4vjEqVCQDoKe30nrvHRlrcc8anUnsm1Twl czBmIqZBJNsbMATdEZ/qghMXLMakyYiGhGvRYM/lRzSdDKf2xa5cN3dfTtlhvnpe0AYZ 8ID9VOAlMNSqUy1tBM9SuiC7o0cqGBiCwyZSL3d3+Da+w4yj4euNnEubvZ5xNaUQVZdC USAg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Xd6QfwNiUuZdPTT7wpujCjGiQ2e91NoQmlqER4ZPXuQ=; b=IG6X4YrE+k6alAm5CbsyaUszZtmc5NYYv9G8608sMiPlqJ2DURlovHf6/3R4Iz9wVm WX9Olsn2J+k+rQWGC6ECoucSeUAM/DMeRXQWtOmcBUcYkwxHfTgv0BR+i87tJ/j+tl4F AxBEYtJTVvOkyhhslkfeHw4tPB6amv5kmtvA/aPeLbJ3DNcvuBfTkpxAiOHST5C1h4l1 jhEvlcWOOqYMswAbuS6sol/qI/6ohSRDfRLTwQwLOpb3r63vK0K0dVbh+9EDFH6kZuvK cz7HlU5OcD6+ngW0u0c7NX3Opb5wqqN2zyet/uCZEMgXk0RiI61HUUJ+ZxLWSqkYsXon DCnA== X-Gm-Message-State: APjAAAVMCAobEc1ZM/UqblXKfkadIZU471xuTZaI+ngkm9EGqNnuDCXF gzNIPh1Q6h8tO4y8q8XkuAbp1w== X-Google-Smtp-Source: APXvYqwwdXI9W841RWRP9xk6AKlaSsDVF8zFT12ENySsW9yFtHYiT+Mwrei9O6bPaEv8TyOJjrHoAg== X-Received: by 2002:a1c:9cce:: with SMTP id f197mr6418427wme.133.1574970369864; Thu, 28 Nov 2019 11:46:09 -0800 (PST) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Subject: [PATCH v1 3/5] linux-user: add target_mmap_complete tracepoint Date: Thu, 28 Nov 2019 19:46:01 +0000 Message-Id: <20191128194603.24818-4-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191128194603.24818-1-alex.bennee@linaro.org> References: <20191128194603.24818-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::342 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: Riku Voipio , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Laurent Vivier Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) For full details we also want to see where the mmaps end up. Signed-off-by: Alex Benn=C3=A9e Reviewed-by: Richard Henderson --- linux-user/mmap.c | 2 +- linux-user/trace-events | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/linux-user/mmap.c b/linux-user/mmap.c index c81fd85fbd2..a2c7037f1b6 100644 --- a/linux-user/mmap.c +++ b/linux-user/mmap.c @@ -577,8 +577,8 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, in= t prot, the_end1: page_set_flags(start, start + len, prot | PAGE_VALID); the_end: + trace_target_mmap_complete(start); #ifdef DEBUG_MMAP - printf("ret=3D0x" TARGET_ABI_FMT_lx "\n", start); page_dump(stdout); printf("\n"); #endif diff --git a/linux-user/trace-events b/linux-user/trace-events index 9411ab357c9..774280cefbd 100644 --- a/linux-user/trace-events +++ b/linux-user/trace-events @@ -15,3 +15,4 @@ user_s390x_restore_sigregs(void *env, uint64_t sc_psw_add= r, uint64_t env_psw_add # mmap.c target_mprotect(uint64_t start, uint64_t len, char *flags) "start=3D0x%"PR= Ix64 " len=3D0x%"PRIx64 " prot=3D%s" target_mmap(uint64_t start, uint64_t len, char *pflags, char *mflags, int = fd, uint64_t offset) "start=3D0x%"PRIx64 " len=3D0x%"PRIx64 " prot=3D%s fla= gs=3D%s fd=3D%d offset=3D0x%"PRIx64 +target_mmap_complete(uint64_t retaddr) "retaddr=3D0x%"PRIx64 --=20 2.20.1 From nobody Thu Apr 25 21:54:34 2024 Delivered-To: importer@patchew.org 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; Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1574971188; cv=none; d=zohomail.com; s=zohoarc; b=lmvWhnVQdewXx13M4BgoTzwxbdsQI43wPVCQeVXIGbFDi+eEH3sh913fROPaVeCnUmiII01QjKClYb1VKORqZyhGLa4fylnmqf716+cf228/YCW1VcKWlLIKeEYPEQGOBLVosSpsS2y0znEuJmADlZLq0qumf2cj4I1ggzqs/1k= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1574971188; 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; bh=EvBD8IKIg2gzoIa1FIZ8ylgY2xvcdkR/vxvnu9RgvMk=; b=L3WrAxguxn8K4oyAgMqmrIr7APOw/OPxfG/jTPg/15X0GsLhgBszpaaOq6WcYclMX5qzDyJE6bLSNuZsPoDVvw7gxfDpHdnXoUqFgQs0TPqWeOfEINXNXKP27Sm7zQqG4E5iuObIbKdPxjHf6SV/SDDVVMumAiyqPWO0bYce79o= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; 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=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 1574971188544662.7444569309226; Thu, 28 Nov 2019 11:59:48 -0800 (PST) Received: from localhost ([::1]:52792 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iaPx3-0008OH-DQ for importer@patchew.org; Thu, 28 Nov 2019 14:59:46 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:49592) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iaPpO-0005iO-G0 for qemu-devel@nongnu.org; Thu, 28 Nov 2019 14:51:53 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iaPkB-0005TS-KY for qemu-devel@nongnu.org; Thu, 28 Nov 2019 14:46:28 -0500 Received: from mail-wm1-x341.google.com ([2a00:1450:4864:20::341]:50928) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iaPk1-00055O-OT for qemu-devel@nongnu.org; Thu, 28 Nov 2019 14:46:25 -0500 Received: by mail-wm1-x341.google.com with SMTP id l17so12054004wmh.0 for ; Thu, 28 Nov 2019 11:46:13 -0800 (PST) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id p9sm24335055wrs.55.2019.11.28.11.46.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Nov 2019 11:46:08 -0800 (PST) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id CC4841FF91; Thu, 28 Nov 2019 19:46:03 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=EvBD8IKIg2gzoIa1FIZ8ylgY2xvcdkR/vxvnu9RgvMk=; b=Yh54DIO2b3MVy2y5TD2oIi5TzGCVrFghW7znPF1LDltMLYrPNKXAgGktyry3xml1Ji dZuVFqkMxrPZcXaaST+giz3rvFz7Cv18ZvPyHzEhf/LAhPFhdDO+wPYWmlJgOQRYWI/c QqtxhTthb+bJctKADHnE0rcAsUlPdEfx9UH5XMiJOHC1YZHnIRxiOwzpWasfP9Cjp0Vq AvMNmugnJe2LXzLpUEjdnywqr62onILwDC3/X7rJVrNARbi8RUdqwO6bC6fHXCBOCSYA aGTzYU1MwSs57FLikFDqx84KGm8ztgRlCC+G2FwdOm/Cz/FcY4Yfttxppe1BOa9G06L0 6ziw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=EvBD8IKIg2gzoIa1FIZ8ylgY2xvcdkR/vxvnu9RgvMk=; b=ZEHHjAdMkQTHq0x+g8HToacpPROpTSSolh201GfD06RHePtTOh40/423G2/UoKutZ8 ISOOIBYxb8Bk/dRYz57OFFE5JdPP94uW+VJ80OWgbKJyf99uunn7yg0Cn0A2q+OwQ8JH l2fpbMREyA7StpR4C5aJXd9Z2uP5w8DWP2tRniuGKU3Pfn377J9aY/jr3rQCVRJTWnhZ BPINI4cbBAfTf/FOBaaSTDgVMyENaNjYlKSMbljvl7VOZ66gMyPB6vtYdLhgcCRnB9fr oaeHHp71QtYqxHy71Y4v82plu8UIE5S2X7GsmB+o6brQNZ9VYoYZCk5yangGAGDFeft+ yXpQ== X-Gm-Message-State: APjAAAWSApIIk5IHeEnMnKK5q8KkA0Bn/mb4tOJ8mBkFPP0miphUVmvm sca3vp81lmhegocXpH2+n7lmcA== X-Google-Smtp-Source: APXvYqw4485f0ZIjBjvBe3bpTbz8F0inWMxdX3bkI1F5zb5cuPcH3c5npIQz6h0+Sw3x+xkN8eLGVA== X-Received: by 2002:a1c:f404:: with SMTP id z4mr11174602wma.12.1574970371247; Thu, 28 Nov 2019 11:46:11 -0800 (PST) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Subject: [PATCH v1 4/5] linux-user: log page table changes under -d page Date: Thu, 28 Nov 2019 19:46:02 +0000 Message-Id: <20191128194603.24818-5-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191128194603.24818-1-alex.bennee@linaro.org> References: <20191128194603.24818-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::341 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: Riku Voipio , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Laurent Vivier Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) The CPU_LOG_PAGE flag is woefully underused and could stand to do extra duty tracking page changes. If the user doesn't want to see the details as things change they still have the tracepoints available. Signed-off-by: Alex Benn=C3=A9e --- linux-user/mmap.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/linux-user/mmap.c b/linux-user/mmap.c index a2c7037f1b6..c2755fcba1f 100644 --- a/linux-user/mmap.c +++ b/linux-user/mmap.c @@ -18,6 +18,7 @@ */ #include "qemu/osdep.h" #include "trace.h" +#include "exec/log.h" #include "qemu.h" =20 //#define DEBUG_MMAP @@ -578,10 +579,12 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, = int prot, page_set_flags(start, start + len, prot | PAGE_VALID); the_end: trace_target_mmap_complete(start); -#ifdef DEBUG_MMAP - page_dump(stdout); - printf("\n"); -#endif + if (qemu_loglevel_mask(CPU_LOG_PAGE)) { + qemu_log_lock(); + qemu_log("new page @ 0x"TARGET_ABI_FMT_lx" updates page map:\n", s= tart); + log_page_dump(); + qemu_log_unlock(); + } tb_invalidate_phys_range(start, start + len); mmap_unlock(); return start; --=20 2.20.1 From nobody Thu Apr 25 21:54:34 2024 Delivered-To: importer@patchew.org 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; Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1574977634; cv=none; d=zohomail.com; s=zohoarc; b=amxGlICiYyGcXXz4Q747eeJnXLnjgmlA27RQcPPXiDR9r6/5ylyKuxUk/+jOsVv5mibkurraEVAwSWkyS8i9buuMq7Xcce7vEzcb9VAtsq2sgXOKvtdyJfkAlf8vA1oNDISqW9eVNOUEVimRy+YpRKKO97ze+6i27KkXuJwdaJg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1574977634; 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; bh=IGkE42M4Q3eQbdw5NzOuWOoq/KgXpAh9fYfQ2Axv8vw=; b=kzt//QjlOAKV3MCI1RbNWOdDJtsGjS/EvSIvythPtJTYy9SH4ZiQQzx1qWEDbcYKfjWZ4/3DyE4t2bgE3dbdv6a5KhtqL0cLpDezgzu2Bok1musAAVWWN/gauoQNMCR5NXJ9tKInJX86BV6GYNOK/WEjcJHMv/cbH4+WzytXbsk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; 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=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 1574977634709890.0757227666548; Thu, 28 Nov 2019 13:47:14 -0800 (PST) Received: from localhost ([::1]:53442 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iaRd2-0003j8-BK for importer@patchew.org; Thu, 28 Nov 2019 16:47:12 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:49050) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iaPpP-0005c5-Ra for qemu-devel@nongnu.org; Thu, 28 Nov 2019 14:51:57 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iaPk4-0005J9-IQ for qemu-devel@nongnu.org; Thu, 28 Nov 2019 14:46:23 -0500 Received: from mail-wr1-x444.google.com ([2a00:1450:4864:20::444]:40346) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iaPk0-00057J-Qc for qemu-devel@nongnu.org; Thu, 28 Nov 2019 14:46:19 -0500 Received: by mail-wr1-x444.google.com with SMTP id c14so7825079wrn.7 for ; Thu, 28 Nov 2019 11:46:14 -0800 (PST) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id r6sm11550494wrv.40.2019.11.28.11.46.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Nov 2019 11:46:08 -0800 (PST) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id E20F51FF92; Thu, 28 Nov 2019 19:46:03 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=IGkE42M4Q3eQbdw5NzOuWOoq/KgXpAh9fYfQ2Axv8vw=; b=t5CELZuy5IsnSKVq33/vHd6UsAbIp+WNKtT/fV6zNifx6sXJzyMpnMpwLBdlrYGI7P Jc8h0ZR0o30ZgS64CpEajP24pPnCUCNR079/oMc56yejh3RtOhpu8LPJZlWFk35yr49P 8yO2L5QUmUg1RpGjcBElMpfRy0YeHjwtZxBjZekgHiE8JBHXHGwkJnh8PNBhOOc8kNP5 BWnS46LIdOHUN9FjMov7Kwbj/R0pckcADMxrFE1Azp6vWsVQe+fdc4BNCvI0qy8ltwhy 9hw+Tuk50kr//ovJbkyyhkcT2zVlDMQrB8x0Eqpq0mOdsRCAkjaXoDZa1lmMcRNYUlj0 P8Og== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=IGkE42M4Q3eQbdw5NzOuWOoq/KgXpAh9fYfQ2Axv8vw=; b=DrI9ateNLqJfbPAtCHq1Q08xvQgAxYkrf4dfN6rT0IyITUDE5I9j59bUhnXQ80UESw iv4Njn+2eBRo7MzXTZ3S4R/TLFovHblgje+/4T2yYwGblOgLVljZ27MZMZ7opb+RWLEh mZ4CfvfREiZJz/L8+YfXcjwUD5g4qH3PoAtWr4+8OQyMfHx+Z0ATUwqStc74K9kFDMFd FuaaU1c/+izxrWhJlWStXBvA8FsZvRQsneswrQUCf/KA2xEb+wZdJATQ6yvsXmtKYjZL UWpxlgtFg6UfQgG8eeY50eFOlJae0MnRDXSQVG38nG8B8RTvI9VMjxlFna31f9Xssayk Tbpg== X-Gm-Message-State: APjAAAWKM8IzoUA8fElq+9PEYJuJ43MEgzcSC1H+3bTlnfDFgGJmT55E zR+L0Z/U5HrMkdVQdCUTDRggpA== X-Google-Smtp-Source: APXvYqzYEDxbwW18VYylleGOTbvv60+5s7sO3Gifiuvhgck1ZHOg9Wl3PXeRlDutt+lvHA7I5SWY+g== X-Received: by 2002:a5d:6886:: with SMTP id h6mr32189927wru.154.1574970372552; Thu, 28 Nov 2019 11:46:12 -0800 (PST) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Subject: [PATCH v1 5/5] linux-user: convert target_munmap debug to a tracepoint Date: Thu, 28 Nov 2019 19:46:03 +0000 Message-Id: <20191128194603.24818-6-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191128194603.24818-1-alex.bennee@linaro.org> References: <20191128194603.24818-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::444 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: Riku Voipio , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Laurent Vivier Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Convert the final bit of DEBUG_MMAP to a tracepoint and remove the last remanents of the #ifdef hackery. Signed-off-by: Alex Benn=C3=A9e Reviewed-by: Richard Henderson --- linux-user/mmap.c | 9 ++------- linux-user/trace-events | 1 + 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/linux-user/mmap.c b/linux-user/mmap.c index c2755fcba1f..137aa3eb95f 100644 --- a/linux-user/mmap.c +++ b/linux-user/mmap.c @@ -21,8 +21,6 @@ #include "exec/log.h" #include "qemu.h" =20 -//#define DEBUG_MMAP - static pthread_mutex_t mmap_mutex =3D PTHREAD_MUTEX_INITIALIZER; static __thread int mmap_lock_count; =20 @@ -639,11 +637,8 @@ int target_munmap(abi_ulong start, abi_ulong len) abi_ulong end, real_start, real_end, addr; int prot, ret; =20 -#ifdef DEBUG_MMAP - printf("munmap: start=3D0x" TARGET_ABI_FMT_lx " len=3D0x" - TARGET_ABI_FMT_lx "\n", - start, len); -#endif + trace_target_munmap(start, len); + if (start & ~TARGET_PAGE_MASK) return -TARGET_EINVAL; len =3D TARGET_PAGE_ALIGN(len); diff --git a/linux-user/trace-events b/linux-user/trace-events index 774280cefbd..bd897add252 100644 --- a/linux-user/trace-events +++ b/linux-user/trace-events @@ -16,3 +16,4 @@ user_s390x_restore_sigregs(void *env, uint64_t sc_psw_add= r, uint64_t env_psw_add target_mprotect(uint64_t start, uint64_t len, char *flags) "start=3D0x%"PR= Ix64 " len=3D0x%"PRIx64 " prot=3D%s" target_mmap(uint64_t start, uint64_t len, char *pflags, char *mflags, int = fd, uint64_t offset) "start=3D0x%"PRIx64 " len=3D0x%"PRIx64 " prot=3D%s fla= gs=3D%s fd=3D%d offset=3D0x%"PRIx64 target_mmap_complete(uint64_t retaddr) "retaddr=3D0x%"PRIx64 +target_munmap(uint64_t start, uint64_t len) "start=3D0x%"PRIx64" len=3D0x%= "PRIx64 --=20 2.20.1