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;