All of lore.kernel.org
 help / color / mirror / Atom feed
From: Valentin Schneider <valentin.schneider@arm.com>
To: Alexey Dobriyan <adobriyan@gmail.com>
Cc: mingo@redhat.com, peterz@infradead.org,
	linux-kernel@vger.kernel.org, rcu@vger.kernel.org,
	linux-block@vger.kernel.org, dm-devel@redhat.com,
	axboe@kernel.dk, aarcange@redhat.com
Subject: Re: [PATCH] sched: make struct task_struct::state 32-bit
Date: Wed, 4 Sep 2019 18:48:49 +0100	[thread overview]
Message-ID: <f0328a66-ca9f-974d-3799-e73308fb1d34@arm.com> (raw)
In-Reply-To: <a43fe392-bd6a-71f5-8611-c6b764ba56c3@arm.com>

On 04/09/2019 13:07, Valentin Schneider wrote:
> [...]
> Baby steps...


There's something regarding coccinelle disjunctions that just can't grasp,
and this also fails to recognize "current" as being "struct task_struct*".

Once I fix these, it's "just" a matter of finding out how to write a rule
for layered calls (e.g. __kthread_bind() -> __kthread_bind_mask() ->
wait_task_inactive()), and we should be close to having something somewhat
usable.

---
virtual patch
virtual report

@state_access@
identifier func;
struct task_struct *p;
identifier state_var;
position fpos;
position epos;
@@

func(...)@fpos
{
	<...
(
  p->state & state_var@epos
|
  p->state | state_var@epos
|
  p->state < state_var@epos
|
  p->state > state_var@epos
|
  state_var@epos = p->state
// For some reason adding this disjunction gives us more matches, but causes
// some to go away :/
// |
//   p->state == state_var@epos
|
  p->state != state_var@epos
)
	...>
}

@depends on patch@
identifier fn = state_access.func;
identifier state_var = state_access.state_var;
@@

fn(...,
- long state_var
+ int state_var
,...)
{
	...
}

// Should be merged in the above but can't get disjunction to work
@depends on patch@
identifier fn = state_access.func;
identifier state_var = state_access.state_var;
@@

fn(...,
- unsigned long state_var
+ unsigned int state_var
,...)
{
	...
}

// Is it possible to match without semicolons? :/
@depends on patch@
identifier state_var = state_access.state_var;
expression E;
@@

(
- long state_var;
+ int state_var;
|
- long state_var = E;
+ int state_var = E;
)

@script:python depends on report@
fp << state_access.fpos;
ep << state_access.epos;
@@
cocci.print_main("Func at", fp)
cocci.print_main("Expr at", ep)

  reply	other threads:[~2019-09-04 17:48 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-02 21:05 [PATCH] sched: make struct task_struct::state 32-bit Alexey Dobriyan
2019-09-02 23:02 ` Valentin Schneider
2019-09-03 16:23   ` Alexey Dobriyan
2019-09-03 16:31     ` Valentin Schneider
2019-09-03  6:51 ` [dm-devel] " Christoph Hellwig
2019-09-03  7:13   ` Peter Zijlstra
2019-09-03 17:29 ` Valentin Schneider
2019-09-03 18:19   ` Alexey Dobriyan
2019-09-03 21:51     ` Valentin Schneider
2019-09-04 12:07       ` Valentin Schneider
2019-09-04 17:48         ` Valentin Schneider [this message]
2019-09-05 15:51         ` Markus Elfring
2019-09-05 16:52           ` Valentin Schneider
2019-09-23 10:26             ` Valentin Schneider
2019-09-23 10:34               ` Julia Lawall
2019-09-23 11:26                 ` Valentin Schneider
2019-09-23 11:43                   ` Julia Lawall
2019-09-23 13:23                     ` Valentin Schneider
2019-09-24  8:28                   ` Markus Elfring
2019-09-24  8:07               ` Markus Elfring
2019-09-04  9:43     ` [PATCH] " David Laight
2019-09-04 10:25       ` Valentin Schneider

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=f0328a66-ca9f-974d-3799-e73308fb1d34@arm.com \
    --to=valentin.schneider@arm.com \
    --cc=aarcange@redhat.com \
    --cc=adobriyan@gmail.com \
    --cc=axboe@kernel.dk \
    --cc=dm-devel@redhat.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=rcu@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.