Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp4008040imu; Mon, 14 Jan 2019 13:08:18 -0800 (PST) X-Google-Smtp-Source: ALg8bN7b1iC8RVdSQa7xIZaovoPx0HK1jX5CCoqEmVjkmreF/X/Z6ULW4+Bl27zImeYXDF24Ed/g X-Received: by 2002:a63:1321:: with SMTP id i33mr455384pgl.380.1547500098786; Mon, 14 Jan 2019 13:08:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547500098; cv=none; d=google.com; s=arc-20160816; b=TxXCPJpzmZAH3qAo1X4t3PdyUpvqMHSpe4eryHMIj1kWVUJ8/3Rnq8yd3cntm41eOC 3lFTB8I+j5EGkctklP+HG6RatQkeNsQ6pfOa8WLplF1cHU0BAH6nPLmC1HeLRf0qmmc6 y+JEhzIO7I0SpoDoPFTbCsxxcefkqB+w0nv5/kyYDVF7ulPPV9aPXV4vDfnvXifJPZCf p9EG7ntXvv1ri0J+FqeQZZLQr5Z3CFT/EfXRmciDbSx0RKV8IGvNg/6v7cFKsixGr4wF EhnVmMlu8K3HbLJ08H4N5wi9cejGHiDQ4BrtHA9ty7Ve4SCj+/buhq6XB0Vfpm6/fry6 FQ9A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=8yaTwDdPBhHbjdTxlPcCg5RXwpmur+DCR6kh9TUQ4zA=; b=cnBC34dOn0NBLk0RD+TfKVKBPIXduh1flZFNO4RRVP74t/gvCuVLDJRno6pIgqndJl XZ8OdMayYBAqgLMPSMJd8V25EVu75FBVCrE1eDWS9LoX2bxZ550Y9TKpfzHARRVF/kzp YkC0Ecl7ksYjqKkiEYukiEsEZFN1pIpRxYNEeW/989FBQK6Ll8dUPFnDSazhLOzaS/6K i2SqZILqhUgAGqdpjgJyFs/Fr9YhhEo17uN3gpV/DgwI4/MaQqwGIce/YUKSMIVPqq5y cMkAls+v+2ShgA2feABZaozSmcrXOZQscSX9pNjFTudson4Z2ugpoEEKLZJxEZ9Mu4jA Aa+w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@android.com header.s=20161025 header.b=ihFJBjL1; 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=pass (p=NONE sp=NONE dis=NONE) header.from=android.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o1si1247456pld.79.2019.01.14.13.08.02; Mon, 14 Jan 2019 13:08:18 -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; dkim=pass header.i=@android.com header.s=20161025 header.b=ihFJBjL1; 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=pass (p=NONE sp=NONE dis=NONE) header.from=android.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727090AbfANVF0 (ORCPT + 99 others); Mon, 14 Jan 2019 16:05:26 -0500 Received: from mail-wr1-f67.google.com ([209.85.221.67]:45804 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727006AbfANVFY (ORCPT ); Mon, 14 Jan 2019 16:05:24 -0500 Received: by mail-wr1-f67.google.com with SMTP id t6so480989wrr.12 for ; Mon, 14 Jan 2019 13:05:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=android.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=8yaTwDdPBhHbjdTxlPcCg5RXwpmur+DCR6kh9TUQ4zA=; b=ihFJBjL1NvFAieS4tTcIGIge+zojv5aTvNinL7MBVIN/95xZ7Q4VnVKhEn0xSPeH7n KPs27hc4XfdiUT+b8JK+oljt8StgpAxB4LAF5KmRWbfnlUxfGSKwMGqFDcXlNYm6uDaV leMCdxHqYAGlcXJBOyeQUbtj1bPZy/DUgliqIiPqmTmmeZf313utQX2sY5ViuC9pdDW9 VLZPdb2tX7Z5RyTCPhn8xaDnbDZV2ANXRZrGz+SSq5xW6miZ/UByYAE6gPIGFRQZm397 gaRhtTVTIZgFD1Zq6bvfow1WaLTE2OkVyaBiOIqJ1//tMQBwn45blhsX2L9wduivdNbW 50Zg== 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=8yaTwDdPBhHbjdTxlPcCg5RXwpmur+DCR6kh9TUQ4zA=; b=J0pWXO8K+fodse4ytkRFlb2n89k37XqzXlCM3RkVXG8pPeyTLTwVJYQDSLbRZ9fXYc DxeYny1iEuUjhnAeyM6f04FmNaO72qa6oiIkOFy2hPJo2wxarzYrFdcFR+FGsrN5xeZr Umdl/Gyx+ace56ribgRz3K0nmiSxjeyFP9/3PzHSCJiPk8cws5vNDyNotsIdbDNq3gQt sEjsiiUykx6iS0VT4H6OyPTJNYaIkTcjd1Tb3reonFdoLS/GizyS0m+5MdLhOf97CHRW 8GXmG5Kly3CSBO6XpU5TCt8hGpfM6y8Wku+iJa6JOmb3I+AlxURiT9G0rNpWP0aU6QPa glgg== X-Gm-Message-State: AJcUukf89iPS0B+ChsLqiz5QbwvHRR0QYhk14RZyhx/2tUXfyuruPQ+A bbY+KDlNTcnqziEjcZ6qrPXk2w== X-Received: by 2002:adf:e407:: with SMTP id g7mr252144wrm.277.1547499921784; Mon, 14 Jan 2019 13:05:21 -0800 (PST) Received: from trong0.mtv.corp.google.com ([2620:0:1000:1601:c43f:8c1b:f6ef:3dce]) by smtp.gmail.com with ESMTPSA id s1sm106981548wro.9.2019.01.14.13.05.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 14 Jan 2019 13:05:21 -0800 (PST) From: Tri Vo To: oberpar@linux.ibm.com Cc: ghackmann@android.com, ndesaulniers@google.com, linux-kernel@vger.kernel.org, kernel-team@android.com, Tri Vo , Trilok Soni , Prasad Sodagudi Subject: [PATCH 3/4] gcov: clang: link/unlink profiling data set. Date: Mon, 14 Jan 2019 13:04:25 -0800 Message-Id: <20190114210426.177543-4-trong@android.com> X-Mailer: git-send-email 2.20.1.97.g81188d93c3-goog In-Reply-To: <20190114210426.177543-1-trong@android.com> References: <20190114210426.177543-1-trong@android.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Nick Desaulniers gcov.h defines an interface to access gcov_info data. Add Clang implementation of gcov_info_link/gcov_info_unlink interfaces. Signed-off-by: Nick Desaulniers Signed-off-by: Tri Vo Tested-by: Trilok Soni Tested-by: Prasad Sodagudi Tested-by: Tri Vo --- kernel/gcov/clang.c | 33 ++++++++++++++++++++++++++++----- 1 file changed, 28 insertions(+), 5 deletions(-) diff --git a/kernel/gcov/clang.c b/kernel/gcov/clang.c index b00795d28137..ea42deb852f7 100644 --- a/kernel/gcov/clang.c +++ b/kernel/gcov/clang.c @@ -77,6 +77,7 @@ struct gcov_fn_info { u32 num_counters; u64 *counters; + const char *function_name; }; static struct gcov_info *current_info; @@ -124,7 +125,7 @@ void llvm_gcda_emit_function(u32 ident, const char *function_name, if (!info) { pr_warn_ratelimited("failed to allocate gcov function info for %s\n", - function_name); + function_name ?: "UNKNOWN"); return; } @@ -133,6 +134,8 @@ void llvm_gcda_emit_function(u32 ident, const char *function_name, info->checksum = func_checksum; info->use_extra_checksum = use_extra_checksum; info->cfg_checksum = cfg_checksum; + if (function_name) + info->function_name = kstrdup(function_name, GFP_KERNEL); list_add_tail(&info->head, ¤t_info->functions); } @@ -193,6 +196,26 @@ struct gcov_info *gcov_info_next(struct gcov_info *info) return list_next_entry(info, head); } +/** + * gcov_info_link - link/add profiling data set to the list + * @info: profiling data set + */ +void gcov_info_link(struct gcov_info *info) +{ + list_add_tail(&info->head, &clang_gcov_list); +} + +/** + * gcov_info_unlink - unlink/remove profiling data set from the list + * @prev: previous profiling data set + * @info: profiling data set + */ +void gcov_info_unlink(struct gcov_info *prev, struct gcov_info *info) +{ + if (prev) + list_del(&prev->head); +} + /* Symbolic links to be created for each profiling data file. */ const struct gcov_link gcov_link[] = { { OBJ_TREE, "gcno" }, /* Link to .gcno file in $(objtree). */ @@ -256,8 +279,8 @@ static struct gcov_fn_info *gcov_fn_info_dup(struct gcov_fn_info *fn) return NULL; INIT_LIST_HEAD(&fn_dup->head); - fn_dup->name = kstrdup(fn->name, GFP_KERNEL); - if (!fn_dup->name) + fn_dup->function_name = kstrdup(fn->function_name, GFP_KERNEL); + if (!fn_dup->function_name) goto err_name; fn_dup->counters = kmemdup(fn->counters, @@ -269,7 +292,7 @@ static struct gcov_fn_info *gcov_fn_info_dup(struct gcov_fn_info *fn) return fn_dup; err_counters: - kfree(fn_dup->name); + kfree(fn_dup->function_name); err_name: kfree(fn_dup); return NULL; @@ -317,7 +340,7 @@ void gcov_info_free(struct gcov_info *info) struct gcov_fn_info *fn, *tmp; list_for_each_entry_safe(fn, tmp, &info->functions, head) { - kfree(fn->name); + kfree(fn->function_name); kfree(fn->counters); list_del(&fn->head); kfree(fn); -- 2.20.1.97.g81188d93c3-goog