From: Alexander Lochmann <info@alexander-lochmann.de>
To: Andrey Konovalov <andreyknvl@gmail.com>
Cc: Dmitry Vyukov <dvyukov@google.com>,
Andrey Konovalov <andreyknvl@google.com>,
Jonathan Corbet <corbet@lwn.net>,
Randy Dunlap <rdunlap@infradead.org>,
Andrew Klychkov <andrew.a.klychkov@gmail.com>,
Miguel Ojeda <ojeda@kernel.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Andrew Morton <akpm@linux-foundation.org>,
Jakub Kicinski <kuba@kernel.org>,
Aleksandr Nogikh <nogikh@google.com>,
Wei Yongjun <weiyongjun1@huawei.com>,
Maciej Grochowski <maciej.grochowski@pm.me>,
kasan-dev@googlegroups.com, linux-doc@vger.kernel.org,
LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCHv3] Introduced new tracing mode KCOV_MODE_UNIQUE.
Date: Sat, 18 Sep 2021 22:22:17 +0200 [thread overview]
Message-ID: <aaee2292-022b-d99e-9fa9-b48ad5c2fe92@alexander-lochmann.de> (raw)
In-Reply-To: <CA+fCnZcTi=QLGC_LCdhs+fMrxkqX66kXEuM5ewOmjVjifKzUrw@mail.gmail.com>
[-- Attachment #1.1: Type: text/plain, Size: 2174 bytes --]
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
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]
prev parent reply other threads:[~2021-09-18 20:30 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-26 20:51 Alexander Lochmann
2021-03-27 10:37 ` Greg Kroah-Hartman
2021-03-27 14:56 ` Andrey Konovalov
2021-04-16 8:42 ` Dmitry Vyukov
2021-04-17 19:46 ` Andrey Konovalov
2021-09-18 20:22 ` Alexander Lochmann [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aaee2292-022b-d99e-9fa9-b48ad5c2fe92@alexander-lochmann.de \
--to=info@alexander-lochmann.de \
--cc=akpm@linux-foundation.org \
--cc=andrew.a.klychkov@gmail.com \
--cc=andreyknvl@gmail.com \
--cc=andreyknvl@google.com \
--cc=corbet@lwn.net \
--cc=dvyukov@google.com \
--cc=gregkh@linuxfoundation.org \
--cc=kasan-dev@googlegroups.com \
--cc=kuba@kernel.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=maciej.grochowski@pm.me \
--cc=nogikh@google.com \
--cc=ojeda@kernel.org \
--cc=rdunlap@infradead.org \
--cc=weiyongjun1@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®