[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250114-kcov-v1-3-004294b931a2@quicinc.com>
Date: Tue, 14 Jan 2025 13:34:33 +0800
From: "Jiao, Joey" <quic_jiangenj@...cinc.com>
To: Dmitry Vyukov <dvyukov@...gle.com>,
Andrey Konovalov
<andreyknvl@...il.com>,
Jonathan Corbet <corbet@....net>,
Andrew Morton
<akpm@...ux-foundation.org>,
Dennis Zhou <dennis@...nel.org>, Tejun Heo
<tj@...nel.org>,
Christoph Lameter <cl@...ux.com>,
Catalin Marinas
<catalin.marinas@....com>,
Will Deacon <will@...nel.org>
CC: <kasan-dev@...glegroups.com>, <linux-kernel@...r.kernel.org>,
<workflows@...r.kernel.org>, <linux-doc@...r.kernel.org>,
<linux-mm@...ck.org>, <linux-arm-kernel@...ts.infradead.org>,
<kernel@...cinc.com>
Subject: [PATCH 3/7] kcov: allow using KCOV_TRACE_UNIQ_[PC|EDGE] modes
together
KCOV_TRACE_UNIQ_PC and KCOV_TRACE_UNIQ_EDGE modes can be used
separately, and now they can be used together to simulate current
KCOV_TRACE_PC mode without sequence info.
Signed-off-by: Jiao, Joey <quic_jiangenj@...cinc.com>
---
kernel/kcov.c | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
diff --git a/kernel/kcov.c b/kernel/kcov.c
index 5a0ead92729294d99db80bb4e0f5b04c8b025dba..c04bbec9ac3186a5145240de8ac609ad8a7ca733 100644
--- a/kernel/kcov.c
+++ b/kernel/kcov.c
@@ -716,6 +716,8 @@ static int kcov_close(struct inode *inode, struct file *filep)
static int kcov_get_mode(unsigned long arg)
{
+ int mode = 0;
+
if (arg == KCOV_TRACE_PC)
return KCOV_MODE_TRACE_PC;
else if (arg == KCOV_TRACE_CMP)
@@ -724,12 +726,14 @@ static int kcov_get_mode(unsigned long arg)
#else
return -ENOTSUPP;
#endif
- else if (arg == KCOV_TRACE_UNIQ_PC)
- return KCOV_MODE_TRACE_UNIQ_PC;
- else if (arg == KCOV_TRACE_UNIQ_EDGE)
- return KCOV_MODE_TRACE_UNIQ_EDGE;
- else
+ if (arg & KCOV_TRACE_UNIQ_PC)
+ mode |= KCOV_MODE_TRACE_UNIQ_PC;
+ if (arg & KCOV_TRACE_UNIQ_EDGE)
+ mode |= KCOV_MODE_TRACE_UNIQ_EDGE;
+ if (!mode)
return -EINVAL;
+
+ return mode;
}
/*
--
2.47.1
Powered by blists - more mailing lists