From patchwork Thu Dec 5 12:25:12 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: 180888 Delivered-To: patch@linaro.org Received: by 2002:a92:3001:0:0:0:0:0 with SMTP id x1csp2034327ile; Thu, 5 Dec 2019 06:21:10 -0800 (PST) X-Google-Smtp-Source: APXvYqzcMpD0ay+1ECvcWcSKU2dm0yHftR/cllpffrDfzZnEGK/EC7eDfGX8Ayk8qs9MCIsJVJAu X-Received: by 2002:ac8:687:: with SMTP id f7mr7187080qth.390.1575555670245; Thu, 05 Dec 2019 06:21:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575555670; cv=none; d=google.com; s=arc-20160816; b=cDHfGWBVk92PgPW1WEVUXmNm4mDiWCIhOBMLAejYqp6ZzLsbrXZksvtsHNM2o+x2Hh I6QuiAYU+Ol38WPNfJtatHNIdx75K1TQ4lPwTQGikDRJ3MiEyohEflox6SejI4f1TLE6 KRtH2AWHfvbKx12Z4FauQlzoRnM4TnRCOr+IBLnEyzXqz1ZPDtDFsp1zGiFVTttz6+5V x82CUasDM4PIc6NCtbi6kCIudlui660nNmGx31byrBTMBNsKnOWx78xaoW3N+IKT5rMf nRtkI3AShbDdNW/sURAPiLkEE3EjczvHq246bZuNB7snG293cQ2u/GuLr0PjFMD9hvPs 2BBw== 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=AwS6rtyEJKyLkwzf8eig7lEH4N3AqTO23sBKCr3rUB4=; b=0m69X0vCM2JLyl9GobyZK2aCszg7ZPQ+8mIONyGd1QePRrty10KZJ+g7ZZn1FVYAbR Zy5BHtT78UpNgWGrafwYRQ9zBKdZgDtBIKYzUOma5mbaSNe0y3ErfUI7N8C95EG/2SkR TqB3zrnjyYqT/LaPB0dsObkErpxi3VNk5umrfluELIZy8xKBTafx2Z/mA1A9gXK/pAs2 C4DBXm0A9cs/EiAqFEysVpnT4MIHNJvg49jVX1K8IvF1Pu/fo0kkF6IhNsU5EDTyaRtI Mo5SXzejF8NjU34qNWGXvQ0g+phy5LV5DMNZ20Lv0JTjt76WlhYNSNBXzdALOIqu1NT2 +pEg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=GITKPgtu; 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 cz4si6055889qvb.146.2019.12.05.06.21.10 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 05 Dec 2019 06:21:10 -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=GITKPgtu; 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]:55108 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ics0D-0005ZQ-6p for patch@linaro.org; Thu, 05 Dec 2019 09:21:09 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:56383) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1icret-0002Sg-HN for qemu-devel@nongnu.org; Thu, 05 Dec 2019 08:59:08 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1icres-0000Gv-77 for qemu-devel@nongnu.org; Thu, 05 Dec 2019 08:59:07 -0500 Received: from mail-lf1-x12a.google.com ([2a00:1450:4864:20::12a]:33008) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1icrer-0000A8-Re for qemu-devel@nongnu.org; Thu, 05 Dec 2019 08:59:06 -0500 Received: by mail-lf1-x12a.google.com with SMTP id n25so2606890lfl.0 for ; Thu, 05 Dec 2019 05:59:05 -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=AwS6rtyEJKyLkwzf8eig7lEH4N3AqTO23sBKCr3rUB4=; b=GITKPgtuLZtNwgUUIhehuyF0ahpDGuPSz0cQmbKFCVOXRMdjSlFOyyAfSX4/UzDFob NpoQRzy86EHaeywxWcKxQYH24mHynOyXcm7VF3Y/B6JvANnxFSo3x5Mu21yKW7uEpygH VYsaWvR7+WjV+QBel0CUGZ3ozbBAeUpKpBdWLe1/SQXCBZ7tO6DUS5ZU+EFeVRXze8oh 41CQeNvxCScQaMznoPHB9YMVY6oukYaKIfNZnCYJ2eUcN5/P4uzCn8LThp/I9a0WwIU3 K7P/PVgr0qcwbJRfuPWohIHAowL4cR6dvryjFIbEK47XOqd1MoDz6h0e/hL5FipJ9K8l F3/Q== 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=AwS6rtyEJKyLkwzf8eig7lEH4N3AqTO23sBKCr3rUB4=; b=r9DA9WL6W+iJVFvMSh+r0auIYdsPPjvHh03rSpS1Y5sftjasoKE5qK9mINyv6cXbvt EAHRv7PGNVbwvryhc/lqJVWh8hPnYeqNqcVMXV3zaxNBDh2S8VnJTZd/WxoJNRZ+VI8D WmVBQKcVmveHzRdziZm+VEciG3tUxzEMcUCd05SVfOUXVqRbo40RqSKOyGd/FPIBPmBr EC3ptcVtQPIDUuIzkdwS5r1J7Xo33tFbCLT1oRzriWnKs+KfNN8qiuVKqUBjFT+i/BTk ZKdEACmyabWMMdBxBHVewvGQtEAJLZy1NvlhTSjUKpUjREPHbADRtS6PqO8yz9fhiJjL pFuA== X-Gm-Message-State: APjAAAXKM30mxpb8redoTJiUt3kJUdIovNGdaPe1JFsGhYmSJfLb5a1m wAagjhSbmeX8ve/x9HIlVR3vFucNpyY= X-Received: by 2002:adf:afc2:: with SMTP id y2mr9867264wrd.254.1575548722558; Thu, 05 Dec 2019 04:25:22 -0800 (PST) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id m7sm5054986wma.39.2019.12.05.04.25.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Dec 2019 04:25:18 -0800 (PST) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 255881FF8C; Thu, 5 Dec 2019 12:25:18 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Subject: [PATCH v2 1/6] linux-user: convert target_mprotect debug to tracepoint Date: Thu, 5 Dec 2019 12:25:12 +0000 Message-Id: <20191205122518.10010-2-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191205122518.10010-1-alex.bennee@linaro.org> References: <20191205122518.10010-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::12a 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 --- v2 - don't both with ascii conversion --- linux-user/mmap.c | 10 ++-------- linux-user/trace-events | 3 +++ 2 files changed, 5 insertions(+), 8 deletions(-) -- 2.20.1 Reviewed-by: Richard Henderson Reviewed-by: Laurent Vivier diff --git a/linux-user/mmap.c b/linux-user/mmap.c index 46a6e3a761a..26a83e74069 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,7 @@ 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 + trace_target_mprotect(start, len, prot); if ((start & ~TARGET_PAGE_MASK) != 0) return -TARGET_EINVAL; diff --git a/linux-user/trace-events b/linux-user/trace-events index 6df234bbb67..8419243de4e 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, int flags) "start=0x%"PRIx64 " len=0x%"PRIx64 " prot=0x%x" From patchwork Thu Dec 5 12:25:13 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: 180883 Delivered-To: patch@linaro.org Received: by 2002:a92:3001:0:0:0:0:0 with SMTP id x1csp1985460ile; Thu, 5 Dec 2019 05:41:41 -0800 (PST) X-Google-Smtp-Source: APXvYqyviz4gDIMqbUXhixvcblTsPEpIvfTITMD4kjNyZJu9L/8L15a9D95ZElnveeSNpdBzybES X-Received: by 2002:aca:4911:: with SMTP id w17mr1373598oia.22.1575553301605; Thu, 05 Dec 2019 05:41:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575553301; cv=none; d=google.com; s=arc-20160816; b=In3YUbeCOztGs38L8nfGJ3q4wdc7gR680RvQXJODyDJu9jiby9latUq83n4IGScgRI iKH8XqTcucX42ZM5Rbmg2/9mI266fsuFSOeZWwihnxKWZonQThMCvjwD0wQdivV50Ztd X+jWuXtMxTA9LsRNvhmHL1+CkIRIFZt90KqTUz5tWgKHgC535nuY6i+J4C5oxFxKVSqJ uLfKs8uwnuyv8qqmslKIP6AeSWf42gosD/NpylimBkPhOt2q3I2CG57kOychybqSSn4e m9OYaS9SUF1OHVoT0uBs8MS/y7wL8kXOiFuXHmD0fmm2kFtmyooZDy5jEks4w5zmyyqj MR0Q== 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=ojk/DQPD5yxe3f3qJM/gjK8YaBYa+zXsUEip1if0FLM=; b=xTRHyNUU5iJfyslCteS5AKB8npHgQv3vIYoyI0g8MR50gm/6DAPEdyYOSi/QHJ+UC5 cLmsSMZPg8NMiE4iyt6NiAzdorLGepgQwNxOxPzVKElNZoELPk2g6W00pzRNfNhafs8j MQVcfCvpqGbzDSA/xV26UPz88Ijok7+TuL9Br6AzS3lYqLGDS0ggpMvKHZLlL5TM0o72 xTPxfnrG4n3FKg+Gt43AvrtIaWAQ60x46/xIHVD0zaMJZiJHY6ULX7DGr1lebAvvRPMZ kJ5pbSwGHtFVpU+z7dZ5F4ZbLbXFM3rvqd+kqz+8Wul0+QH8KSfcYiDVon+N/YEL9Y6J yFJg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=rKOCD9L3; 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 n23si4749983otf.265.2019.12.05.05.41.41 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 05 Dec 2019 05:41:41 -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=rKOCD9L3; 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]:54222 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1icrO0-000196-Hg for patch@linaro.org; Thu, 05 Dec 2019 08:41:40 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:41947) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1icrIL-0005b5-8P for qemu-devel@nongnu.org; Thu, 05 Dec 2019 08:35:51 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1icrII-0000Qn-Nx for qemu-devel@nongnu.org; Thu, 05 Dec 2019 08:35:48 -0500 Received: from mail-wr1-x42f.google.com ([2a00:1450:4864:20::42f]:39550) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1icrII-0000Kj-DJ for qemu-devel@nongnu.org; Thu, 05 Dec 2019 08:35:46 -0500 Received: by mail-wr1-x42f.google.com with SMTP id y11so3616883wrt.6 for ; Thu, 05 Dec 2019 05:35:39 -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=ojk/DQPD5yxe3f3qJM/gjK8YaBYa+zXsUEip1if0FLM=; b=rKOCD9L3meiIyOgEQNRLS3TDw2OoMphNKnf6kkU2Y3EZ7bMVe/ddDkJW4MdUnZJjuA vd03D6eYzVN52MtTcHt85x44EcpFZO+gLT6WhewyraJdPxlSWFg+0BIjG5j6pJ3gs0DK Ym08+PcuoVv7PMtIVezLIhGVC2fuxU00Ylo24zNv1hfFSaUiIsYPpd4KLhC0ck/gQ+sm gLafAmwXObk00LLFAPMvk6QwszyaMjJmx5aUnXJVOae4wNxRXLMjTAoYEYmQ35veHOh/ AlcUBWlZmAhjHWklvS9X0MTJaAatl4V6dQTUxnOLyhrMOcGRQ9PUbb2yDU/guaU/e0h8 lASA== 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=ojk/DQPD5yxe3f3qJM/gjK8YaBYa+zXsUEip1if0FLM=; b=BxPTWiQe1QunBIeqOiAqJudsn6pJo5HKV0DdOj+b4r6DO0xVQxFIsGMf8uBxQRzbmD EVGYVG/O5M807pjUtS+8fuW8650oB7KTElM59HNdMDkn2U4G47vOX0pz2nAjAHlgbKNC rIJBqyXG/XDlWMewu5JCJ25eRuIb8nLfOteRtjcxW/XrgsmSwTXegt1+d3dr7YpKMnIC /wm65G5cba+EuVPS7KWqbiUUpAWzeMK+VxGaLyeX/ixAMolV1+l4tCBPJEV9KJq7jyWL UJ0ZgTtK2EUFTpzhfr4kxe3WigexahuaoSC5N/CAwhoHufmtmkKXDR0S4+WNGc9osiZH onLw== X-Gm-Message-State: APjAAAWnSla6qV6mWWkSmUl5ZQ/vZdl8IuN7IP5G/pXK1ZsgLnMQpRhC XRo7DKK/aklxHNByYIIL79jO9RykDQE= X-Received: by 2002:adf:fd91:: with SMTP id d17mr10394205wrr.340.1575548721417; Thu, 05 Dec 2019 04:25:21 -0800 (PST) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id v20sm10471139wmj.32.2019.12.05.04.25.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Dec 2019 04:25:18 -0800 (PST) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 3BF631FF8F; Thu, 5 Dec 2019 12:25:18 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Subject: [PATCH v2 2/6] linux-user: convert target_mmap debug to tracepoint Date: Thu, 5 Dec 2019 12:25:13 +0000 Message-Id: <20191205122518.10010-3-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191205122518.10010-1-alex.bennee@linaro.org> References: <20191205122518.10010-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::42f 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 | 27 +-------------------------- linux-user/trace-events | 1 + 2 files changed, 2 insertions(+), 26 deletions(-) -- 2.20.1 Reviewed-by: Richard Henderson Reviewed-by: Laurent Vivier diff --git a/linux-user/mmap.c b/linux-user/mmap.c index 26a83e74069..f4f10deaeac 100644 --- a/linux-user/mmap.c +++ b/linux-user/mmap.c @@ -363,32 +363,7 @@ 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) { - case MAP_PRIVATE: - printf("MAP_PRIVATE "); - break; - case MAP_SHARED: - printf("MAP_SHARED "); - break; - default: - printf("[MAP_TYPE=0x%x] ", flags & MAP_TYPE); - break; - } - printf("fd=%d offset=" TARGET_ABI_FMT_lx "\n", fd, offset); - } -#endif + trace_target_mmap(start, len, prot, flags, fd, offset); if (!len) { errno = EINVAL; diff --git a/linux-user/trace-events b/linux-user/trace-events index 8419243de4e..8d8d4c3c68c 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, int flags) "start=0x%"PRIx64 " len=0x%"PRIx64 " prot=0x%x" +target_mmap(uint64_t start, uint64_t len, int pflags, int mflags, int fd, uint64_t offset) "start=0x%"PRIx64 " len=0x%"PRIx64 " prot=0x%x flags=0x%x fd=%d offset=0x%"PRIx64 From patchwork Thu Dec 5 12:25:14 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: 180890 Delivered-To: patch@linaro.org Received: by 2002:a92:3001:0:0:0:0:0 with SMTP id x1csp2036533ile; Thu, 5 Dec 2019 06:22:47 -0800 (PST) X-Google-Smtp-Source: APXvYqxqUKwjtef2K0b+V+otbLA+OKLDE9T86ij5MSUk/cjP7aHUUlJij4NawH5QCE7eCt+yY+js X-Received: by 2002:a05:6830:12cc:: with SMTP id a12mr6120255otq.73.1575555767190; Thu, 05 Dec 2019 06:22:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575555767; cv=none; d=google.com; s=arc-20160816; b=A8L0ppZjrcMBV2TpCCDdcB9w/yG+ux3R4LujpCAoFMrD2eYI1iHw3XTQHBK2HALuoW SvZt3nrYqGyOmaKjKVD4hVrOCiM7eRE84NmNM/w7cRzc7lWyfH552Pfde1FPRd1qw1LH cu8+BLtG/mZwstMD/vOMr8oba+RWlq3m8TC33GPa1MU5GtBguK72Mm/DofCpVIaIz1nV ZcjwSp0IaJbTSSUzByoH2oS4z7quckKi5nHQ4d9gqEo1Q2ODMay0lyoHF2LAwO09CKwn NFz7yixKxZX32wkZm+7rG/rdshXLsxcuVBCbDOEM+MZfDP7yGVjiJjHcPUCbLug87UO3 R6KA== 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=j8BHLefjvES9SOUgRcfX4ySy651Dqcu3C9AOxEtMINE=; b=fMygrlG0MV+Jy/qzqYzqwrpELT1j5j0DkWnnc/fwe+4fKaIrKvWNRJJCQEerZlTWCq Dw+QbTbPTQDyfoinIAvUlgDKd4Xi6g8yZ2NNG1AABS91i+QHrwlfwfn9RMUh/23vecZN Pibp0G34nhYuegpj0tEe03BAmgmR/ShAgklUe4XIrGU9sgC9ME7LcUmk5wRqKuiX5hd9 O5ZivdeJ7jtWSx/VlYzKsHe77xZRJSvJR5CiNbPW92HNE1sdyepf3SMtMWZ1n0Ys9vKZ Dh92OTSkjjLN73eNTd8cPisC1fVSYxrWz54AIyHRaIAWOtxjS6LucXOSza+VS8CXxOqu hqDQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=H9d2840q; 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 5si2465356ott.186.2019.12.05.06.22.47 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 05 Dec 2019 06:22:47 -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=H9d2840q; 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]:55154 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ics1m-0007Lw-9z for patch@linaro.org; Thu, 05 Dec 2019 09:22:46 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:45874) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1icrwD-0002c0-Qs for qemu-devel@nongnu.org; Thu, 05 Dec 2019 09:17:03 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1icrwC-0003tT-CI for qemu-devel@nongnu.org; Thu, 05 Dec 2019 09:17:01 -0500 Received: from mail-wr1-x441.google.com ([2a00:1450:4864:20::441]:34183) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1icrwC-0003oN-26 for qemu-devel@nongnu.org; Thu, 05 Dec 2019 09:17:00 -0500 Received: by mail-wr1-x441.google.com with SMTP id t2so3847049wrr.1 for ; Thu, 05 Dec 2019 06:16:59 -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=j8BHLefjvES9SOUgRcfX4ySy651Dqcu3C9AOxEtMINE=; b=H9d2840qQHkWnEUhW/yRLuN9XbkJ2AtviP8lUc4S+3SvC/u3qn30KkX2ynW/dZwws6 zkN3DLP2z983CcHPnDhwOXKwaQPjRbrb8BZ0L2Cezw2jGMmWpcKM2zXwhQEhlz1R3cII ROP0sz9Bf5oa8LMBWqXRrcTv4faM/KDoITZ3ntc5gh1gTrv99MHqd9g9rcfwDjIA4Avi 496oyNAP8pZrxwjmMeooiCOX6usOZSK2uueloRDSm6appx2Qgz8nvOFZr6hhlMZSxExj nlMhC0NlKxfcyzLS1KpPcKIfdbNKs7OmIdAM1aBiUP1fixn8ZM2N5hiHAWki6e9euXrT leBw== 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=j8BHLefjvES9SOUgRcfX4ySy651Dqcu3C9AOxEtMINE=; b=mDnz0TlgDjouTJP6vUuJ/XNPlCzJ8FVcgBT7IianKrEWI6NRybi3XV7H0gUWkXseap 4miYtbWrbrxIm1sYGwOUzMwjHQXW2UQMoFNOnWsUuwUMGH3dE03xt3s7XQCiva0U9w4O OdBPoQTUt0n7Xdl+BeOlJCaIpgGx+YH3jgeIBpDnYguIjEn435BQ8f00JFZll9Zl6Qfd ted3Ce042xfxB5dFUbTC6MJjprqZ2e506LRAVRR6CLFkTbr+2TSqI44T0UneV93Kimk5 VKKaj3i7Un2NNftCuzZSXpOrCvTbIYC7cjuC4XuPRDKmtoVR6gu+TaURRwz3MVld23Bb uulA== X-Gm-Message-State: APjAAAURnyZ3ktPIOMqQrlatwKw3jGddm4NuqjCOMQIeF9Qv/T/3294x v8xZLRhEXfXvnZ+XTaPQacBzPnaQvDw= X-Received: by 2002:adf:fa50:: with SMTP id y16mr9908354wrr.183.1575548723861; Thu, 05 Dec 2019 04:25:23 -0800 (PST) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id a64sm11379882wmc.18.2019.12.05.04.25.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Dec 2019 04:25:20 -0800 (PST) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 5225C1FF90; Thu, 5 Dec 2019 12:25:18 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Subject: [PATCH v2 3/6] linux-user: add target_mmap_complete tracepoint Date: Thu, 5 Dec 2019 12:25:14 +0000 Message-Id: <20191205122518.10010-4-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191205122518.10010-1-alex.bennee@linaro.org> References: <20191205122518.10010-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::441 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: Richard Henderson , 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 Reviewed-by: Richard Henderson --- linux-user/mmap.c | 2 +- linux-user/trace-events | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) -- 2.20.1 Reviewed-by: Laurent Vivier diff --git a/linux-user/mmap.c b/linux-user/mmap.c index f4f10deaeac..0b1b43ac3c0 100644 --- a/linux-user/mmap.c +++ b/linux-user/mmap.c @@ -538,8 +538,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 8d8d4c3c68c..6d6aeef7b52 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, int flags) "start=0x%"PRIx64 " len=0x%"PRIx64 " prot=0x%x" target_mmap(uint64_t start, uint64_t len, int pflags, int mflags, int fd, uint64_t offset) "start=0x%"PRIx64 " len=0x%"PRIx64 " prot=0x%x flags=0x%x fd=%d offset=0x%"PRIx64 +target_mmap_complete(uint64_t retaddr) "retaddr=0x%"PRIx64 From patchwork Thu Dec 5 12:25:15 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: 180884 Delivered-To: patch@linaro.org Received: by 2002:a92:3001:0:0:0:0:0 with SMTP id x1csp2017710ile; Thu, 5 Dec 2019 06:08:32 -0800 (PST) X-Google-Smtp-Source: APXvYqzVUmmE+8XPudgOiWJjpKdEY8PBWEO4HSLzzqEw6Jku0WMsxOiBTY0xzYKk88MAPR7r6pOp X-Received: by 2002:aed:33a3:: with SMTP id v32mr7860863qtd.301.1575554912096; Thu, 05 Dec 2019 06:08:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575554912; cv=none; d=google.com; s=arc-20160816; b=hzHmOwG53dtxtZLk7nW6/FT7r5B5zgWuYhrmvvOna79JcfqpC6cvW6Jy+vmQ1G/TjC YpudY+emWzmJZFaTtDdkLymxVwfmh9oyaUG0VMCx/IGb04MpCnjDLUIR5a3gpeG4vMTS 75M5YkDcheL4awTuwG2MPyYo9CKy6Uwz9WQ0sycLPHuER1KVkeaG9NBr2FJaQROh6hla iF+icZRQrN5E9PfVEDGzHYRVMTWH9tma5dqnK023+nvaNmzK4g/xPfxkvpkY3pSxWi2U D16VRdL6CGzFsn4D1hUIwrT0XomaVBoJTX/I206MLquxVW+H+dGsYJgUJZKaOmLw7+Sf O4Pg== 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=+aAcg7zfu3h11WqWsNjIj4w0+SSQrzO+SPiMdumxwPs=; b=t3rzDt5+GXpg9QM6CDloiGwnv0thsoV3ixaxtUoue7UtIZwZVgxVBFSckTkDPvW069 YfVkO7rc2XGzdK6Lf+jmw9D2ag/P+SVIfgKNUJufy+LO/I1SnL+H9v7Rzljn5dSQRTdz 7jZXR3JPXxuIFytg+0fJ7bAN5rfAQN8PpYfyeDKTBEyfWA+EmXyaBwFYpIMt08gC6eTl KfhTVsBOKaLXBhAtdqHCeN0wWtELjiIbhZ4+JMopqi9ajFh860p/RLFZ7y9p7deSF4zV q4jihbgmbF8bBhSXiHkvHrCG0PqavQUo7wn7JnqBbHK6LkCBDSJdJgYofQCN/iN2WF4R 7kQg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b="M38C/sxQ"; 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 i54si4976996qti.373.2019.12.05.06.08.32 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 05 Dec 2019 06:08:32 -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="M38C/sxQ"; 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]:54898 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1icrnz-0002Oc-95 for patch@linaro.org; Thu, 05 Dec 2019 09:08:31 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:42644) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1icrbn-0007jf-Ll for qemu-devel@nongnu.org; Thu, 05 Dec 2019 08:55:56 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1icrbm-0000Rt-1h for qemu-devel@nongnu.org; Thu, 05 Dec 2019 08:55:55 -0500 Received: from mail-wr1-x444.google.com ([2a00:1450:4864:20::444]:39556) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1icrbl-0000MS-NG for qemu-devel@nongnu.org; Thu, 05 Dec 2019 08:55:53 -0500 Received: by mail-wr1-x444.google.com with SMTP id y11so3708103wrt.6 for ; Thu, 05 Dec 2019 05:55:53 -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=+aAcg7zfu3h11WqWsNjIj4w0+SSQrzO+SPiMdumxwPs=; b=M38C/sxQAU0NtdioFNZF9aZmTzys4b+YebJd6E6ryGA5szJQ/nxOY0gESlUJqu3pUY 2WknaPFSyQYiaPkhe9NGpp6VPqCo4+mwI2mlrDojQO2QUvnqVG0CxhEwk1ApmpwpS2uX qmRqwB8i2zbCKprwTTBpHoUVJd+EBr3c9R1wEOvPzFZLvijJeN/HWt82TiioU2Hhxylx c9h4mfDBpyH7JOQAuWWsghvhHNzXL+mHqGEFTh0mHFH1P2exmzh7uf3C3tMqDPZ0RIQK QL38hjsnIkIf4qkMsGh1ucv4qKqpXlUgME4+s7K7Zec38ft+Vg9lHkKylpLEyZrqL0E5 3l+A== 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=+aAcg7zfu3h11WqWsNjIj4w0+SSQrzO+SPiMdumxwPs=; b=FyeS22JEpO5V8J05Ogzp4OtCQntqN2lFpfKSdcEAQfI9z6mUDrG/pUX3PSmZeNB2mC G4fV/XuYz4OcdAp1fwGda9/ERX/aatYGSeaZaJhGj0JSDbDjv4JWdwH38eAs7u9ugv1g wmACOP+cTLzoXCkMt2r9/eDliljQDChqATItAMHvXwW6KaocEhMYt4M+BFi52cyITMkY Jsil9mdQaidl1oCakqb0T8ZNJUj1/uJb7WND2GVdmUL+UHALlpffKj+a+9sFuytlnm5J 4VvVcvkesrokxiDYfV/RNnytzPUy2fQMQVs/29wFLNODcyxmLrqW5O2h5n4cswrP5w22 8nNg== X-Gm-Message-State: APjAAAWd0vrPq5NOMMSXObL+DeFVCcDPqualrNlkB+7eVVsAzZkg4GuE 4rH5sK/Z67hBEZoJ2OOi28pNaXr02Ds= X-Received: by 2002:adf:f382:: with SMTP id m2mr9800560wro.163.1575548725921; Thu, 05 Dec 2019 04:25:25 -0800 (PST) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id v3sm9639813wml.47.2019.12.05.04.25.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Dec 2019 04:25:22 -0800 (PST) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 6A1A31FF91; Thu, 5 Dec 2019 12:25:18 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Subject: [PATCH v2 4/6] linux-user: log page table changes under -d page Date: Thu, 5 Dec 2019 12:25:15 +0000 Message-Id: <20191205122518.10010-5-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191205122518.10010-1-alex.bennee@linaro.org> References: <20191205122518.10010-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" 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. We push the locking into log_page_dump and pass a reason for the banner text. Signed-off-by: Alex Bennée --- v2 - reworded banner text - moved locking into helper - converted stray calls of page_dump --- include/exec/log.h | 5 ++++- bsd-user/main.c | 2 +- linux-user/main.c | 2 +- linux-user/mmap.c | 8 ++++---- 4 files changed, 10 insertions(+), 7 deletions(-) -- 2.20.1 Reviewed-by: Richard Henderson Reviewed-by: Laurent Vivier diff --git a/include/exec/log.h b/include/exec/log.h index e2cfd436e61..012af09f9b3 100644 --- a/include/exec/log.h +++ b/include/exec/log.h @@ -50,9 +50,12 @@ static inline void log_disas(void *code, unsigned long size) #if defined(CONFIG_USER_ONLY) /* page_dump() output to the log file: */ -static inline void log_page_dump(void) +static inline void log_page_dump(const char *operation) { + qemu_log_lock(); + qemu_log("page layout changed following %s\n", operation); page_dump(qemu_logfile); + qemu_log_unlock(); } #endif #endif diff --git a/bsd-user/main.c b/bsd-user/main.c index 470a8bf79ed..7f4e3cd6271 100644 --- a/bsd-user/main.c +++ b/bsd-user/main.c @@ -963,7 +963,7 @@ int main(int argc, char **argv) if (qemu_loglevel_mask(CPU_LOG_PAGE)) { qemu_log("guest_base 0x%lx\n", guest_base); - log_page_dump(); + log_page_dump("binary load"); qemu_log("start_brk 0x" TARGET_ABI_FMT_lx "\n", info->start_brk); qemu_log("end_code 0x" TARGET_ABI_FMT_lx "\n", info->end_code); diff --git a/linux-user/main.c b/linux-user/main.c index 6ff7851e86f..8718d03ee21 100644 --- a/linux-user/main.c +++ b/linux-user/main.c @@ -826,7 +826,7 @@ int main(int argc, char **argv, char **envp) if (qemu_loglevel_mask(CPU_LOG_PAGE)) { qemu_log("guest_base 0x%lx\n", guest_base); - log_page_dump(); + log_page_dump("binary load"); qemu_log("start_brk 0x" TARGET_ABI_FMT_lx "\n", info->start_brk); qemu_log("end_code 0x" TARGET_ABI_FMT_lx "\n", info->end_code); diff --git a/linux-user/mmap.c b/linux-user/mmap.c index 0b1b43ac3c0..3d90fa459ca 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 @@ -539,10 +540,9 @@ 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)) { + log_page_dump(__func__); + } tb_invalidate_phys_range(start, start + len); mmap_unlock(); return start; From patchwork Thu Dec 5 12:25:16 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: 180885 Delivered-To: patch@linaro.org Received: by 2002:a92:3001:0:0:0:0:0 with SMTP id x1csp2020985ile; Thu, 5 Dec 2019 06:11:05 -0800 (PST) X-Google-Smtp-Source: APXvYqzdh4tgb8Vqae7smyrOe+GIphoZUETGlXgQ1jpPKqdo38gyz6BgcIEj6rMgbBOOy4PstzP5 X-Received: by 2002:a0c:8061:: with SMTP id 88mr7710253qva.62.1575555064975; Thu, 05 Dec 2019 06:11:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575555064; cv=none; d=google.com; s=arc-20160816; b=gxd1GHKptBmmznhnek5buO3lC10IJmLebVk+Ygdm0DERrV0dBaQQeu5pH3PzVLLIJH wNhLLqf3zHqk3JpqiUFx3Okjqe5o9ew2H73S+yQXKtCBSQtYfN6THZ7jkwJceyid/nSd SvflnngkcH9HYO+X1ZgYcyi02lBZMsutHQD646MPpftI5u7fjJ9F7AogiS/bkU3RZigJ Zp65VW4VTj07aG26kpGq/yl0CIbTcndE7UBPtp0MarIVVTcrSlJY4PKglGWaDBUVE2eY tfsrqpYuY95dt/oElA5ZC7VQGANZ60kZRZ5nFTon5LUTQqVohx+QrwE7OD8gcTtxk0jz hbIw== 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=LlKAQUU8BKqjO5SGyRq373lXLOzaiq/UNvhXOUrnIRc=; b=lpb4trDANT+QUXKbpAwqbokoAfHurl0zXtXEi2bC/CMo8u+i/39pEQIcRWFiHA/QOh YwntwkXq0i7xn5DPRNYDgebttTJWtat6kp2+qmmw87jBz0FAFKLzVGlySotoMXXbru5Y 65bkflihaX8DP8QjocRmQkwa4GwLg/Bb8v/Uzgqf0WkSCXrUUizGPL1d8ULbfOnmP9Wj vvRwfGlSlwUbZYlkZ10kaC92zOkm+DTPlFYYIO6iv0BLFy7wefd41crQg3u0C3gQlFRZ PrC2lIb7AADGGqrqwRhyHo9Khc936LkpIpOqLXe/DSeeep6G4Wn7WZ5yfC6g09XbqbW3 +9mA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=PnkFp6iw; 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 y16si6459795qka.107.2019.12.05.06.11.04 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 05 Dec 2019 06:11:04 -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=PnkFp6iw; 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]:54944 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1icrqR-0005bC-Hr for patch@linaro.org; Thu, 05 Dec 2019 09:11:03 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:36642) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1icrnW-0001z4-AA for qemu-devel@nongnu.org; Thu, 05 Dec 2019 09:08:03 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1icrnU-0006Mr-Uh for qemu-devel@nongnu.org; Thu, 05 Dec 2019 09:08:01 -0500 Received: from mail-wr1-x442.google.com ([2a00:1450:4864:20::442]:46823) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1icrnU-0006Es-L3 for qemu-devel@nongnu.org; Thu, 05 Dec 2019 09:08:00 -0500 Received: by mail-wr1-x442.google.com with SMTP id z7so3696269wrl.13 for ; Thu, 05 Dec 2019 06:08:00 -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=LlKAQUU8BKqjO5SGyRq373lXLOzaiq/UNvhXOUrnIRc=; b=PnkFp6iwJHjJz5h4WFjkI0alqjBMd1+8kTpKE8H0jcyRQIY8Xu9PxjqlShj/GfZxOJ AR1UgiQfnS+hSiz3S98XmqRggV5a1ht7JN7ZrJJ2lu4zLshalRb9WTNIatbQM+GL10y6 miuyiQLVClhZWSZz6AeiWN3udkVhLFC46yTuCeFgDTz/IXPgpUQgp49X920SJ4ac2+o7 HYYqeYCOkzw3DiIeIuCDEOlT9Xk2lj2NvwBHaiU4Vkg2/ElUjfbc5fVbepyjZJ63fZvI gUxTgW0uhov6oOxlxlD/QswX3eBzeqK8R/LXhdok4rr/4a0pePK+mp6TfVUJdu+YL+wS z5rA== 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=LlKAQUU8BKqjO5SGyRq373lXLOzaiq/UNvhXOUrnIRc=; b=iI/RonqgHwVdnEn1dOGrTQfb2+q6laKxeK6Rrjqb3OtJ8c87D6JdkfSv7St6a2qxXt qnY+vFAI8pM4IPy1pwSz5OZqXFUfsDGv7kPQaAFyVcxpEjfG1MWdB7l5OZ3vnaLQiwts bFO4lpjJZSds4KYzYaQBN7aB9oV8k5B1Fw1ASxpu7I7KTQC75xf/LKhcJbwGTC5EAoDr SPgSR/Zg01texl4WeQI2TzB72m+7XtGm61e0Bi+l9KpJi37kOYtMQZiEt9ESLMrbcDiV CU1Q9tMFS8iFV/10hmt78YcA5LOaITva82yhoo9eT0WbQMU/TO4t16wRLP8GzL/kfKPj mx2A== X-Gm-Message-State: APjAAAXxjuMCxgoxyK/nVw3f8QHqrWJHgq8Rvs3Dfe/vjGB1MjBwPMPl oVSFg5Ls5Au01ayzHImU8R/lOfZPuXg= X-Received: by 2002:adf:f581:: with SMTP id f1mr10237571wro.264.1575548727599; Thu, 05 Dec 2019 04:25:27 -0800 (PST) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id u10sm10125668wmd.1.2019.12.05.04.25.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Dec 2019 04:25:23 -0800 (PST) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 7EB841FF92; Thu, 5 Dec 2019 12:25:18 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Subject: [PATCH v2 5/6] linux-user: convert target_munmap debug to a tracepoint Date: Thu, 5 Dec 2019 12:25:16 +0000 Message-Id: <20191205122518.10010-6-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191205122518.10010-1-alex.bennee@linaro.org> References: <20191205122518.10010-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::442 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: Richard Henderson , 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 Reviewed-by: Richard Henderson --- linux-user/mmap.c | 9 ++------- linux-user/trace-events | 1 + 2 files changed, 3 insertions(+), 7 deletions(-) -- 2.20.1 Reviewed-by: Laurent Vivier diff --git a/linux-user/mmap.c b/linux-user/mmap.c index 3d90fa459ca..8685f02e7e9 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; @@ -597,11 +595,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 6d6aeef7b52..f6de1b8befc 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, int flags) "start=0x%"PRIx64 " len=0x%"PRIx64 " prot=0x%x" target_mmap(uint64_t start, uint64_t len, int pflags, int mflags, int fd, uint64_t offset) "start=0x%"PRIx64 " len=0x%"PRIx64 " prot=0x%x flags=0x%x 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 From patchwork Thu Dec 5 12:25:17 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: 180886 Delivered-To: patch@linaro.org Received: by 2002:a92:3001:0:0:0:0:0 with SMTP id x1csp2022640ile; Thu, 5 Dec 2019 06:12:16 -0800 (PST) X-Google-Smtp-Source: APXvYqxFcP48LcZHotLcuGSCCnQa4aETCtADDFGibSV8a6WnBV2CPFOaHE6dG/fhXMXaCAPJrrqJ X-Received: by 2002:aca:57d4:: with SMTP id l203mr7425954oib.113.1575555136715; Thu, 05 Dec 2019 06:12:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575555136; cv=none; d=google.com; s=arc-20160816; b=QMD4iXz64sm+QL3Cx48zBhfto8Mzq9OEYGqxsPbWuI9R6VWlyP6QW5poGO8+zbjbvM gemOu4MKTXFupOvYgDA02ph14YYfDUkGt5zUYKcEZVUHna4EVuRP6I8ueezyKubLqydp GIyz/bGX46BeF0mFS9DR3m/Z13z2sCw0/2yKjik+ro2V1rPusQHpytCDAFNSy7lH2HEL 0lq9BI87IKs2aWcI+FqcL0RJHUFXoX/PF62e9GuO3Gd9GFNf26tkHe4DHo2f0zo6sbHq 5BPIyHD5c8DUfnta2j5WX58BU4oxZIY4TgZ+xcCUoN4ghUhzNArTjuKO7xnH0WcCRNOT roPQ== 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=et7ltZY7DPRXGygmqJQSM9s82vIGOWea1S/OwancEF4=; b=RmL1u1mB9XhiBCNMW4cYn5GT1pxCXNrZ49sHqu8SpnN3LIfdikU6FdTDHG2mtUclFf s+cyD6AnTogrixag7P9GGzt71kMOLBfFMNYuhGYPpaKsrXAK60+szgnerPITFEOduOs5 qvY61g7suXWlRy2k1vFlQzj8RxFWkkHepl/67vltwE6tQCVs17zmT0yo7j3JalWtZj0Y XgkgRXY7VB1GutdyT9QN1RgF5AfuLuok/IlRu/pjJg6nDpqmvpRoqAcmBYDHbhf/dyuZ cmT0n7YyQCzkoZB6udLbyVJWKg01qpX1/Ue2GwjWtvVFNJz36ZylbbHuyeVyddm8xq9d LhRQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=HloIVpv2; 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=pass (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 o16si5361083otp.289.2019.12.05.06.12.16 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 05 Dec 2019 06:12:16 -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=pass header.i=@linaro.org header.s=google header.b=HloIVpv2; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:54958 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1icrrc-0006aH-1n for patch@linaro.org; Thu, 05 Dec 2019 09:12:16 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:56768) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1icrex-0002Xw-4s for qemu-devel@nongnu.org; Thu, 05 Dec 2019 08:59:12 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1icrew-0000Yl-0H for qemu-devel@nongnu.org; Thu, 05 Dec 2019 08:59:11 -0500 Received: from mail-wr1-x444.google.com ([2a00:1450:4864:20::444]:38127) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1icrev-0000VF-PO for qemu-devel@nongnu.org; Thu, 05 Dec 2019 08:59:09 -0500 Received: by mail-wr1-x444.google.com with SMTP id y17so3731489wrh.5 for ; Thu, 05 Dec 2019 05:59: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=et7ltZY7DPRXGygmqJQSM9s82vIGOWea1S/OwancEF4=; b=HloIVpv2ZsUpCeB42Jm/DQW8F9xJlGHdlqPleFxK8RcIiHbRu8uIVNQs89iJZ5/fxA 7XzBsbwZ5KPNkEtR2ApMkLaQYRFE+Mmdmya408z6SxkDKa+/vW1zjbbObGBq142BF2Oh W2ZCn9g/aqbtRNB7jvCxeRJs4Gb7ZWMDfDXZlSP9sK6S4uoGkICBhrHiy2g5BLFD1KRF pUEcggkqBm/3Xxtr+wJnX86SZ/KiZUzYBexdhh66dfKm8bTWGfLxK1LASWIlgaR6zCJb BL7POBLO9y0hffJYFCkiSYj+G/fEp1nAKU2HoyNx/5gd358sPM387nWpzZHxMsfaQ/cX R+ww== 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=et7ltZY7DPRXGygmqJQSM9s82vIGOWea1S/OwancEF4=; b=IwZesQVCPJLz961VtIPQ+WPHscbXUsi0lBYzSXdakNadPFXgJe/cr1eUwd0K+Ggw5P sX2tKclMLubjczE1dQ6XZxZk6kc8Ssli8Ln+6FzYztNPhTxmWyssa3z2P0d7iF7CDXXT Wtcy4YcCiIBZGkyRRC48UcogpORsTNS93Zl80sWKJWvWB8C1uDa8Tdlemrp/UUPXJJlt Mz2kdcm8d3VHWO7HgpyGatDtcSOviXdXPJs+bT/GX1PvL2dyj3U86RSHKjdN8z1h9eU0 ACeub89ozPeQJlf4PbnzIfTFdIMgvN8NNlPD2PObgHqw3434L91cnTjU+GKkf1n2/5+k 8Dbg== X-Gm-Message-State: APjAAAVXstFaO6ItJM/wH6nZODRjYgWWdg93Qb3ZyXeY2rRjxx+HCrt8 dtJCUvaTdp2AdK2IO30rTP9Pr9AFygs= X-Received: by 2002:a5d:4a84:: with SMTP id o4mr9712985wrq.396.1575548728753; Thu, 05 Dec 2019 04:25:28 -0800 (PST) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id i127sm10954997wma.35.2019.12.05.04.25.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Dec 2019 04:25:23 -0800 (PST) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 947E11FF93; Thu, 5 Dec 2019 12:25:18 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Subject: [PATCH v2 6/6] trace: replace hand-crafted pattern_glob with g_pattern_match_simple Date: Thu, 5 Dec 2019 12:25:17 +0000 Message-Id: <20191205122518.10010-7-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191205122518.10010-1-alex.bennee@linaro.org> References: <20191205122518.10010-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: =?utf-8?q?Alex_Benn=C3=A9e?= , Stefan Hajnoczi Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" We already use g_pattern_match elsewhere so remove the duplication. Signed-off-by: Alex Bennée --- trace/control.c | 35 +---------------------------------- 1 file changed, 1 insertion(+), 34 deletions(-) -- 2.20.1 Reviewed-by: Richard Henderson Reviewed-by: Stefan Hajnoczi diff --git a/trace/control.c b/trace/control.c index d9cafc161bb..0fb81241607 100644 --- a/trace/control.c +++ b/trace/control.c @@ -98,38 +98,6 @@ TraceEvent *trace_event_name(const char *name) return NULL; } -static bool pattern_glob(const char *pat, const char *ev) -{ - while (*pat != '\0' && *ev != '\0') { - if (*pat == *ev) { - pat++; - ev++; - } - else if (*pat == '*') { - if (pattern_glob(pat, ev+1)) { - return true; - } else if (pattern_glob(pat+1, ev)) { - return true; - } else { - return false; - } - } else { - return false; - } - } - - while (*pat == '*') { - pat++; - } - - if (*pat == '\0' && *ev == '\0') { - return true; - } else { - return false; - } -} - - void trace_event_iter_init(TraceEventIter *iter, const char *pattern) { iter->event = 0; @@ -148,8 +116,7 @@ TraceEvent *trace_event_iter_next(TraceEventIter *iter) iter->group++; } if (!iter->pattern || - pattern_glob(iter->pattern, - trace_event_get_name(ev))) { + g_pattern_match_simple(iter->pattern, trace_event_get_name(ev))) { return ev; } }