Received: by 2002:a05:6358:c692:b0:131:369:b2a3 with SMTP id fe18csp4312857rwb; Mon, 31 Jul 2023 05:12:19 -0700 (PDT) X-Google-Smtp-Source: APBJJlFmIQQozIIi3QOc7eX7gJkWZHpgv3526QcGitSYurff11uqT6/TSGRYNh3m4OR/aZ6se9Nv X-Received: by 2002:a17:906:9bf0:b0:99b:40b5:1c3b with SMTP id de48-20020a1709069bf000b0099b40b51c3bmr7683489ejc.57.1690805538972; Mon, 31 Jul 2023 05:12:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690805538; cv=none; d=google.com; s=arc-20160816; b=pKubewxfbJYnPdvy6wv/+a9lsFi+/9eVp4G3GGh/RG0b/fYG5YJCg1abQWjR7xPhGI qsS0R7QB4Y+Z5Z2nNcGD8I7e0vFCg2QQax8AuU62ihifh2nQkjxMPxGSxFGWZd5kX6Pt CI2l7IZ4MPCV2vkhlz2MyDABsr/9/FU30LsmGUAaEatLNScyQEkI1W3EMIKvksiex28E M3nRTsLG8X23LDMIu2JDb///eoHdeRgYle4JOspM5LUCbwPNAd0XoyACN3VJrr5dVEV6 zcAVn7dQ6cJrEUkcmcyM2/bM0NfM1S+LaTxQiukXjldxa35G5sxvpqyyYsNM9O9NiMX7 bVBQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from:dkim-signature; bh=V5VMLpHOhxXlUy0bWDF9kXZ97zc/VghMcLBrU5Ym92c=; fh=JkWgNTbBOLvkotPfZWBDWUDvM8wYpK2tPTyEa398kR4=; b=G26XtBZXx81c3oPeePbq4bsypVQUUxzAsaaCG4nqOpfVOTFs4zeEVK7Tf3+/5DzlRp Y5MfiR55TFgIvJTMe5Mj0gglzuS5YtAC/V9TZvGP/1I4EGGkR1lMHcs1urIolumueee1 thB5ZRx5geBa37NHlElLFRrOjJYRLEI5wBKzexQ/9qtXSjDB226h7mx+tfThlA6n+TnV PUCs9vVz6So+su2Tmg4dFv6XNi81LvNcf1hCls5NC3ls1Yj1DsdUnAnFsWdXB4uuk4BB rjgyi2f8LAX4Cjcr8ip4Zz/Nr40os6GfFAcJpDQ6Klf6gh2etKLw8DBiFXv+p06hlDg4 z5rA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=KNr1ZOZt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id sb10-20020a170906edca00b0099bd569daa4si7191346ejb.114.2023.07.31.05.11.51; Mon, 31 Jul 2023 05:12:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=KNr1ZOZt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232099AbjGaLVB (ORCPT + 99 others); Mon, 31 Jul 2023 07:21:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33826 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231773AbjGaLU5 (ORCPT ); Mon, 31 Jul 2023 07:20:57 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CDAB510FD for ; Mon, 31 Jul 2023 04:20:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1690802403; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=V5VMLpHOhxXlUy0bWDF9kXZ97zc/VghMcLBrU5Ym92c=; b=KNr1ZOZt8BHe9a9IfvWLmd6idJQ1b5fadL7pqUG5MP2af2rlu5ZkO/Efin4UqQiG+czwot TfWvrchXUOMxxLvAdWRGI3ar3Qch6z1eu3ILZ/x2sQmkBQ/wiYZsUW49zFYQCS1cnh2gW6 p07/AuHmHRN8lC2ysCU1WQMuC8PwWBo= Received: from mail-qt1-f200.google.com (mail-qt1-f200.google.com [209.85.160.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-450-emtNYcPrNuq_8x2S8P2csA-1; Mon, 31 Jul 2023 07:20:02 -0400 X-MC-Unique: emtNYcPrNuq_8x2S8P2csA-1 Received: by mail-qt1-f200.google.com with SMTP id d75a77b69052e-40eedfd4119so12476881cf.1 for ; Mon, 31 Jul 2023 04:20:02 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690802402; x=1691407202; h=mime-version:message-id:date:references:in-reply-to:subject:cc:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=V5VMLpHOhxXlUy0bWDF9kXZ97zc/VghMcLBrU5Ym92c=; b=c1+08ZJ3kXRzfbsqj9fk/8ZsbxabhGpcA2VFR+GJkqLThXRc+sPASKtzD8ktHEKtaa I4QB16P/8QvIbyiU0LEkfh1S6DfUXfq1QhZU+lvRo+E7sAHUj4BsRMg6mNzhkLXV+clh 4H/0yKiuxt+IQmWJG1si6r3Fq2LIfXnmjZSKS9K0NRK1wid+WgZf9MdtvfQPlIz6pr4G eJLsdBYx1CM2bbIVDeIAAubhKhA5eqqnEemGZLyfyikQls8iBx7a3crKF1R2w+xY73x2 jxJ5jC4vl/NPoE6+wnODSQIEUF61ixpoUgvkkKTfxmA8bAC5RE0fKC5WyS+CBIGNZmUc RiKQ== X-Gm-Message-State: ABy/qLYhnSA0oWDp2zJy9UtLqM2CJAmE02rlKuOUbOTo3Du3OTCllLo2 svEO3+Z3H+LwBrCfeGF7heHdZ/AUZwY5YlOBBWAMHbFAv8i62oCoJ9lx2tRCFtQ4fK3qwSv3OfS tMCiCdrY/b9EhE1BrGl9cysa8 X-Received: by 2002:ac8:7f08:0:b0:409:f273:e28d with SMTP id f8-20020ac87f08000000b00409f273e28dmr8487955qtk.62.1690802402032; Mon, 31 Jul 2023 04:20:02 -0700 (PDT) X-Received: by 2002:ac8:7f08:0:b0:409:f273:e28d with SMTP id f8-20020ac87f08000000b00409f273e28dmr8487873qtk.62.1690802401624; Mon, 31 Jul 2023 04:20:01 -0700 (PDT) Received: from vschneid.remote.csb ([149.12.7.81]) by smtp.gmail.com with ESMTPSA id x7-20020ac80187000000b00403f5873f5esm3447309qtf.24.2023.07.31.04.19.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 31 Jul 2023 04:20:01 -0700 (PDT) From: Valentin Schneider To: Steven Rostedt , Josh Poimboeuf Cc: linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, linux-doc@vger.kernel.org, kvm@vger.kernel.org, linux-mm@kvack.org, bpf@vger.kernel.org, x86@kernel.org, rcu@vger.kernel.org, linux-kselftest@vger.kernel.org, Masami Hiramatsu , Jonathan Corbet , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , "H. Peter Anvin" , Paolo Bonzini , Wanpeng Li , Vitaly Kuznetsov , Andy Lutomirski , Peter Zijlstra , Frederic Weisbecker , "Paul E. McKenney" , Neeraj Upadhyay , Joel Fernandes , Josh Triplett , Boqun Feng , Mathieu Desnoyers , Lai Jiangshan , Zqiang , Andrew Morton , Uladzislau Rezki , Christoph Hellwig , Lorenzo Stoakes , Jason Baron , Kees Cook , Sami Tolvanen , Ard Biesheuvel , Nicholas Piggin , Juerg Haefliger , Nicolas Saenz Julienne , "Kirill A. Shutemov" , Nadav Amit , Dan Carpenter , Chuang Wang , Yang Jihong , Petr Mladek , "Jason A. Donenfeld" , Song Liu , Julian Pidancet , Tom Lendacky , Dionna Glaze , Thomas =?utf-8?Q?Wei=C3=9Fschuh?= , Juri Lelli , Daniel Bristot de Oliveira , Marcelo Tosatti , Yair Podemsky Subject: Re: [RFC PATCH v2 02/20] tracing/filters: Enable filtering a cpumask field by another cpumask In-Reply-To: <20230729150901.25b9ae0c@rorschach.local.home> References: <20230720163056.2564824-1-vschneid@redhat.com> <20230720163056.2564824-3-vschneid@redhat.com> <20230726194148.4jhyqqbtn3qqqqsq@treble> <20230729150901.25b9ae0c@rorschach.local.home> Date: Mon, 31 Jul 2023 12:19:51 +0100 Message-ID: MIME-Version: 1.0 Content-Type: text/plain X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 29/07/23 15:09, Steven Rostedt wrote: > On Wed, 26 Jul 2023 12:41:48 -0700 > Josh Poimboeuf wrote: > >> On Thu, Jul 20, 2023 at 05:30:38PM +0100, Valentin Schneider wrote: >> > int filter_assign_type(const char *type) >> > { >> > - if (strstr(type, "__data_loc") && strstr(type, "char")) >> > - return FILTER_DYN_STRING; >> > + if (strstr(type, "__data_loc")) { >> > + if (strstr(type, "char")) >> > + return FILTER_DYN_STRING; >> > + if (strstr(type, "cpumask_t")) >> > + return FILTER_CPUMASK; >> > + } >> >> The closing bracket has the wrong indentation. >> >> > + /* Copy the cpulist between { and } */ >> > + tmp = kmalloc((i - maskstart) + 1, GFP_KERNEL); >> > + strscpy(tmp, str + maskstart, (i - maskstart) + 1); >> >> Need to check kmalloc() failure? And also free tmp? > > I came to state the same thing. > > Also, when you do an empty for loop: > > for (; str[i] && str[i] != '}'; i++); > > Always put the semicolon on the next line, otherwise it is really easy > to think that the next line is part of the for loop. That is, instead > of the above, do: > > for (; str[i] && str[i] != '}'; i++) > ; > Interestingly I don't think I've ever encountered that variant, usually having an empty line (which this lacks) and the indentation level is enough to identify these - regardless, I'll change it. > > -- Steve > > >> >> > + >> > + pred->mask = kzalloc(cpumask_size(), GFP_KERNEL); >> > + if (!pred->mask) >> > + goto err_mem; >> > + >> > + /* Now parse it */ >> > + if (cpulist_parse(tmp, pred->mask)) { >> > + parse_error(pe, FILT_ERR_INVALID_CPULIST, pos + i); >> > + goto err_free; >> > + } >> > + >> > + /* Move along */ >> > + i++; >> > + if (field->filter_type == FILTER_CPUMASK) >> > + pred->fn_num = FILTER_PRED_FN_CPUMASK; >> > + >>