Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp8924661rwb; Tue, 13 Dec 2022 12:16:32 -0800 (PST) X-Google-Smtp-Source: AA0mqf48NUrHh13EIhtSRSbDGDz6TIpfuLsHzMKUThs2UD9dI0Ee5+VGryVoCLoiIHwKuZkf/Aoj X-Received: by 2002:a17:907:c08d:b0:7c1:7c38:f079 with SMTP id st13-20020a170907c08d00b007c17c38f079mr8469722ejc.71.1670962592509; Tue, 13 Dec 2022 12:16:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670962592; cv=none; d=google.com; s=arc-20160816; b=WE8qSU5L8JiLNq+UNuw1uYNKiJ84CKmlLqaAoJGxTOpOMxYHKARxS4gvnYYJAyQT+6 +RDpmv3gUOSNE5aryLPd4Ad+1BoFGWVIjtp0zl28h3pHlQOPasuouhzObEkXrzCCc8YM RBum/paygZ+D7X05WQfEOswPVpxj7JaA7HevSJFINHB6WIKaUGgyM9CamG5atS2unjQk dRv9cnsIEbWbbW1TW7bwRCedQJl+mYU2D7YeA9TU3MsCAGJF36F9yPSPBe6CW75pHO+K jEvUshGQBsYCJO34cQA2RASoQowqiLUBz05Kh6PN62MXSKn05ENL1kosQl70LJkOI8dJ T3qA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:references :cc:to:from:content-language:subject:user-agent:mime-version:date :message-id; bh=YV1oN9/j/nQ6qri8pazkeSlX4/bfXjSr9dq1vACL1XI=; b=0SUrWs+OvmKr9/fQBzT61xLSu6c0gXr5F8YPGyLs3rSZO1n7eBhMgReJDsT84Hdfzs 6CVIOHJvN19klT6hlVjTwypFWwDd9xbwTuk0YCxL4zUwFGpMDgAqj2CpO6RsZLqUMWei UN2r9nzStvmdeMjhcmknvw61A5Ca4kCWZpKfCpdTjAtAXyaLa95BXCUGiCc5E55E/unz BZuEc/4+sJkqiGlptdV0YCOO9dvmJPFY1XNE6PZ+xw1C7NOaR+BqfUSBN2xh3mF52OIz 2vxXuT3aEWoOuISQbgdGV359f6qQG+oIPzSYg0MD92y4UDFKYP/sgxYUoshDQt4kVRHG 2Hsw== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id wd12-20020a170907d60c00b007c12c63d1f4si8440965ejc.813.2022.12.13.12.16.14; Tue, 13 Dec 2022 12:16:32 -0800 (PST) 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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236574AbiLMTu3 (ORCPT + 72 others); Tue, 13 Dec 2022 14:50:29 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50838 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236671AbiLMTuW (ORCPT ); Tue, 13 Dec 2022 14:50:22 -0500 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 85AAB2656F for ; Tue, 13 Dec 2022 11:50:17 -0800 (PST) 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 77B9D2F4; Tue, 13 Dec 2022 11:50:57 -0800 (PST) Received: from [192.168.89.251] (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id BF80B3F73B; Tue, 13 Dec 2022 11:50:15 -0800 (PST) Message-ID: <3a11ed33-0a3d-2668-ab2b-c44eea7eddbe@arm.com> Date: Tue, 13 Dec 2022 19:50:18 +0000 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.2.2 Subject: Re: [for-next][PATCH 02/11] tracing: Add __cpumask to denote a trace event field that is a cpumask_t Content-Language: en-US From: Douglas Raillard To: Steven Rostedt Cc: linux-kernel@vger.kernel.org, Masami Hiramatsu , Andrew Morton , Valentin Schneider References: <20221124145019.782980678@goodmis.org> <20221124145045.743308431@goodmis.org> <6dda5e1d-9416-b55e-88f3-31d148bc925f@arm.com> <20221212111256.3cf68f3e@gandalf.local.home> <8448372a-6911-e920-b630-15af850adcae@arm.com> <20221212185330.639bf491@gandalf.local.home> <764f8b9a-2111-c260-7f2c-89eb9f0ac7a3@arm.com> In-Reply-To: <764f8b9a-2111-c260-7f2c-89eb9f0ac7a3@arm.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_NONE autolearn=ham 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 13-12-2022 14:20, Douglas Raillard wrote: > > The only case I can think of where parsing would not follow regular C abstract declaration syntax is a type like that: > >     __data_loc int [3][] After some experimentation, I came to the conclusion that "__data_loc [] " can indeed support any C type if they need to be added in the future. I would heavily suggest that any future extension works as the following, to avoid messing up the grammar in a subtle way that would prevent some types to be expressible, or make it a nightmare to implement. The recipe to parse that with stock C parser is: * consume "__data_loc" * parse " []" as a func prototype parameter declaration (declaration using an abstract declarator, i.e. not introducing any identifier) * parse "" as an identifier. > The outer-most array is by definition the dynamic one, so "[]". In normal C, [3] and [] would be swapped as > the outer-most array comes first. That's not too bad though as it is not ambiguous and easy to fixup directly > in the parse tree. Simply swapping is wrong in the general case. The correct modification of the " []" parse tree is doing a "barrel shift" on nested array sizes. If the type is "int [1][2][]", it needs to be turned into "int [][1][2]". The now-top-level sizeless array is the dynamic array. Note that pointers level are transparent, so "int (*[1])[2][]" needs to be turned into "int (*[])[1][2]" -- Douglas