[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230511065330.26392-1-mike.leach@linaro.org>
Date: Thu, 11 May 2023 07:53:24 +0100
From: Mike Leach <mike.leach@...aro.org>
To: linux-arm-kernel@...ts.infradead.org, coresight@...ts.linaro.org,
linux-kernel@...r.kernel.org
Cc: suzuki.poulose@....com, acme@...nel.org, james.clark@....com,
Mike Leach <mike.leach@...aro.org>
Subject: [PATCH v6 0/6] coresight: syscfg: Add config table load via configfs
This set extends the configuration management support to allow loading and
unloading of configurations as structured tables.
The existing coresight configuration configfs API is additionally extended
to use this table functionality to load and unload configuration tables
as binary files.
This allows coresight configurations to be loaded at runtime, and independently
of kernel version, without the requirement to re-compile as built in kernel
modules.
Additional attributes - load and unload are provided to in the
/config/cs-syscfg subsytem base group to implement the load functionality.
The load attribute is a configfs binary attribute, loading the configuration
table in a similar way as the ACPI table binary attribute for that sub-system.
The configfs binary attribute mechanism supplies a strictly size limited
kernel buffer, providing better safety than other mechnisms, and also has
the advantage of being accessible directly from the command line, and being
part of the existing upstream coresight configuration mechanism in configfs
Configurations loaded in this way are validated and loaded across the entire
system of components atomically. If any part fails to load then the whole
configuration load will be cancelled.
Routines to generate binary configuration table files are supplied in
./tools/coresight.
Example generator and reader applications are provided.
Tools may be cross compiled or built for use on host system.
Documentation is updated to describe feature usage.
Changes since v5:
1) Possible memory leak removed.
Reported-by: kernel test robot <lkp@...el.com>
Reported-by: Dan Carpenter <error27@...il.com>
2) Reuse mechanism for reader code revised. (Christoph)
3) Unload mechnism now by name in standard attribute, rather than
entire file
4) Mechanism to check last loaded configuration can be unloaded.
5) Documentation updates.
Changes since v4:
1) Update coresight/next - 6.1-rc3
2) Update to lockdep fixes to avoid read lock race in configfs.
Changes since v3:
1) Rebase & tested on coresight/next - 5.19-rc3 - which includes the
fix patch for earlier configfs works.
2) Lockdep investigations resulted in re-design of some of the code
accessing configfs.
3) moved load and unload attributes to root of cs-syscfg. (Mathieu)
4) Additional minor fixes suggested by Mathieu.
5) Memory for configfs loaded and unloaded configurations is now
explicitly freed.
6) LOCKDEP nesting fix for configfs base code (fs/configfs/dir.c)
Changes since v2:
1) Rebased & tested on coresight/next - 5.18-rc2
2) Moved coresight config generator and reader programs from samples to
tools/coresight. Docs updated to match. (suggested by Mathieu)
3) userspace builds now use userspace headers from tools/...
4) Other minor fixes from Mathieu's review.
Changes since v1:
1) Rebased to coresight/next - 5.16-rc1 with previous coresight config
set applied.
2) Makefile.host fixed to default to all target.
Mike Leach (6):
coresight: config: add config table runtime load functionality
coresight: configfs: Update memory allocation / free for configfs
elements
coresight: configfs: Add attributes to load config tables at runtime
coresight: config: extract shared structures to common header file
coresight: tools: Add config table file write and reader tools
Documentation: coresight: docs for config load via configfs
.../trace/coresight/coresight-config.rst | 265 ++++++++-
MAINTAINERS | 1 +
drivers/hwtracing/coresight/Makefile | 3 +-
.../coresight/coresight-config-desc.h | 105 ++++
.../coresight/coresight-config-table.c | 431 +++++++++++++++
.../coresight/coresight-config-table.h | 151 ++++++
.../hwtracing/coresight/coresight-config.h | 98 +---
.../coresight/coresight-syscfg-configfs.c | 513 ++++++++++++++++--
.../coresight/coresight-syscfg-configfs.h | 5 +
.../hwtracing/coresight/coresight-syscfg.c | 101 +++-
.../hwtracing/coresight/coresight-syscfg.h | 6 +-
tools/coresight/Makefile | 56 ++
tools/coresight/coresight-cfg-bufw.c | 309 +++++++++++
tools/coresight/coresight-cfg-bufw.h | 26 +
tools/coresight/coresight-cfg-example1.c | 62 +++
tools/coresight/coresight-cfg-example2.c | 95 ++++
tools/coresight/coresight-cfg-examples.h | 25 +
tools/coresight/coresight-cfg-file-gen.c | 61 +++
tools/coresight/coresight-cfg-file-read.c | 227 ++++++++
tools/coresight/coresight-config-uapi.h | 105 ++++
20 files changed, 2503 insertions(+), 142 deletions(-)
create mode 100644 drivers/hwtracing/coresight/coresight-config-desc.h
create mode 100644 drivers/hwtracing/coresight/coresight-config-table.c
create mode 100644 drivers/hwtracing/coresight/coresight-config-table.h
create mode 100644 tools/coresight/Makefile
create mode 100644 tools/coresight/coresight-cfg-bufw.c
create mode 100644 tools/coresight/coresight-cfg-bufw.h
create mode 100644 tools/coresight/coresight-cfg-example1.c
create mode 100644 tools/coresight/coresight-cfg-example2.c
create mode 100644 tools/coresight/coresight-cfg-examples.h
create mode 100644 tools/coresight/coresight-cfg-file-gen.c
create mode 100644 tools/coresight/coresight-cfg-file-read.c
create mode 100644 tools/coresight/coresight-config-uapi.h
--
2.17.1
Powered by blists - more mailing lists