Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp994196ybe; Wed, 4 Sep 2019 10:51:08 -0700 (PDT) X-Google-Smtp-Source: APXvYqxLPOaOU8JxZFDG+LYMjuZfNOHAfcdzPjZP1SRfbTIA4KipMlHnUSE8T0SJIa9He82kBngT X-Received: by 2002:a17:90a:b292:: with SMTP id c18mr6251438pjr.1.1567619468828; Wed, 04 Sep 2019 10:51:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567619468; cv=none; d=google.com; s=arc-20160816; b=vL/y+AGuIAWk6YBJqQ9ytOYi/Ug8t1rc5UK9HFmrOAHBsQs8S1f9ugdB6Fd7/G/b1f UDM7FFvWKg8OAXwrF41cGttzfrFQjIgG93fiEOGPaqcextADUgHaiEny4ukzyeeRrW2X wTCLpo7bsmhviYA7VUV0uvnrQpIDN494oqQ/h9i+LboCUWd6+up6hP3wDIHeFKaFTiML WnlGEQk66DF5HZD1hk1XHhJaiKW8eVN+6gKOxjB40BgAZSHH3NwNPfqK9oSG+IIdS+Hu wyPpEGAo6rej9C5J0BzSv4JfgYitBmkVde/GA2GnORVNSWPm4zPpUOi4gWFO/fE8EyCN 95Uw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:references:cc:to:from:subject; bh=FoirOpCXwqUUrXX8zJQ2OmWyk/nrz66KDQ+q2IcmM2E=; b=M2OpINYK09GxV2ciqOY5N1AvdYmaEqKZINK28+TEBYs0oApqUVeRkMMu9MgTSZMys4 zaS0oA8P9BDiyCBbLZXPvw1G1KxTiR9qx15TmxXKKAxVsEhTeGaY4mILaEyyiv3iPxCb 74RVXsaV+D6/l/eBbgF24UBNSo4kY8t2FBXLVWcwrWFvCUk01eNNx/Tpon5wwW7zcXkg Oxjmc1ond6aA2BNMH+wL+wHdPDyE4qMTfAW10S5C8+smLcgNl5vQhIHUhfg9May+daME LYTvUG6s1YK1ZXb4iUfMoBg2emNMAv3xHEPgG6VagpYznIa1P5qxXdgG5fdu8o3VL02u wL5g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v5si9283343pfb.262.2019.09.04.10.50.52; Wed, 04 Sep 2019 10:51:08 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731926AbfIDRsw (ORCPT + 99 others); Wed, 4 Sep 2019 13:48:52 -0400 Received: from foss.arm.com ([217.140.110.172]:59344 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729594AbfIDRsw (ORCPT ); Wed, 4 Sep 2019 13:48:52 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 96343337; Wed, 4 Sep 2019 10:48:51 -0700 (PDT) Received: from [10.1.194.37] (e113632-lin.cambridge.arm.com [10.1.194.37]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 76BA03F67D; Wed, 4 Sep 2019 10:48:50 -0700 (PDT) Subject: Re: [PATCH] sched: make struct task_struct::state 32-bit From: Valentin Schneider To: Alexey Dobriyan 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 References: <20190902210558.GA23013@avx2> <20190903181920.GA22358@avx2> <92ead22e-0580-c720-1a29-7db79d76f7d7@arm.com> Message-ID: Date: Wed, 4 Sep 2019 18:48:49 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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)