msm: ipc_logging: add client version support

If clients use custom serialization functions, then they may need to
define a version for deserialization support for log extraction.

Add client version support.

Change-Id: Id135f06d4142de39275b5d0caab88708d5496b5e
Signed-off-by: Eric Holmberg <eholmber@codeaurora.org>
This commit is contained in:
Eric Holmberg
2014-10-13 11:09:59 -06:00
parent acbfeb9fca
commit adffac8a9b
15 changed files with 60 additions and 26 deletions
@@ -149,6 +149,7 @@ Kernel-Space Interface APIs
*
* @max_num_pages: Number of pages of logging space required (max. 10)
* @mod_name : Name of the directory entry under DEBUGFS
* @user_version : Version number of user-defined message formats
*
* returns reference to context on success, NULL on failure
*/
+3 -2
View File
@@ -1,4 +1,4 @@
/* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved.
/* Copyright (c) 2011-2014, The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
@@ -2578,7 +2578,8 @@ static int __init bam_dmux_init(void)
}
#endif
bam_ipc_log_txt = ipc_log_context_create(BAM_IPC_LOG_PAGES, "bam_dmux");
bam_ipc_log_txt = ipc_log_context_create(BAM_IPC_LOG_PAGES, "bam_dmux",
0);
if (!bam_ipc_log_txt) {
pr_err("%s : unable to create IPC Logging Context", __func__);
}
@@ -1,4 +1,4 @@
/* Copyright (c) 2012-2013, The Linux Foundation. All rights reserved.
/* Copyright (c) 2012-2014, The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
@@ -48,10 +48,12 @@ struct decode_context {
*
* @max_num_pages: Number of pages of logging space required (max. 10)
* @mod_name : Name of the directory entry under DEBUGFS
* @user_version : Version number of user-defined message formats
*
* returns context id on success, NULL on failure
*/
void *ipc_log_context_create(int max_num_pages, const char *modname);
void *ipc_log_context_create(int max_num_pages, const char *modname,
uint16_t user_version);
/*
* msg_encode_start: Start encoding a log message
@@ -208,7 +210,7 @@ int ipc_log_context_destroy(void *ctxt);
#else
static inline void *ipc_log_context_create(int max_num_pages,
const char *modname)
const char *modname, uint16_t user_version)
{ return NULL; }
static inline void msg_encode_start(struct encode_context *ectxt,
+12 -1
View File
@@ -568,8 +568,18 @@ static void *get_deserialization_func(struct ipc_log_context *ilctxt,
return NULL;
}
/**
* ipc_log_context_create: Create a debug log context
* Should not be called from atomic context
*
* @max_num_pages: Number of pages of logging space required (max. 10)
* @mod_name : Name of the directory entry under DEBUGFS
* @user_version : Version number of user-defined message formats
*
* returns context id on success, NULL on failure
*/
void *ipc_log_context_create(int max_num_pages,
const char *mod_name)
const char *mod_name, uint16_t user_version)
{
struct ipc_log_context *ctxt;
struct ipc_log_page *pg = NULL;
@@ -603,6 +613,7 @@ void *ipc_log_context_create(int max_num_pages,
list_add_tail(&pg->hdr.list, &ctxt->page_list);
spin_unlock_irqrestore(&ctxt->ipc_log_context_lock, flags);
}
ctxt->user_version = user_version;
ctxt->first_page = get_first_page(ctxt);
ctxt->last_page = pg;
ctxt->write_page = ctxt->first_page;
+19
View File
@@ -30,7 +30,26 @@ struct ipc_log_page {
char data[PAGE_SIZE - sizeof(struct ipc_log_page_header)];
};
/**
* struct ipc_log_context - main logging context
*
* @user_version: Version number for user-defined messages
* @list: List of log contexts (struct ipc_log_context)
* @page_list: List of log pages (struct ipc_log_page)
* @first_page: First page in list of logging pages
* @last_page: Last page in list of logging pages
* @write_page: Current write page
* @read_page: Current read page (for internal reads)
* @write_avail: Number of bytes available to write in all pages
* @dent: Debugfs node for run-time log extraction
* @dfunc_info_list: List of deserialization functions
* @ipc_log_context_lock: Lock for entire structure
* @read_avail: Completed when new data is added to the log
*/
struct ipc_log_context {
uint16_t user_version;
/* add local data structures after this point */
struct list_head list;
struct list_head page_list;
struct ipc_log_page *first_page;
+2 -2
View File
@@ -1,4 +1,4 @@
/* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved.
/* Copyright (c) 2011-2014, The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
@@ -3330,7 +3330,7 @@ static int __init msm_ipc_router_init(void)
msm_ipc_router_debug_mask |= SMEM_LOG;
ipc_rtr_log_ctxt = ipc_log_context_create(IPC_RTR_LOG_PAGES,
"ipc_router");
"ipc_router", 0);
if (!ipc_rtr_log_ctxt)
pr_err("%s: Unable to create IPC logging for IPC RTR",
__func__);
+3 -3
View File
@@ -1,4 +1,4 @@
/* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved.
/* Copyright (c) 2011-2014, The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
@@ -626,13 +626,13 @@ void msm_ipc_router_ipc_log_init(void)
{
ipc_req_resp_log_txt =
ipc_log_context_create(REQ_RESP_IPC_LOG_PAGES,
"ipc_rtr_req_resp");
"ipc_rtr_req_resp", 0);
if (!ipc_req_resp_log_txt) {
pr_err("%s: Unable to create IPC logging for Req/Resp",
__func__);
}
ipc_ind_log_txt =
ipc_log_context_create(IND_IPC_LOG_PAGES, "ipc_rtr_ind");
ipc_log_context_create(IND_IPC_LOG_PAGES, "ipc_rtr_ind", 0);
if (!ipc_ind_log_txt) {
pr_err("%s: Unable to create IPC logging for Indications",
__func__);
+3 -3
View File
@@ -1,7 +1,7 @@
/* arch/arm/mach-msm/smd.c
*
* Copyright (C) 2007 Google, Inc.
* Copyright (c) 2008-2013, The Linux Foundation. All rights reserved.
* Copyright (c) 2008-2014, The Linux Foundation. All rights reserved.
* Author: Brian Swetland <swetland@google.com>
*
* This software is licensed under the terms of the GNU General Public
@@ -3340,13 +3340,13 @@ int __init msm_smd_init(void)
if (registered)
return 0;
smd_log_ctx = ipc_log_context_create(NUM_LOG_PAGES, "smd");
smd_log_ctx = ipc_log_context_create(NUM_LOG_PAGES, "smd", 0);
if (!smd_log_ctx) {
pr_err("%s: unable to create SMD logging context\n", __func__);
msm_smd_debug_mask = 0;
}
smsm_log_ctx = ipc_log_context_create(NUM_LOG_PAGES, "smsm");
smsm_log_ctx = ipc_log_context_create(NUM_LOG_PAGES, "smsm", 0);
if (!smsm_log_ctx) {
pr_err("%s: unable to create SMSM logging context\n", __func__);
msm_smd_debug_mask = 0;
+2 -2
View File
@@ -1,4 +1,4 @@
/* Copyright (c) 2008-2013, The Linux Foundation. All rights reserved.
/* Copyright (c) 2008-2014, The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
@@ -1123,7 +1123,7 @@ static int __init smd_pkt_init(void)
INIT_DELAYED_WORK(&loopback_work, loopback_probe_worker);
smd_pkt_ilctxt = ipc_log_context_create(SMD_PKT_IPC_LOG_PAGE_CNT,
"smd_pkt");
"smd_pkt", 0);
D_STATUS("SMD Packet Port Driver Initialized.\n");
return 0;
+2 -2
View File
@@ -1,7 +1,7 @@
/* arch/arm/mach-msm/smd_tty.c
*
* Copyright (C) 2007 Google, Inc.
* Copyright (c) 2009-2013, The Linux Foundation. All rights reserved.
* Copyright (c) 2009-2014, The Linux Foundation. All rights reserved.
* Author: Brian Swetland <swetland@google.com>
*
* This software is licensed under the terms of the GNU General Public
@@ -740,7 +740,7 @@ static struct notifier_block smd_tty_pm_nb = {
static void smd_tty_log_init(void)
{
smd_tty_log_ctx = ipc_log_context_create(SMD_TTY_LOG_PAGES,
"smd_tty");
"smd_tty", 0);
if (!smd_tty_log_ctx)
pr_err("%s: Unable to create IPC log", __func__);
}
+2 -2
View File
@@ -1,4 +1,4 @@
/* Copyright (c) 2013, The Linux Foundation. All rights reserved.
/* Copyright (c) 2013-2014, The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
@@ -1370,7 +1370,7 @@ int __init msm_smem_init(void)
registered = true;
smem_ipc_log_ctx = ipc_log_context_create(NUM_LOG_PAGES, "smem");
smem_ipc_log_ctx = ipc_log_context_create(NUM_LOG_PAGES, "smem", 0);
if (!smem_ipc_log_ctx) {
pr_err("%s: unable to create logging context\n", __func__);
msm_smem_debug_mask = 0;
+2 -2
View File
@@ -1,6 +1,6 @@
/* arch/arm/mach-msm/smp2p.c
*
* Copyright (c) 2013, The Linux Foundation. All rights reserved.
* Copyright (c) 2013-2014, The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
@@ -1829,7 +1829,7 @@ static int __init msm_smp2p_init(void)
in_list[i].smem_edge_in = NULL;
}
log_ctx = ipc_log_context_create(NUM_LOG_PAGES, "smp2p");
log_ctx = ipc_log_context_create(NUM_LOG_PAGES, "smp2p", 0);
if (!log_ctx)
SMP2P_ERR("%s: unable to create log context\n", __func__);
+1 -1
View File
@@ -1293,7 +1293,7 @@ static int __devinit ngd_slim_probe(struct platform_device *pdev)
/* Create IPC log context */
dev->ipc_slimbus_log = ipc_log_context_create(IPC_SLIMBUS_LOG_PAGES,
dev_name(dev->dev));
dev_name(dev->dev), 0);
if (!dev->ipc_slimbus_log)
dev_err(&pdev->dev, "error creating ipc_logging context\n");
else {
+2 -2
View File
@@ -1,6 +1,6 @@
/* drivers/tty/n_smux.c
*
* Copyright (c) 2012-2013, The Linux Foundation. All rights reserved.
* Copyright (c) 2012-2014, The Linux Foundation. All rights reserved.
*
* This software is licensed under the terms of the GNU General Public
* License version 2, as published by the Free Software Foundation, and
@@ -3905,7 +3905,7 @@ static int __init smux_init(void)
return ret;
}
log_ctx = ipc_log_context_create(1, "smux");
log_ctx = ipc_log_context_create(1, "smux", 0);
if (!log_ctx) {
SMUX_ERR("%s: unable to create log context\n", __func__);
disable_ipc_logging = 1;
+1 -1
View File
@@ -3095,7 +3095,7 @@ static int __init msm_serial_hs_init(void)
int ret;
ipc_msm_hs_log_ctxt = ipc_log_context_create(IPC_MSM_HS_LOG_PAGES,
"msm_serial_hs");
"msm_serial_hs", 0);
if (!ipc_msm_hs_log_ctxt)
MSM_HS_WARN("%s: error creating logging context", __func__);