From: Peter Zijlstra <peterz@infradead.org>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: Indu Bhagat <indu.bhagat@oracle.com>,
linux-toolchains@vger.kernel.org, daandemeyer@meta.com,
andrii@kernel.org, kris.van.hees@oracle.com,
elena.zannoni@oracle.com, nick.alcock@oracle.com
Subject: Re: [POC 3/5] sframe: add new SFrame library
Date: Tue, 2 May 2023 10:46:40 +0200 [thread overview]
Message-ID: <20230502084640.GF1597476@hirez.programming.kicks-ass.net> (raw)
In-Reply-To: <20230501184008.319fdd6f@gandalf.local.home>
On Mon, May 01, 2023 at 06:40:08PM -0400, Steven Rostedt wrote:
> > --- /dev/null
> > +++ b/lib/sframe/sframe.h
> > @@ -0,0 +1,263 @@
> > +/* SPDX-License-Identifier: GPL-2.0-or-later */
> > +/*
> > + * Copyright (C) 2023, Oracle and/or its affiliates.
> > + */
> > +
> > +#ifndef SFRAME_H
> > +#define SFRAME_H
> > +
> > +#include <linux/types.h>
> > +
> > +/* This file contains definitions for the SFrame stack tracing format, which is
> > + * documented at https://sourceware.org/binutils/docs */
More CodingStyle nits, this also isn't a valid multi line comment style
for the kernel.
> > +
> > +#define SFRAME_VERSION_1 1
> > +#define SFRAME_MAGIC 0xdee2
> > +#define SFRAME_VERSION SFRAME_VERSION_1
> > +
> > +/* Function Descriptor Entries are sorted on PC. */
> > +#define SFRAME_F_FDE_SORTED 0x1
> > +/* Frame-pointer based stack tracing. Defined, but not set. */
> > +#define SFRAME_F_FRAME_POINTER 0x2
> > +
> > +#define SFRAME_CFA_FIXED_FP_INVALID 0
> > +#define SFRAME_CFA_FIXED_RA_INVALID 0
> > +
> > +/* Supported ABIs/Arch. */
> > +#define SFRAME_ABI_AARCH64_ENDIAN_BIG 1 /* AARCH64 big endian. */
> > +#define SFRAME_ABI_AARCH64_ENDIAN_LITTLE 2 /* AARCH64 little endian. */
> > +#define SFRAME_ABI_AMD64_ENDIAN_LITTLE 3 /* AMD64 little endian. */
> > +
> > +/* SFrame FRE types. */
> > +#define SFRAME_FRE_TYPE_ADDR1 0
> > +#define SFRAME_FRE_TYPE_ADDR2 1
> > +#define SFRAME_FRE_TYPE_ADDR4 2
> > +
> > +/*
> > + * SFrame Function Descriptor Entry types.
> > + *
> > + * The SFrame format has two possible representations for functions. The
> > + * choice of which type to use is made according to the instruction patterns
> > + * in the relevant program stub.
> > + */
This is.
> > +/* Unwinders perform a (PC >= FRE_START_ADDR) to look up a matching FRE. */
> > +#define SFRAME_FDE_TYPE_PCINC 0
> > +/*
> > + * Unwinders perform a (PC & FRE_START_ADDR_AS_MASK >= FRE_START_ADDR_AS_MASK)
> > + * to look up a matching FRE. Typical usecases are pltN entries, trampolines
> > + * etc.
> > + */
> > +#define SFRAME_FDE_TYPE_PCMASK 1
> > +
> > +static bool sframe_header_sanity_check_p(struct sframe_header *hp)
> > +{
> > + unsigned char all_flags = SFRAME_F_FDE_SORTED | SFRAME_F_FRAME_POINTER;
>
> Add a space here.
>
> > + /* Check that the preamble is valid. */
> > + if ((hp->preamble.magic != SFRAME_MAGIC)
> > + || (hp->preamble.version != SFRAME_VERSION)
> > + || ((hp->preamble.flags | all_flags) != all_flags))
> > + return false;
In kernel we prefer the operators at the end of a line in case of
linebreak.
> > +
> > + /* Check that the offsets are valid. */
> > + if (hp->fdeoff > hp->freoff)
> > + return false;
> > +
> > + return true;
> > +}
> > +
> > +static bool sframe_fre_sanity_check_p(struct sframe_fre *frep)
> > +{
> > + unsigned int offset_size, offset_cnt;
> > +
> > + if (frep == NULL)
> > + return false;
> > +
> > + offset_size = sframe_fre_get_offset_size(frep->fre_info);
> > +
> > + if (offset_size != SFRAME_FRE_OFFSET_1B
> > + && offset_size != SFRAME_FRE_OFFSET_2B
> > + && offset_size != SFRAME_FRE_OFFSET_4B)
> > + return false;
idem.
> > +
> > + offset_cnt = sframe_fre_get_offset_count(frep->fre_info);
> > + if (offset_cnt > MAX_NUM_STACK_OFFSETS)
> > + return false;
> > +
> > + return true;
> > +}
next prev parent reply other threads:[~2023-05-02 8:48 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-01 20:04 [POC 0/5] SFrame based stack tracer for user space in the kernel Indu Bhagat
2023-05-01 20:04 ` [POC 1/5] Kconfig: x86: Add new config options for userspace unwinder Indu Bhagat
2023-05-01 20:04 ` [POC 2/5] task_struct : add additional member for sframe state Indu Bhagat
2023-05-01 20:04 ` [POC 3/5] sframe: add new SFrame library Indu Bhagat
2023-05-01 22:40 ` Steven Rostedt
2023-05-02 5:07 ` Indu Bhagat
2023-05-02 8:46 ` Peter Zijlstra [this message]
2023-05-02 9:09 ` Peter Zijlstra
2023-05-02 9:20 ` Peter Zijlstra
2023-05-02 9:28 ` Peter Zijlstra
2023-05-02 9:30 ` Peter Zijlstra
2023-05-03 6:03 ` Indu Bhagat
2023-05-02 10:31 ` Peter Zijlstra
2023-05-02 10:41 ` Peter Zijlstra
2023-05-02 15:22 ` Steven Rostedt
2023-05-01 20:04 ` [POC 4/5] sframe: add an SFrame format stack tracer Indu Bhagat
2023-05-01 23:00 ` Steven Rostedt
2023-05-02 6:16 ` Indu Bhagat
2023-05-02 8:53 ` Peter Zijlstra
2023-05-02 9:04 ` Peter Zijlstra
2023-05-01 20:04 ` [POC 5/5] x86_64: invoke SFrame based stack tracer for user space Indu Bhagat
2023-05-01 23:11 ` Steven Rostedt
2023-05-02 10:53 ` Peter Zijlstra
2023-05-02 15:27 ` Steven Rostedt
2023-05-16 17:25 ` Andrii Nakryiko
2023-05-16 17:38 ` Steven Rostedt
2023-05-16 17:51 ` Andrii Nakryiko
2024-03-13 14:37 ` Tatsuyuki Ishi
2024-03-13 14:52 ` Steven Rostedt
2024-03-13 14:58 ` Tatsuyuki Ishi
2024-03-13 15:04 ` Steven Rostedt
2023-05-01 22:15 ` [POC 0/5] SFrame based stack tracer for user space in the kernel Steven Rostedt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230502084640.GF1597476@hirez.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=andrii@kernel.org \
--cc=daandemeyer@meta.com \
--cc=elena.zannoni@oracle.com \
--cc=indu.bhagat@oracle.com \
--cc=kris.van.hees@oracle.com \
--cc=linux-toolchains@vger.kernel.org \
--cc=nick.alcock@oracle.com \
--cc=rostedt@goodmis.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.