lkml.org 
[lkml]   [2021]   [Sep]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCHv3] Introduced new tracing mode KCOV_MODE_UNIQUE.
Date


On 27.03.21 15:56, Andrey Konovalov wrote:
>
>> @@ -213,9 +223,10 @@ static void notrace write_comp_data(u64 type, u64 arg1, u64 arg2, u64 ip)
>> struct task_struct *t;
>> u64 *area;
>> u64 count, start_index, end_pos, max_pos;
>> + unsigned int mode;
>>
>> t = current;
>> - if (!check_kcov_mode(KCOV_MODE_TRACE_CMP, t))
>> + if (!check_kcov_mode(KCOV_MODE_TRACE_CMP, t, &mode))
>> return;
>
> mode isn't used here, right? No need for it then.
>
No, it's not. However, check_kcov_mode() needs it. Dmitry suggested
passing a pointer to check_kcov_mode(), and let the optimizer do the rest.
>> @@ -562,12 +576,14 @@ static int kcov_ioctl_locked(struct kcov *kcov, unsigned int cmd,
>> {
>> struct task_struct *t;
>> unsigned long size, unused;
>> - int mode, i;
>> + int mode, i, text_size, ret = 0;
>> struct kcov_remote_arg *remote_arg;
>> struct kcov_remote *remote;
>> unsigned long flags;
>>
>> switch (cmd) {
>> + case KCOV_INIT_UNIQUE:
>> + fallthrough;
>> case KCOV_INIT_TRACE:
>> /*
>> * Enable kcov in trace mode and setup buffer size.
>> @@ -581,11 +597,42 @@ static int kcov_ioctl_locked(struct kcov *kcov, unsigned int cmd,
>> * that must not overflow.
>> */
>> size = arg;
>> - if (size < 2 || size > INT_MAX / sizeof(unsigned long))
>> - return -EINVAL;
>> - kcov->size = size;
>> - kcov->mode = KCOV_MODE_INIT;
>> - return 0;
>> + if (cmd == KCOV_INIT_UNIQUE) {
>
> Let's put this code under KCOV_INIT_UNIQUE in the switch. This
> internal if only saves duplicating two lines of code, which isn't
> worth it.
So. Shall I skip the fallthrough and move 'my' code upwards?

--
Alexander Lochmann PGP key: 0xBC3EF6FD
Heiliger Weg 72 phone: +49.231.28053964
D-44141 Dortmund mobile: +49.151.15738323

[unhandled content-type:application/pgp-signature]
\
 
 \ /
  Last update: 2021-09-18 22:31    [W:0.088 / U:0.564 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site