From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id B1E12C46CD2 for ; Tue, 2 Jan 2024 15:20:31 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5304F8D0014; Tue, 2 Jan 2024 10:20:31 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 4DDE08D0006; Tue, 2 Jan 2024 10:20:31 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3A7D88D0014; Tue, 2 Jan 2024 10:20:31 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 257898D0006 for ; Tue, 2 Jan 2024 10:20:31 -0500 (EST) Received: from smtpin16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id EF09BA0801 for ; Tue, 2 Jan 2024 15:20:30 +0000 (UTC) X-FDA: 81634732620.16.F6AD519 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf10.hostedemail.com (Postfix) with ESMTP id 0E81EC000E for ; Tue, 2 Jan 2024 15:20:27 +0000 (UTC) Authentication-Results: imf10.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=SqEPk9zN; spf=pass (imf10.hostedemail.com: domain of robh@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=robh@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1704208828; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=5597WxKtMwpLooO25UkqXhsO2exDLV1j3RbPnCq0AOc=; b=2mI1BLWXHwzpqXEZzDRUr7Gm5Zgz52b5kBkS6j+eDSlbkDVQgDMpJJsuFnlc1oV5uYnnIr tf+pDoqrrpdIGGdF1HpmUZyzFIVtx27OpRqkSSy78OKRThCwQ7VBBOTbWdJBpkxUOIEGfo RKYB74eGLeS2JwR4wWXlHM+9zcXmHJY= ARC-Authentication-Results: i=1; imf10.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=SqEPk9zN; spf=pass (imf10.hostedemail.com: domain of robh@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=robh@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1704208828; a=rsa-sha256; cv=none; b=lR8+W3jndoVfBICZXI2KiM97CNicc4ZxxrAHDEoACSXVFmXszKYQryQ6nBHw5RNBhr+BFG B3xMlrxLE2rXD6pY5+phVDgMyE2sM1f/zM6CURNZzbXw0K37k2Y/hqZbGe/flB6mixncue aJKRSiq5BnrF62GmIwKSun6cW0rd3Nc= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 1AEF061170; Tue, 2 Jan 2024 15:20:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 335A1C433C8; Tue, 2 Jan 2024 15:20:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1704208826; bh=28yPedgGByxBs/XllHPUgTPObBuags0avxhjHUIO2lA=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=SqEPk9zNaSyGDVA+YezzLsKj3ZNQGZ0SC4yCM9VyBETW2lskULwf3YW1bzCtNQIfP 6uXhHnR+VyjNxAdfsAuGy3PHqdk6b8MxmTW8LYv8wBb4ItzWZw49ksPEkR06n89PFp 2SHwc5dxr4TpgSfLoEJwYJVg/H6eXbQixr64Xmfg+I5UB0X4IH3NAAjmjbwdHFlysM UpyPsK4q/fnx9eBausPSz+cLglyeXqhW6ZWKNvjm1TKrQumi+l1lHl2hw3OUh/RrfO moE9dADO9rGte6dRtTv4Lf6g34Xmghec8dAzDY6uXDe6/E/fPOAc7PHu2mFtiS2u5m S8IIs3i6VEKvg== Received: (nullmailer pid 2861879 invoked by uid 1000); Tue, 02 Jan 2024 15:20:23 -0000 Date: Tue, 2 Jan 2024 08:20:23 -0700 From: Rob Herring To: Alexander Graf Cc: linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, linux-mm@kvack.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, kexec@lists.infradead.org, linux-doc@vger.kernel.org, x86@kernel.org, Eric Biederman , "H. Peter Anvin" , Andy Lutomirski , Peter Zijlstra , Steven Rostedt , Andrew Morton , Mark Rutland , Tom Lendacky , Ashish Kalra , James Gowans , Stanislav Kinsburskii , arnd@arndb.de, pbonzini@redhat.com, madvenka@linux.microsoft.com, Anthony Yznaga , Usama Arif , David Woodhouse , Benjamin Herrenschmidt Subject: Re: [PATCH v2 17/17] devicetree: Add bindings for ftrace KHO Message-ID: <20240102152023.GA2821956-robh@kernel.org> References: <20231222193607.15474-1-graf@amazon.com> <20231222195144.24532-1-graf@amazon.com> <20231222195144.24532-12-graf@amazon.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231222195144.24532-12-graf@amazon.com> X-Rspamd-Queue-Id: 0E81EC000E X-Rspam-User: X-Stat-Signature: wdnn1xno3978ytnohuix6bs5cwh7dhbe X-Rspamd-Server: rspam01 X-HE-Tag: 1704208827-115478 X-HE-Meta: U2FsdGVkX1+IuQCjlOB+hILVQpPQ76v16uDKmHR4fV76lI9lR9owNRa5LsAMZMW8DBulUJiPDJ5IP8Ne2j9gcbmVURYAtyM+7LBThXVXrCjUXUg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ViXZODqyhRHwhOCJEbhxUdRbS3x3cEh8ts16XJONdjLmPmkc8spswI4HlVok2w9loeUP6NWP41zKyh+sGiY2w== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: On Fri, Dec 22, 2023 at 07:51:44PM +0000, Alexander Graf wrote: > With ftrace in KHO, we are creating an ABI between old kernel and new > kernel about the state that they transfer. To ensure that we document > that state and catch any breaking change, let's add its schema to the > common devicetree bindings. This way, we can quickly reason about the > state that gets passed. Why so much data in DT rather than putting all this information into memory in your own data structure and DT just has a single property pointing to that? That's what is done with every other blob of data passed by kexec. > > Signed-off-by: Alexander Graf > --- > .../bindings/kho/ftrace/ftrace-array.yaml | 46 +++++++++++++++ > .../bindings/kho/ftrace/ftrace-cpu.yaml | 56 +++++++++++++++++++ > .../bindings/kho/ftrace/ftrace.yaml | 48 ++++++++++++++++ > 3 files changed, 150 insertions(+) > create mode 100644 Documentation/devicetree/bindings/kho/ftrace/ftrace-array.yaml > create mode 100644 Documentation/devicetree/bindings/kho/ftrace/ftrace-cpu.yaml > create mode 100644 Documentation/devicetree/bindings/kho/ftrace/ftrace.yaml > > diff --git a/Documentation/devicetree/bindings/kho/ftrace/ftrace-array.yaml b/Documentation/devicetree/bindings/kho/ftrace/ftrace-array.yaml > new file mode 100644 > index 000000000000..9960fefc292d > --- /dev/null > +++ b/Documentation/devicetree/bindings/kho/ftrace/ftrace-array.yaml > @@ -0,0 +1,46 @@ > +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) > +%YAML 1.2 > +--- > +$id: http://devicetree.org/schemas/kho/ftrace/ftrace-array.yaml# > +$schema: http://devicetree.org/meta-schemas/core.yaml# > + > +title: Ftrace trace array > + > +maintainers: > + - Alexander Graf > + > +properties: > + compatible: > + enum: > + - ftrace,array-v1 > + > + trace_flags: > + $ref: /schemas/types.yaml#/definitions/uint32 > + description: > + Bitmap of all the trace flags that were enabled in the trace array at the > + point of serialization. > + > +# Subnodes will be of type "ftrace,cpu-v1", one each per CPU This can be expressed as a schema. > +additionalProperties: true > + > +required: > + - compatible > + - trace_flags > + > +examples: > + - | > + ftrace { > + compatible = "ftrace-v1"; > + events = <1 1 2 2 3 3>; > + > + global_trace { > + compatible = "ftrace,array-v1"; > + trace_flags = < 0x3354601 >; > + > + cpu0 { > + compatible = "ftrace,cpu-v1"; > + cpu = < 0x00 >; > + mem = < 0x101000000ULL 0x38ULL 0x101000100ULL 0x1000ULL 0x101000038ULL 0x38ULL 0x101002000ULL 0x1000ULL>; > + }; > + }; > + }; > diff --git a/Documentation/devicetree/bindings/kho/ftrace/ftrace-cpu.yaml b/Documentation/devicetree/bindings/kho/ftrace/ftrace-cpu.yaml > new file mode 100644 > index 000000000000..58c715e93f37 > --- /dev/null > +++ b/Documentation/devicetree/bindings/kho/ftrace/ftrace-cpu.yaml > @@ -0,0 +1,56 @@ > +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) > +%YAML 1.2 > +--- > +$id: http://devicetree.org/schemas/kho/ftrace/ftrace-cpu.yaml# > +$schema: http://devicetree.org/meta-schemas/core.yaml# > + > +title: Ftrace per-CPU ring buffer contents > + > +maintainers: > + - Alexander Graf > + > +properties: > + compatible: > + enum: > + - ftrace,cpu-v1 > + > + cpu: > + $ref: /schemas/types.yaml#/definitions/uint32 'cpu' is already a defined property of type 'phandle'. While we can have multiple types for a given property name, best practice is to avoid that. The normal way to refer to a CPU would be a phandle to the CPU node, but I can see that might not make sense here. "CPU numbers" on arm64 are 64-bit values as well as they are the CPU's MPIDR value. > + description: > + CPU number of the CPU that this ring buffer belonged to when it was > + serialized. > + > + mem: Too vague. Make the property name indicate what's in the memory. > + $ref: /schemas/types.yaml#/definitions/uint32-array > + description: > + Array of { u64 phys_addr, u64 len } elements that describe a list of ring > + buffer pages. Each page consists of two elements. The first element > + describes the location of the struct buffer_page that contains metadata > + for a given ring buffer page, such as the ring's head indicator. The > + second element points to the ring buffer data page which contains the raw > + trace data. > + > +additionalProperties: false > + > +required: > + - compatible > + - cpu > + - mem > + > +examples: > + - | > + ftrace { > + compatible = "ftrace-v1"; > + events = <1 1 2 2 3 3>; > + > + global_trace { > + compatible = "ftrace,array-v1"; > + trace_flags = < 0x3354601 >; > + > + cpu0 { > + compatible = "ftrace,cpu-v1"; > + cpu = < 0x00 >; > + mem = < 0x101000000ULL 0x38ULL 0x101000100ULL 0x1000ULL 0x101000038ULL 0x38ULL 0x101002000ULL 0x1000ULL>; > + }; > + }; > + }; > diff --git a/Documentation/devicetree/bindings/kho/ftrace/ftrace.yaml b/Documentation/devicetree/bindings/kho/ftrace/ftrace.yaml > new file mode 100644 > index 000000000000..b87a64843af3 > --- /dev/null > +++ b/Documentation/devicetree/bindings/kho/ftrace/ftrace.yaml > @@ -0,0 +1,48 @@ > +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) > +%YAML 1.2 > +--- > +$id: http://devicetree.org/schemas/kho/ftrace/ftrace.yaml# > +$schema: http://devicetree.org/meta-schemas/core.yaml# > + > +title: Ftrace core data > + > +maintainers: > + - Alexander Graf > + > +properties: > + compatible: > + enum: > + - ftrace-v1 > + > + events: Again, too vague. > + $ref: /schemas/types.yaml#/definitions/uint32-array > + description: > + Array of { u32 crc, u32 type } elements. Each element contains a unique > + identifier for an event, followed by the identifier that this event had > + in the previous kernel's trace buffers. > + > +# Other child nodes will be of type "ftrace,array-v1". Each of which describe > +# a trace buffer > +additionalProperties: true > + > +required: > + - compatible > + - events > + > +examples: > + - | > + ftrace { This should go under /chosen. Show that here. Start the example with '/{' to do that and not add the usual boilerplate we add when extracting the examples. Also, we don't need 3 examples. Just do 1 complete example here. > + compatible = "ftrace-v1"; > + events = <1 1 2 2 3 3>; > + > + global_trace { > + compatible = "ftrace,array-v1"; > + trace_flags = < 0x3354601 >; > + > + cpu0 { > + compatible = "ftrace,cpu-v1"; > + cpu = < 0x00 >; > + mem = < 0x101000000ULL 0x38ULL 0x101000100ULL 0x1000ULL 0x101000038ULL 0x38ULL 0x101002000ULL 0x1000ULL>; > + }; > + }; > + }; > -- > 2.40.1 > > > > > Amazon Development Center Germany GmbH > Krausenstr. 38 > 10117 Berlin > Geschaeftsfuehrung: Christian Schlaeger, Jonathan Weiss > Eingetragen am Amtsgericht Charlottenburg unter HRB 149173 B > Sitz: Berlin > Ust-ID: DE 289 237 879 > > >