Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp617503ybn; Wed, 25 Sep 2019 05:15:41 -0700 (PDT) X-Google-Smtp-Source: APXvYqyii/g9KNuxVMvADIYabyHaWdrgEdy17TD9MgZ7/7HvC8QlQ9FAxcWHzRrpR5siSuthjFAK X-Received: by 2002:a05:6000:1632:: with SMTP id v18mr9252073wrb.233.1569413741394; Wed, 25 Sep 2019 05:15:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569413741; cv=none; d=google.com; s=arc-20160816; b=DwfIoMQ8vYoxUaewyc9SlXccG+sdhq6YDUyCfjSiVOl6jj2ZR8SBDCDUdqZvA1taeo B0aqkWewoLrPdUekbOaMw85V/LgHlMfwSsa/3tb5JOLl9nkL5+Fl8Jy+xnSrhUrU9b3U w+Qp8viYx1K1hTrz9UhG728dD12pS/KrjXW5IVo84FOE2Q69SdBPW3O3NkTAF5Jz3rRH B1Y+cMDSU37LYycOvT+y+dKQ4XFV2yNA421ZTNq7vyXN6LUF1hMpiXJEzbHP90xHlahv lk7POYIzi5vkafv71MFVsgfhuY1yAdQMmsAQT37MeEGmapWI+LN8J61/4yrCzsYPd/sP bkZA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date; bh=mA3Oz3Rqg4CHH2rae26ezuo0tPJNJt4En3MW+ibDGRM=; b=w3GTngA9oXSlNRoNTgl5HUXBe+L60YbLk3tBvXjvRvrtJmZeCv8KJRvqIN57yU5Wug bnCOMO43mzOGdfH7Q81qTsMw0kF7YT7ry+nZmPFBFZyHFAwEprZFntt3pLHLE8mfMxyC 7AFNivs8euit+RuQ2tR8Isl6qr1sNOObljIYYcNDJyR+ByGBoj3yMQfWtchBmr2yg1C/ 924bZPrpin89YiGTKHMZ+gldoA6H+1WHk60B0udeEmeA5Ir2U/QnNJVPBvZJnjbmLVTB QGcw1zwpJG6lw0bSD5pwP5Lk0RjSLWQ+1IXArUaIfK/N+UzVFhb7BGM2tNHNOA76epw4 vlEw== 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 f33si3165782edb.281.2019.09.25.05.15.16; Wed, 25 Sep 2019 05:15:41 -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 S2436709AbfIWLnp (ORCPT + 99 others); Mon, 23 Sep 2019 07:43:45 -0400 Received: from mail2-relais-roc.national.inria.fr ([192.134.164.83]:35308 "EHLO mail2-relais-roc.national.inria.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726146AbfIWLnp (ORCPT ); Mon, 23 Sep 2019 07:43:45 -0400 X-IronPort-AV: E=Sophos;i="5.64,539,1559512800"; d="scan'208";a="402978736" Received: from unknown (HELO hadrien) ([65.39.69.237]) by mail2-relais-roc.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 23 Sep 2019 13:43:42 +0200 Date: Mon, 23 Sep 2019 13:43:41 +0200 (CEST) From: Julia Lawall X-X-Sender: julia@hadrien To: Valentin Schneider cc: Markus Elfring , Alexey Dobriyan , dm-devel@redhat.com, linux-block@vger.kernel.org, rcu@vger.kernel.org, linux-kernel@vger.kernel.org, Andrea Arcangeli , Ingo Molnar , Jens Axboe , Peter Zijlstra Subject: Re: sched: make struct task_struct::state 32-bit In-Reply-To: Message-ID: References: <7e3e784c-e8e6-f9ba-490f-ec3bf956d96b@web.de> <0c4dcb91-4830-0013-b8c6-64b9e1ce47d4@arm.com> <32d65b15-1855-e7eb-e9c4-81560fab62ea@arm.com> User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > >> // FIXME: match functions that do something with state_var underneath? > >> // How to do recursive rules? > > > > You want to look at the definitions of called functions? Coccinelle > > doesn't really support that, but there are hackish ways to add that. How > > many function calls would you expect have to be unrolled? > > > > I wouldn't expect more than a handful (~5). I suppose this has to do with > injecting some Python/Ocaml code? I have some examples bookmarked but > haven't gotten to stare at them long enough. You can look at iteration.cocci, but it's a bit complex. You could match definitions of functions that do what you are interested in, then store the names of these functions in a list (python/ocaml), and then look for calls to those functions. Something like identifier fn : script:ocaml() { in_my_list fn }; > >> // Fixup local variables > >> @depends on patch && state_access@ > >> identifier state_var = state_access.state_var; > >> @@ > >> ( > >> - long > >> + int > >> | > >> - unsigned long > >> + unsigned int > >> ) > >> state_var; > >> > >> // Fixup function parameters > >> @depends on patch && state_access@ > >> identifier fn; > >> identifier state_var = state_access.state_var; > >> @@ > >> > >> fn(..., > >> - long state_var > >> + int state_var > >> ,...) > >> { > >> ... > >> } > >> > >> // FIXME: find a way to squash that with the above? > > > > I think that you can make a disjunction on a function parameter > > > > fn(..., > > ( > > - T1 x1 > > + T2 x2 > > | > > - T3 x3 > > + T4 x4 > > ) > > , ...) { ... } > > > > My attempt at this gives me "minus: parse error", which is why I went > with the split. OK, the split is probably not a major catastrophe... julia > > Something simple like this works: > --- > virtual patch > virtual report > > @@ > identifier fn; > identifier p; > @@ > > fn(..., > - long > + int > p > ,...) > { > ... > } > --- > > but this doesn't: > --- > virtual patch > virtual report > > @@ > identifier fn; > identifier p; > @@ > > fn(..., > ( > - long p > + int p > | > - unsigned long p > + unsigned int p > ) > ,...) > { > ... > } > --- > > > julia > > >