From patchwork Thu Nov 28 19:45:59 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 180463 Delivered-To: patch@linaro.org Received: by 2002:a92:3001:0:0:0:0:0 with SMTP id x1csp637227ile; Thu, 28 Nov 2019 13:30:40 -0800 (PST) X-Google-Smtp-Source: APXvYqzffcnuX9lfnP6X7pxNqQyrot1UJz319W+wwQeUI8bRAfSoRVHCrxWpIL1IHAOPGr1Hzi2I X-Received: by 2002:ae9:f711:: with SMTP id s17mr12116708qkg.238.1574976640547; Thu, 28 Nov 2019 13:30:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574976640; cv=none; d=google.com; s=arc-20160816; b=wUbL6sVtoboP3CgWMFRxxnGqN9Hg5UjDO3XZT0Aq+MfDUM1uKNye54Zj2GiNOOBBmL 1dJeCI0NB+KcOGXw8orno+miVNoPyet4Xs9dzQICIdN0cjwFwcs+knWHdW97nNLho1GK qRujmJCHU2nQfhd6AMQS8xmIkjGatjMil8LYDtdy4mHaK57eA3ZhQ7ShVozQKih8c4wS MPWdb6Y9pLfIefSXWx6YiIRvx+0ucvvqEHytAjhm+I7Ipoc/WZ+fiSQ5mS6E5Wv3qTtn IdmKvB9Nb/NlWGLXqCUwVElnAMfBM5DnzTpKLEbhMyRL/cS5FgDe+awAniaquU1faBIW 6NBQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=cHVkaylNoydLTY4nbj39jRtqYAY0ZylLt+xXhgtOIDo=; b=YpSaEED1fpJ755AWfSA2WwKsxUKMpSftiC2GaPSMSb9McLdzF3cBYacMs0qs+G717M hMgT67HtvIBBDzJWUY5Ny5XWJJR4PDnYiNtD8WPCdE3kWP9US33NbhJWt4UNYCM10iOV m+7+B7xiC1lGWrFJFfYkhF7dhEgJHb1CzFlwISJOS7QrYNfMIMcqeg5kbIdf7Mo7gqf1 AWWdUxiuR1uDMQQF3+c0yOY8vHCZvb8Z+NAemVPUwF2ksBk6NwdPdzFO3QG4RAoa4Azc jjnN6X18p8W7YFkLd0/CUag5+h6epA7vHggrsgBqdQivLoNBVMHufByxLwZApAHVo9UR 1i2A== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b="aq5bJ/2t"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id b73si13244086qkg.210.2019.11.28.13.30.40 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 28 Nov 2019 13:30:40 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b="aq5bJ/2t"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:53382 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iaRMy-0005w1-3K for patch@linaro.org; Thu, 28 Nov 2019 16:30:36 -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) 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-Received: by 2002:a7b:c055:: with SMTP id u21mr11456859wmc.55.1574970365731; Thu, 28 Nov 2019 11:46:05 -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) From: =?utf-8?q?Alex_Benn=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 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_Benn=C3=A9e?= , Laurent Vivier Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" 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ée --- linux-user/mmap.c | 17 +++++++++-------- linux-user/trace-events | 3 +++ 2 files changed, 12 insertions(+), 8 deletions(-) -- 2.20.1 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" //#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; -#ifdef DEBUG_MMAP - printf("mprotect: start=0x" TARGET_ABI_FMT_lx - "len=0x" TARGET_ABI_FMT_lx " prot=%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] = prot & PROT_READ ? 'r' : '-'; + prot_str[1] = prot & PROT_WRITE ? 'w' : '-'; + prot_str[2] = prot & PROT_EXEC ? 'x' : '-'; + prot_str[3] = 0; + trace_target_mprotect(start, len, prot_str); + } if ((start & ~TARGET_PAGE_MASK) != 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=%p signal %d" user_host_signal(void *env, int host_sig, int target_sig) "env=%p signal %d (target %d(" user_queue_signal(void *env, int target_sig) "env=%p signal %d" user_s390x_restore_sigregs(void *env, uint64_t sc_psw_addr, uint64_t env_psw_addr) "env=%p frame psw.addr 0x%"PRIx64 " current psw.addr 0x%"PRIx64 + +# mmap.c +target_mprotect(uint64_t start, uint64_t len, char *flags) "start=0x%"PRIx64 " len=0x%"PRIx64 " prot=%s" From patchwork Thu Nov 28 19:46:00 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 180466 Delivered-To: patch@linaro.org Received: by 2002:a92:3001:0:0:0:0:0 with SMTP id x1csp658433ile; Thu, 28 Nov 2019 13:57:48 -0800 (PST) X-Google-Smtp-Source: APXvYqwIXQIR2BZGo3onG4lrdHumAnmxxkcyPL/73sxIseldTe7mv/YZBggRckoXTnOqiV4e100n X-Received: by 2002:a50:ac7c:: with SMTP id w57mr41031139edc.155.1574978268200; Thu, 28 Nov 2019 13:57:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574978268; cv=none; d=google.com; s=arc-20160816; b=HZiFRlhkh/yM7004+2mnP+si7bPyoGwSCd6EWgpW5mcLp90RVYCIm9cQ2kdhvSsxsZ kajGdNJmRmYdkBf236jLs5vopxZ9E0iJI4U3AkXqBdku/ocSSEPLamQu9BKe66qtTzDZ K4hHu1Sz3Gzqikj68XmG5GW5Yz2NcNFD8kjklN3XPfMMe82mwyycEIsMEs5tbBIYYEL+ NTJsf7Rzn6ElDSMu3kn1VVzERIwoaNWfbGgyRmdPSWR/X0gF5aDvlkFeQVgRv7dTDucI +W0TYVFndMx9/1/QF/pCo7FIK7SmGSOpoW9XxmdHH1LwVoFvQ/KrgncdXD/zN+zCxhLj fLgg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=MNn7wi779g5wDhZisTPTovBof5tUb05aT8JmY/Sn4ZM=; b=UxZugbdNCVjiRsPFG42QeNZ0YeaVKe+RJPksTNO46KdFBR6iGVi8UBRIZ8BTALN8ht SYj4+4b0q9eLB7thZHL+HTvpHwzM7pbwJE/IVnzIwwtYvQhnIEurVoqM20xMUpo22voW SFVWyWmABuhVBn3dw0+gjT6flzpCCjCA1wqfShHnstuc96fvw89pRJ67wH7X33RcxeEP CaEPL40I1hNRwKrpIb65DmzwsvMZZVf7ytJkH75uggA7LVY9VMj1BpG+XW1SE7Y2H9cU E/KYAA3BZVBAWCwCFQBaWyc/Po9IwMhHxm4OzLAaa6lwUqgP4D9B7YYBByx+xAXJEN+4 9T2g== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=Xk19NKkJ; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id k1si1099293ejj.76.2019.11.28.13.57.47 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 28 Nov 2019 13:57:48 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=Xk19NKkJ; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:53544 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iaRnC-0000ic-Tx for patch@linaro.org; Thu, 28 Nov 2019 16:57:43 -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) 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-Received: by 2002:a1c:b7c4:: with SMTP id h187mr5439956wmf.105.1574970368433; Thu, 28 Nov 2019 11:46:08 -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) From: =?utf-8?q?Alex_Benn=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 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_Benn=C3=A9e?= , Laurent Vivier Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" 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ée --- linux-user/mmap.c | 51 +++++++++++++++++++++++------------------ linux-user/trace-events | 1 + 2 files changed, 30 insertions(+), 22 deletions(-) -- 2.20.1 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); } +/* mmap prot pretty printer */ +static void pp_prot(char (*str)[4], int prot) +{ + (*str)[0] = prot & PROT_READ ? 'r' : '-'; + (*str)[1] = prot & PROT_WRITE ? 'w' : '-'; + (*str)[2] = prot & PROT_EXEC ? 'x' : '-'; + (*str)[3] = 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) if (TRACE_TARGET_MPROTECT_ENABLED) { char prot_str[4]; - prot_str[0] = prot & PROT_READ ? 'r' : '-'; - prot_str[1] = prot & PROT_WRITE ? 'w' : '-'; - prot_str[2] = prot & PROT_EXEC ? 'x' : '-'; - prot_str[3] = 0; + pp_prot(&prot_str, prot); trace_target_mprotect(start, len, prot_str); } @@ -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_len; mmap_lock(); -#ifdef DEBUG_MMAP - { - printf("mmap: start=0x" TARGET_ABI_FMT_lx - " len=0x" TARGET_ABI_FMT_lx " prot=%c%c%c flags=", - 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 = 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=0x%x] ", flags & MAP_TYPE); + g_string_append_printf(flag_str, "[MAP_TYPE=0x%x] ", + flags & MAP_TYPE); break; } - printf("fd=%d offset=" TARGET_ABI_FMT_lx "\n", fd, offset); + trace_target_mmap(start, len, prot_str, flag_str->str, fd, offset); } -#endif if (!len) { errno = 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_addr, uint64_t env_psw_add # mmap.c target_mprotect(uint64_t start, uint64_t len, char *flags) "start=0x%"PRIx64 " len=0x%"PRIx64 " prot=%s" +target_mmap(uint64_t start, uint64_t len, char *pflags, char *mflags, int fd, uint64_t offset) "start=0x%"PRIx64 " len=0x%"PRIx64 " prot=%s flags=%s fd=%d offset=0x%"PRIx64 From patchwork Thu Nov 28 19:46:01 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 180462 Delivered-To: patch@linaro.org Received: by 2002:a92:3001:0:0:0:0:0 with SMTP id x1csp558796ile; Thu, 28 Nov 2019 12:04:01 -0800 (PST) X-Google-Smtp-Source: APXvYqx48sTvn9Bg4ejDQGHnw7r7OqR/P2+fZafWTGy7Lz+eAkGVWsnbXTI1w3kUMDqeLyvqtL++ X-Received: by 2002:a05:620a:796:: with SMTP id 22mr10624485qka.419.1574971441603; Thu, 28 Nov 2019 12:04:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574971441; cv=none; d=google.com; s=arc-20160816; b=st5L06k3V9YW1JwtMvs3zGGqfU5dKdFWbdAA6fYFhWPMnX/3xRo0Xy50yMbpqzeUgh SPXNYAxD+UoOdkwCkr5pNh/jlIn1Zie+A3zPRI4f7sOEn/0O/CeEPYY15mRE5el0moa4 5YWk9wpNM+utAjnjXwZOpMCdsKuq7athaKkPsufPb1o0dRURHd3El25dtOreZQB59hv1 jeJZPicNGJT19gPGOWXTLxcTCyFzXDZ1mXSQyE/8BX/H+pQa+IZJ94wa6IaTA/feKGey xSp9rnPneyoJ09PJwFPX/CUqD8TkAuiern/GG0nxdWFb475ChzEdI3Cm7wWSRpDPkYmW uzvA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=Xd6QfwNiUuZdPTT7wpujCjGiQ2e91NoQmlqER4ZPXuQ=; b=ID6ygZVN7dTR+OffCR5SGYm07bt2Y08RzqNiFWgQGK/W5732JYSk8AiKj39V1/S/QQ jzmypagXDblPllU9+nmtSud9a3ve6WlusfUF2D+TecnBR3RYsj+nYiH6k39zip4gUlrF 8KBbAKK/pA5L8J4VJVshr/yIg1TO6VoP0ORpE95jtrDTUcEo6vMoNdVUDTRsgCy5VzG+ 1/cK7IVuCzACHDSJ3rqswhnyENPLkoOtGC0BugE9eRPSJ7NWy5oVG2QabdX0EIqinKhk zcdO1dbCyxVzDaI2dHRkpXWXTGaDvhTRW2vtqZd9yZd/FSx+a2yRMFp3C0tSMaoAs6O6 sh+A== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=JpSpTaCw; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id t19si12795817qto.107.2019.11.28.12.04.01 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 28 Nov 2019 12:04:01 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=JpSpTaCw; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:52878 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iaQ18-0002gN-4f for patch@linaro.org; Thu, 28 Nov 2019 15:03:59 -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) 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-Received: by 2002:a1c:9cce:: with SMTP id f197mr6418427wme.133.1574970369864; Thu, 28 Nov 2019 11:46:09 -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) From: =?utf-8?q?Alex_Benn=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 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_Benn=C3=A9e?= , Laurent Vivier Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" For full details we also want to see where the mmaps end up. Signed-off-by: Alex Bennée --- linux-user/mmap.c | 2 +- linux-user/trace-events | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) -- 2.20.1 Reviewed-by: Richard Henderson 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, int prot, the_end1: page_set_flags(start, start + len, prot | PAGE_VALID); the_end: + trace_target_mmap_complete(start); #ifdef DEBUG_MMAP - printf("ret=0x" 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_addr, uint64_t env_psw_add # mmap.c target_mprotect(uint64_t start, uint64_t len, char *flags) "start=0x%"PRIx64 " len=0x%"PRIx64 " prot=%s" target_mmap(uint64_t start, uint64_t len, char *pflags, char *mflags, int fd, uint64_t offset) "start=0x%"PRIx64 " len=0x%"PRIx64 " prot=%s flags=%s fd=%d offset=0x%"PRIx64 +target_mmap_complete(uint64_t retaddr) "retaddr=0x%"PRIx64 From patchwork Thu Nov 28 19:46:02 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 180461 Delivered-To: patch@linaro.org Received: by 2002:a92:3001:0:0:0:0:0 with SMTP id x1csp557129ile; Thu, 28 Nov 2019 12:02:36 -0800 (PST) X-Google-Smtp-Source: APXvYqxSMS5c8Qu3hKRnmZ2tjWHg1r9PtQVY4GgVPDxZYnPO82xjqfgtvCB1jqRRmC8U8hPMBwOD X-Received: by 2002:ac8:1112:: with SMTP id c18mr33918511qtj.379.1574971356388; Thu, 28 Nov 2019 12:02:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574971356; cv=none; d=google.com; s=arc-20160816; b=u9pIZAjdt6JgaHreJYRHjodTRVcfHgLTpKyaTBW312EiwEhUnrtwypAChCkzQLkgZq 6oPCKHvghwif17YqnwdAuC/qVytEG6Xnowqub17BCgLPHsOAvaT3t9W9Ad/yrhOmJE4p 7nD3FdOwQzvAHIc99QIox7PL1yUQnOitt9UlaziAanfbY6JebNaxrzKA5rXM4YuyrUgF oAP9x+0TJr2X0Cx7MJVHVdkYJx0Z/DLdfUK9gKk4YV1n2UbMyfo/TDI7AIDMcCTAEm4C c9SiDZ8xGgc2PWe0JNxgou3M0ctfYTadc8gZAMywC9rIQhWNCebc0X3qvpU1cFLZ5cCx 2KrA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=EvBD8IKIg2gzoIa1FIZ8ylgY2xvcdkR/vxvnu9RgvMk=; b=LGtf8xALNBq4S68NiX00h18EWBv+RNvmmCzGJ49D68BgXtcBcMIpEKehqr8Ge8kP16 rv/RsvAXLgk9MwkyGRE1mx8m2vAuuTLZAk9Jd4BMHjUuhBG7Lb/rWM1CrZOMIg6L34EC krQlL4RoZ9zlfSkHo6uz/nHuj9Kfj9DVrw7kUYoLpWDV5DfTOWdmN0VHrrUOh/OotRKF OI1vSBzEp8eUF3qDr4CayjhomZv0F2DFV9NtuktKiYj5/RoNnneC1rgkmfjbp9qjOVDx gQSifTHEEbkkSlTh07aVSCPKiddzsVdXPk+wpZlRDTrV5A+wlwsBiNF7WN7/n1Us7gVC ykIQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=Yh54DIO2; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id m18si555726qki.357.2019.11.28.12.02.36 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 28 Nov 2019 12:02:36 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=Yh54DIO2; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:52868 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iaPzm-0002TI-Uh for patch@linaro.org; Thu, 28 Nov 2019 15:02:34 -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) 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-Received: by 2002:a1c:f404:: with SMTP id z4mr11174602wma.12.1574970371247; Thu, 28 Nov 2019 11:46:11 -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) From: =?utf-8?q?Alex_Benn=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 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_Benn=C3=A9e?= , Laurent Vivier Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" 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ée --- linux-user/mmap.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) -- 2.20.1 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" //#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", start); + log_page_dump(); + qemu_log_unlock(); + } tb_invalidate_phys_range(start, start + len); mmap_unlock(); return start; From patchwork Thu Nov 28 19:46:03 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 180465 Delivered-To: patch@linaro.org Received: by 2002:a92:3001:0:0:0:0:0 with SMTP id x1csp646083ile; Thu, 28 Nov 2019 13:41:43 -0800 (PST) X-Google-Smtp-Source: APXvYqzW3Qnzv4F+EghN8+FSEFbRrO9zKQ6SnfZ/cYO5ocOF0U3G0WTr1OqklzKcZLLtSD4jw4Vz X-Received: by 2002:a17:906:411:: with SMTP id d17mr56415962eja.299.1574977303093; Thu, 28 Nov 2019 13:41:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574977303; cv=none; d=google.com; s=arc-20160816; b=KQSoo/dZ2PjrqxBI5eA6++do9QJwJZLUmsZATZCoA7GXfsmZN+zRBxh+cNmXdC66VU KxmbJPm7PYIFafGM5wR0VsYp6H9pcPmdoa5GUR1pKZMc4UNT3luWEL/CrJVEL0K/TVpI /O3qD+Vc1jO1UvkWlHAQ+33ruwbYQcd49Iap2O9N/iK1ZjsxDiw8Z7B+Ci0+QnHbbQ9z IdYvBbF6LVxwbm3Dx/CUIBncJ2LryrKYOQHY4xRGMYq+d/1+bYpnXb6MQ6QZa4QTb7NT umwepsV2+LKj5wgje7I3FADrTCLCkwHgw8VOJoJMS8vgn9ia7ciC6JnT5JF9R32HeiIy KOcA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=IGkE42M4Q3eQbdw5NzOuWOoq/KgXpAh9fYfQ2Axv8vw=; b=Rlmwal6HFf9rX53682FF3gEtlaBambhnXiZSyec9m4K1A3ANuuDBAXZHhDcYsP455/ OH+4nytODbrM9DuJjzgzVNzMrUeLDvQ0SEu7UPXPG0wdLpPJZgQUBx/Lli9HJ6/XclH1 nBkBDDm7m8RMrcTXfQYlo6KMwLrvi4U5jh5Gnv8Mg0kvVAR8AZHj+jvjK8sUaVDM2aJe plfFOsddvle03WBeLaWfgBPzs30Vm0q9QFRKdnBVvkRuH5iw0hNUC/9Rc8IoZpJsQkQa Po/dUqPkZfR6XOphsMaveXI/phvqCqIEsN3V3CQbgPhEO59LXrwjDbNB3y9G1tolPXD0 vcNg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=t5CELZuy; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id i2si3597841edn.239.2019.11.28.13.41.42 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 28 Nov 2019 13:41:43 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=t5CELZuy; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:53422 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iaRXf-0001dA-29 for patch@linaro.org; Thu, 28 Nov 2019 16:41:39 -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) 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-Received: by 2002:a5d:6886:: with SMTP id h6mr32189927wru.154.1574970372552; Thu, 28 Nov 2019 11:46:12 -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) From: =?utf-8?q?Alex_Benn=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 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_Benn=C3=A9e?= , Laurent Vivier Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Convert the final bit of DEBUG_MMAP to a tracepoint and remove the last remanents of the #ifdef hackery. Signed-off-by: Alex Bennée --- linux-user/mmap.c | 9 ++------- linux-user/trace-events | 1 + 2 files changed, 3 insertions(+), 7 deletions(-) -- 2.20.1 Reviewed-by: Richard Henderson 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" -//#define DEBUG_MMAP - static pthread_mutex_t mmap_mutex = PTHREAD_MUTEX_INITIALIZER; static __thread int mmap_lock_count; @@ -639,11 +637,8 @@ int target_munmap(abi_ulong start, abi_ulong len) abi_ulong end, real_start, real_end, addr; int prot, ret; -#ifdef DEBUG_MMAP - printf("munmap: start=0x" TARGET_ABI_FMT_lx " len=0x" - TARGET_ABI_FMT_lx "\n", - start, len); -#endif + trace_target_munmap(start, len); + if (start & ~TARGET_PAGE_MASK) return -TARGET_EINVAL; len = 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_addr, uint64_t env_psw_add target_mprotect(uint64_t start, uint64_t len, char *flags) "start=0x%"PRIx64 " len=0x%"PRIx64 " prot=%s" target_mmap(uint64_t start, uint64_t len, char *pflags, char *mflags, int fd, uint64_t offset) "start=0x%"PRIx64 " len=0x%"PRIx64 " prot=%s flags=%s fd=%d offset=0x%"PRIx64 target_mmap_complete(uint64_t retaddr) "retaddr=0x%"PRIx64 +target_munmap(uint64_t start, uint64_t len) "start=0x%"PRIx64" len=0x%"PRIx64