Received: by 10.223.185.116 with SMTP id b49csp2234233wrg; Sun, 4 Mar 2018 22:14:29 -0800 (PST) X-Google-Smtp-Source: AG47ELtHzVqOnIOxtgYNLvq6CdJSFiTS8v2djUUvoYrn/y3C+uafrNAGHjX0WA4SleMNwwGkqWQ8 X-Received: by 2002:a17:902:6e8c:: with SMTP id v12-v6mr12058010plk.424.1520230469554; Sun, 04 Mar 2018 22:14:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520230469; cv=none; d=google.com; s=arc-20160816; b=e6riwKtG0xdmXFY2ozLaii7ACs4nsFPMgaI0bKXb8hsolM+Ahj7ncYyvD9JM5+7pGR qPxnFUzJ/cASkMeONF6HTAgRjt9UcG9Gf0i7a3B76Jo0RZ6d7aRd82fQw03MQfBiCxF5 GmcOlrLHnr7UKvCvw7tC1JnIooDfwNC59GrNHbn0FJq71i0dMOUREWZgBxSNszKnhH+E dP2BXtx7UWjYiPAx9L5L+3tnOo8Ga37qB7zb1E+8ksRVg8Ugg8hLRIi6ewylwo59UQmL 15FqC6DZRRXsNd9N8SAEju17Zx6GLV9L8AZInANXjfbM3l5W7w8KlO+XbZ/6MKfLy76/ Wt0w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:reply-to:references:in-reply-to :message-id:date:subject:cc:to:from:arc-authentication-results; bh=x1BnsObGWU+ZOgKCFtypVbzFSK42xK21MUwQnPHUhwE=; b=Ra3zKnfcDvcnyP2//7YzZvCSr4FNeYvm+h56qAsaIRJy+EvzGocU+KCdNZIxAjzw8W C11lF4sZVTEXA+/c8caXIaBFcehGdhX5bTmTiX6IknfhjDXjja8fKLm/4FyWTP6VkDqd UOg/BERK20Rck5RX5BbHU+EiPuTle8ibwgg16sXNHs6SeQT9Y+sIY1DqQmaKEPOiylb/ ZHWPDSmnBmsOMfCVHDt032/OZlBD8dDBocKY+BlmACGo21Vf6ex0S1PLe1kpfSlPaA2+ /h9SOHKi4xryFXO3gDHDQNjeowDiZuv4GIwkC6mltwVuF2C+5eWeikzVQY3tY+nkFFpo z6Rg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=exchange.microsoft.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t8si7892495pgc.273.2018.03.04.22.14.12; Sun, 04 Mar 2018 22:14:29 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=exchange.microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932587AbeCEFTt (ORCPT + 99 others); Mon, 5 Mar 2018 00:19:49 -0500 Received: from a2nlsmtp01-02.prod.iad2.secureserver.net ([198.71.225.36]:41714 "EHLO a2nlsmtp01-02.prod.iad2.secureserver.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752357AbeCEFSf (ORCPT ); Mon, 5 Mar 2018 00:18:35 -0500 Received: from linuxonhyperv2.linuxonhyperv.com ([107.180.71.197]) by : HOSTING RELAY : with SMTP id siVCew77bTLhIsiVCewZbi; Sun, 04 Mar 2018 22:17:34 -0700 x-originating-ip: 107.180.71.197 Received: from kys by linuxonhyperv2.linuxonhyperv.com with local (Exim 4.89_1) (envelope-from ) id 1esiVC-00050w-6S; Sun, 04 Mar 2018 22:17:34 -0700 From: kys@exchange.microsoft.com To: gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org, devel@linuxdriverproject.org, olaf@aepfle.de, apw@canonical.com, vkuznets@redhat.com, jasowang@redhat.com, leann.ogasawara@canonical.com, marcelo.cerri@canonical.com, sthemmin@microsoft.com Cc: "K . Y . Srinivasan" Subject: [PATCH V2 12/12] hv_balloon: trace post_status Date: Sun, 4 Mar 2018 22:17:22 -0700 Message-Id: <20180305051722.19157-12-kys@exchange.microsoft.com> X-Mailer: git-send-email 2.15.1 In-Reply-To: <20180305051722.19157-1-kys@exchange.microsoft.com> References: <20180305051539.19079-1-kys@exchange.microsoft.com> <20180305051722.19157-1-kys@exchange.microsoft.com> Reply-To: kys@microsoft.com X-CMAE-Envelope: MS4wfIlrs04KbsvJwBOada1kGsbtPgPRQJ9ul0P3tzLaVZW0c/mQWcoGq6l2eqkmi3yyh3PMiRTZvIQgE1y8KbT3tcbFtaLqcGw/M5HFBjHywGCsiUibZjvV K32h7Mi6ywTc0g7HHxjUR+lQE2Jq8lheV+QG7pT9NTd4fq1qgHr9seUiojyimL5JEodd6lzxpP1/FkmUhVSXCyzw95JUSLgNujx2KOXrS0PfhgZU/TfFb9iS P32Yo3u9m3O0lHmnNtZmuC6KisvAHuagY3hHIZLOvIoJzUmwmP9jB3+jCCrRQhUjgBx3dkVgKVqw45p7HrXxQ1isU+4/mLfrxHj3KVfuw4le9+vvDPt9GNSf WuU+ry8WiX9iBguCLAbaYic6UOT/WfvZpJjvIvp89WrQZxBL2ymNdS4or4U78ZT9ikGkbR/2f5DeM9pNtFJLF1WViLsTFsoYeHbyHsFR7AU0i+a/hJ+m4yCs oi5YEHa0NIxHfsk2Vi/5LdFNBnj2+I1OIpyrqsm9wlaKFe0+3jqTbJBkrMrMRva05WMafM4liSI9V2D7vR/hfMzMeaNB8FbGGgx93A== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Vitaly Kuznetsov Hyper-V balloon driver makes non-trivial calculations to convert Linux's representation of free/used memory to what Hyper-V host expects to see. Add a tracepoint to see what's being sent and where the data comes from. Signed-off-by: Vitaly Kuznetsov Signed-off-by: K. Y. Srinivasan --- drivers/hv/Makefile | 1 + drivers/hv/hv_balloon.c | 6 ++++++ drivers/hv/hv_trace_balloon.h | 48 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 55 insertions(+) create mode 100644 drivers/hv/hv_trace_balloon.h diff --git a/drivers/hv/Makefile b/drivers/hv/Makefile index 14c22786b519..a1eec7177c2d 100644 --- a/drivers/hv/Makefile +++ b/drivers/hv/Makefile @@ -4,6 +4,7 @@ obj-$(CONFIG_HYPERV_UTILS) += hv_utils.o obj-$(CONFIG_HYPERV_BALLOON) += hv_balloon.o CFLAGS_hv_trace.o = -I$(src) +CFLAGS_hv_balloon.o = -I$(src) hv_vmbus-y := vmbus_drv.o \ hv.o connection.o channel.o \ diff --git a/drivers/hv/hv_balloon.c b/drivers/hv/hv_balloon.c index 7514a32d0de4..b3e9f13f8bc3 100644 --- a/drivers/hv/hv_balloon.c +++ b/drivers/hv/hv_balloon.c @@ -34,6 +34,9 @@ #include +#define CREATE_TRACE_POINTS +#include "hv_trace_balloon.h" + /* * We begin with definitions supporting the Dynamic Memory protocol * with the host. @@ -1159,6 +1162,9 @@ static void post_status(struct hv_dynmem_device *dm) dm->num_pages_added - dm->num_pages_onlined : 0) + compute_balloon_floor(); + trace_balloon_status(status.num_avail, status.num_committed, + vm_memory_committed(), dm->num_pages_ballooned, + dm->num_pages_added, dm->num_pages_onlined); /* * If our transaction ID is no longer current, just don't * send the status. This can happen if we were interrupted diff --git a/drivers/hv/hv_trace_balloon.h b/drivers/hv/hv_trace_balloon.h new file mode 100644 index 000000000000..93082888aec3 --- /dev/null +++ b/drivers/hv/hv_trace_balloon.h @@ -0,0 +1,48 @@ +#undef TRACE_SYSTEM +#define TRACE_SYSTEM hyperv + +#if !defined(_HV_TRACE_BALLOON_H) || defined(TRACE_HEADER_MULTI_READ) +#define _HV_TRACE_BALLOON_H + +#include + +TRACE_EVENT(balloon_status, + TP_PROTO(u64 available, u64 committed, + unsigned long vm_memory_committed, + unsigned long pages_ballooned, + unsigned long pages_added, + unsigned long pages_onlined), + TP_ARGS(available, committed, vm_memory_committed, + pages_ballooned, pages_added, pages_onlined), + TP_STRUCT__entry( + __field(u64, available) + __field(u64, committed) + __field(unsigned long, vm_memory_committed) + __field(unsigned long, pages_ballooned) + __field(unsigned long, pages_added) + __field(unsigned long, pages_onlined) + ), + TP_fast_assign( + __entry->available = available; + __entry->committed = committed; + __entry->vm_memory_committed = vm_memory_committed; + __entry->pages_ballooned = pages_ballooned; + __entry->pages_added = pages_added; + __entry->pages_onlined = pages_onlined; + ), + TP_printk("available %lld, committed %lld; vm_memory_committed %ld;" + " pages_ballooned %ld, pages_added %ld, pages_onlined %ld", + __entry->available, __entry->committed, + __entry->vm_memory_committed, __entry->pages_ballooned, + __entry->pages_added, __entry->pages_onlined + ) + ); + +#undef TRACE_INCLUDE_PATH +#define TRACE_INCLUDE_PATH . +#undef TRACE_INCLUDE_FILE +#define TRACE_INCLUDE_FILE hv_trace_balloon +#endif /* _HV_TRACE_BALLOON_H */ + +/* This part must be outside protection */ +#include -- 2.15.1