From nobody Tue Dec 2 02:19:50 2025 Received: from mail-wr1-f51.google.com (mail-wr1-f51.google.com [209.85.221.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 753E92EBBB4 for ; Wed, 19 Nov 2025 15:45:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763567125; cv=none; b=gww0qx6HCjhntiJSi3OxTf/FQ/zihF5pVhk0Y3kT5ltmg8Vagb48A6fNMLxpv4hirSPKBMICBLVlKjlu8EQUMQ4mnZqD4zZhmJfO4klxTcPmPsNbGGVnsuDCSUVU6brhMm7RhRJw+M3q6zoxXHNnOmD3my7VypewXPJaDbFA4xc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763567125; c=relaxed/simple; bh=QqY5tRrVi6FWEAug1ZGmtO2F5zShkTvAx5jKQW4Bskg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=aC0AZWJ1xUjSBQULBYxMV5LlpEHSAWxxDfB2FxJ45Gnt10Gv3v3KXE8FDfX1vLntY0b0f+KIjWsZTInL/DX8wymxMNOoYp63mpTubV88bAJ7f1Pk7bXNoM9pSkPpxttSergAcMP/uy5eHCZ6jod+T4OTsNkrTX5tYNuArERsbWY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=jyjZVzEc; arc=none smtp.client-ip=209.85.221.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="jyjZVzEc" Received: by mail-wr1-f51.google.com with SMTP id ffacd0b85a97d-42bb288c219so3582813f8f.1 for ; Wed, 19 Nov 2025 07:45:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1763567119; x=1764171919; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=7qGk+s0IRVQRO0bT8nLdtgaCkCUOcAGvIaTFPbWEFSY=; b=jyjZVzEcYKohC0QlFzh99Knd2x89PWxeRJC6e34e7YPRGB/CS5oTHIcriedZFMgjcy 97sXsc13kaT8U4/vj9kis+cc4zwbOBbH9cM6VKQw79djrMDg+VXlXlVYLfXiH4PcrI+N TR7fmNTfakXu26BBGWBPCzwbZWvbM5LbAYQrzSpxb+lZC1xfn9kDuSk16qY+IaSP5YjY L07GSsBbZV9nbiRntUw44xSARc9G7F2qg62E1H17wJTc1Zih7S8Gl//kr18DpYsHebnf kXTNbZdAG7hJOh1zXQ5tRG7X9JqgGpqaAoyTkhA84+VsFjk02Jw3sSBDRIshJXjrG8q3 uwuA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763567119; x=1764171919; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=7qGk+s0IRVQRO0bT8nLdtgaCkCUOcAGvIaTFPbWEFSY=; b=i3g+G/7ACvi5N3YRrxw9rKJ9tV+Mv1mJh9d3eomKRclwnBanzLzG7Tnh5kV8AZs7LS cSWyzIX7mLNmf40tBAxSfMh07tEOiFVYYR2JNE18/Kv9Txh70ZcjJlxsydVGHdM8o9KB fhbzgQvhYycaLNcAa1kfuHvrjxF+f6teYM/yxJncRkvolB8G2c/QYX/G7C65w5/Ry51a uw3uxBBNzzt+mq/cFOE8EmQWunYgOvw7HsTiDRlkzlE3BXt4sxC9YXEHTltWVsxx3Ki+ d3Wzdxxdjvdj3Y0nUy519u8+ibiCHa95kZ8DPj03577kTTr7XroePP8HOc23VPdY+zdN XBuw== X-Forwarded-Encrypted: i=1; AJvYcCV5c1vvUMlqzhsBFc1gBh4O71Y9sl973+Lrwxdf0B3AWy5+iVTqcoRpKVec7PFXUXGXkKLdE4q15B73Rqw=@vger.kernel.org X-Gm-Message-State: AOJu0Yx353lzvFgsTMRD+2emlvmyZ/DyQACXo+F1s26hbkG9EaD26eTY FuLGLRieX2zSrVUXb4XSxhuHroTE/4ruynHRU+8CACjmH7s1xvey9JdH2FKkloilaaA= X-Gm-Gg: ASbGncuhY5DR1qDYFpAZ251q8bto1xAieUVlJ9RHa0ahWjWs92X0qJvQJHXLFK/kORS xSgWt63RgfO+EePCSMiV2ZvCaJYRCX5jNEdgKGj44SHlk2RAvO9auAdivJdwuKC2x1WrPCwRj52 TmJW3GUoqeoLUAs7gRRPGh3Vwsuw1RmMHxSrQ2YQztdJbfbtHVYVLjUzRXFC7m9Wspx13+jbcTA 8NVxcolppXI72x4A4uHJlarBUgpVhGmqvHXVFxUqiit87GB5DDu8GrvoxB4B8ZAqmlOmKh6CJ8S EsSWNyZOmgMcNA9DtUA/kNdzrrgz3PnY9iIUFJaCYDNIh5tnOUdQDH+KziwISm6qQOt1eikcmA0 fSME2armjDr04nP9aefZQFMIAaAgnEzkSQlb8K6h/ExdoQW1/bcKIzpIEmMmRAE2Y3ZA7ff4qMP 9K2GwGsK4WJnGSGg3bauE= X-Google-Smtp-Source: AGHT+IEOAIlRNytX3BFrROSCN9C1ojEnrle3QifpbuwqR2P8RkIwfO+aGW98GH73tk57TYlzz5GB2w== X-Received: by 2002:a05:6000:2890:b0:42b:3ad7:fdd4 with SMTP id ffacd0b85a97d-42b5933e3a6mr22918889f8f.3.1763567117642; Wed, 19 Nov 2025 07:45:17 -0800 (PST) Received: from eugen-station.. ([82.76.24.202]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-42b53dea1c9sm38765632f8f.0.2025.11.19.07.45.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Nov 2025 07:45:17 -0800 (PST) From: Eugen Hristev To: linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, tglx@linutronix.de, andersson@kernel.org, pmladek@suse.com, rdunlap@infradead.org, corbet@lwn.net, david@redhat.com, mhocko@suse.com Cc: tudor.ambarus@linaro.org, mukesh.ojha@oss.qualcomm.com, linux-arm-kernel@lists.infradead.org, linux-hardening@vger.kernel.org, jonechou@google.com, rostedt@goodmis.org, linux-doc@vger.kernel.org, devicetree@vger.kernel.org, linux-remoteproc@vger.kernel.org, linux-arch@vger.kernel.org, tony.luck@intel.com, kees@kernel.org, Eugen Hristev Subject: [PATCH 01/26] kernel: Introduce meminspect Date: Wed, 19 Nov 2025 17:44:02 +0200 Message-ID: <20251119154427.1033475-2-eugen.hristev@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251119154427.1033475-1-eugen.hristev@linaro.org> References: <20251119154427.1033475-1-eugen.hristev@linaro.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Inspection mechanism allows registration of a specific memory area(or object) for later inspection purpose. Ranges are being added into an inspection table, which can be requested and analyzed by specific drivers. Drivers would interface any hardware mechanism that will allow inspection of the data, including but not limited to: dumping for debugging, creating a coredump, analysis, or statistical information. Drivers can register a notifier to know when new objects are registered, or to traverse existing inspection table. Inspection table is created ahead of time such that it can be later used regardless of the state of the kernel (running, frozen, crashed, or any particular state). Signed-off-by: Eugen Hristev --- Documentation/dev-tools/index.rst | 1 + Documentation/dev-tools/meminspect.rst | 139 ++++++++ MAINTAINERS | 7 + include/asm-generic/vmlinux.lds.h | 13 + include/linux/meminspect.h | 261 ++++++++++++++ init/Kconfig | 2 + kernel/Makefile | 1 + kernel/meminspect/Kconfig | 20 ++ kernel/meminspect/Makefile | 3 + kernel/meminspect/meminspect.c | 470 +++++++++++++++++++++++++ 10 files changed, 917 insertions(+) create mode 100644 Documentation/dev-tools/meminspect.rst create mode 100644 include/linux/meminspect.h create mode 100644 kernel/meminspect/Kconfig create mode 100644 kernel/meminspect/Makefile create mode 100644 kernel/meminspect/meminspect.c diff --git a/Documentation/dev-tools/index.rst b/Documentation/dev-tools/in= dex.rst index 4b8425e348ab..8ce605de8ee6 100644 --- a/Documentation/dev-tools/index.rst +++ b/Documentation/dev-tools/index.rst @@ -38,6 +38,7 @@ Documentation/process/debugging/index.rst gpio-sloppy-logic-analyzer autofdo propeller + meminspect =20 =20 .. only:: subproject and html diff --git a/Documentation/dev-tools/meminspect.rst b/Documentation/dev-too= ls/meminspect.rst new file mode 100644 index 000000000000..2a0bd4d6e448 --- /dev/null +++ b/Documentation/dev-tools/meminspect.rst @@ -0,0 +1,139 @@ +.. SPDX-License-Identifier: GPL-2.0 + +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D +meminspect +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D + +This document provides information about the meminspect feature. + +Overview +=3D=3D=3D=3D=3D=3D=3D=3D + +meminspect is a mechanism that allows the kernel to register a chunk of +memory into a table, to be used at a later time for a specific +inspection purpose like debugging, memory dumping or statistics. + +meminspect allows drivers to traverse the inspection table on demand, +or to register a notifier to be called whenever a new entry is being added +or removed. + +The reasoning for meminspect is also to minimize the required information +in case of a kernel problem. For example a traditional debug method involv= es +dumping the whole kernel memory and then inspecting it. Meminspect allows = the +users to select which memory is of interest, in order to help this specific +use case in production, where memory and connectivity are limited. + +Although the kernel has multiple internal mechanisms, meminspect fits +a particular model which is not covered by the others. + +meminspect Internals +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D + +API +--- + +Static memory can be registered at compile time, by instructing the compil= er +to create a separate section with annotation info. +For each such annotated memory (variables usually), a dedicated struct +is being created with the required information. +To achieve this goal, some basic APIs are available: + + MEMINSPECT_ENTRY(idx, sym, sz) +is the basic macro that takes an ID, the symbol, and a size. + +To make it easier, some wrappers are also defined: + MEMINSPECT_SIMPLE_ENTRY(sym) +will use the dedicated MEMINSPECT_ID_##sym with a size equal to sizeof(sym) + + MEMINSPECT_NAMED_ENTRY(name, sym) +will be a simple entry that has an id that cannot be derived from the sym, +so a name has to be provided + + MEMINSPECT_AREA_ENTRY(sym, sz) +this will register sym, but with the size given as sz, useful for e.g. +arrays which do not have a fixed size at compile time. + +For dynamically allocated memory, or for other cases, the following APIs +are being defined: + meminspect_register_id_pa(enum meminspect_uid id, phys_addr_t zone, + size_t size, unsigned int type); +which takes the ID and the physical address. +Similarly there are variations: + meminspect_register_pa() omits the ID + meminspect_register_id_va() requires the ID but takes a virtual address + meminspect_register_va() omits the ID and requires a virtual address + +If the ID is not given, the next avialable dynamic ID is allocated. + +To unregister a dynamic entry, some APIs are being defined: + meminspect_unregister_pa(phys_addr_t zone, size_t size); + meminspect_unregister_id(enum meminspect_uid id); + meminspect_unregister_va(va, size); + +All of the above have a lock variant that ensures the lock on the table +is taken. + + +meminspect drivers +------------------ + +Drivers are free to traverse the table by using a dedicated function +meminspect_traverse(void *priv, MEMINSPECT_ITERATOR_CB cb) +The callback will be called for each entry in the table. + +Drivers can also register a notifier with + meminspect_notifier_register() +and unregister with + meminspect_notifier_unregister() +to be called when a new entry is being added or removed. + +Data structures +--------------- + +The regions are being stored in a simple fixed size array. It avoids +memory allocation overhead. This is not performance critical nor does +allocating a few hundred entries create a memory consumption problem. + +The static variables registered into meminspect are being annotated into +a dedicated .inspect_table memory section. This is then walked by meminspe= ct +at a later time and each variable is then copied to the whole inspect tabl= e. + +meminspect Initialization +------------------------- + +At any time, meminspect will be ready to accept region registration +from any part of the kernel. The table does not require any initialization. +In case CONFIG_CRASH_DUMP is enabled, meminspect will create an ELF header +corresponding to a core dump image, in which each region is added as a +program header. In this scenario, the first region is this ELF header, and +the second region is the vmcoreinfo ELF note. +By using this mechanism, all the meminspect table, if dumped, can be +concatenated to obtain a core image that is loadable with the `crash` tool. + +meminspect example +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D + +A simple scenario for meminspect is the following: +The kernel registers the linux_banner variable into meminspect with +a simple annotation like: + + MEMINSPECT_SIMPLE_ENTRY(linux_banner); + +The meminspect late initcall will parse the compilation time created table +and copy the entry information into the inspection table. +At a later point, any interested driver can call the traverse function to +find out all entries in the table. +A specific driver will then note into a specific table the address of the +banner and the size of it. +The specific table is then written to a shared memory area that can be +read by upper level firmware. +When the kernel freezes (hypothetically), the kernel will no longer feed +the watchdog. The watchdog will trigger a higher exception level interrupt +which will be handled by the upper level firmware. This firmware will then +read the shared memory table and find an entry with the start and size of +the banner. It will then copy it for debugging purpose. The upper level +firmware will then be able to provide useful debugging information, +like in this example, the banner. + +As seen here, meminspect facilitates the interaction between the kernel +and a specific firmware. diff --git a/MAINTAINERS b/MAINTAINERS index 545a4776795e..2cb2cc427c90 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -16157,6 +16157,13 @@ F: arch/*/include/asm/sync_core.h F: include/uapi/linux/membarrier.h F: kernel/sched/membarrier.c =20 +MEMINSPECT +M: Eugen Hristev +S: Maintained +F: Documentation/dev-tools/meminspect.rst +F: include/linux/meminspect.h +F: kernel/meminspect/* + MEMBLOCK AND MEMORY MANAGEMENT INITIALIZATION M: Mike Rapoport L: linux-mm@kvack.org diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinu= x.lds.h index 8a9a2e732a65..713135d72c34 100644 --- a/include/asm-generic/vmlinux.lds.h +++ b/include/asm-generic/vmlinux.lds.h @@ -489,6 +489,8 @@ defined(CONFIG_AUTOFDO_CLANG) || defined(CONFIG_PROPELL= ER_CLANG) FW_LOADER_BUILT_IN_DATA \ TRACEDATA \ \ + MEMINSPECT_TABLE \ + \ PRINTK_INDEX \ \ /* Kernel symbol table: Normal symbols */ \ @@ -893,6 +895,17 @@ defined(CONFIG_AUTOFDO_CLANG) || defined(CONFIG_PROPEL= LER_CLANG) #define TRACEDATA #endif =20 +#ifdef CONFIG_MEMINSPECT +#define MEMINSPECT_TABLE \ + . =3D ALIGN(8); \ + .inspect_table : AT(ADDR(.inspect_table) - LOAD_OFFSET) { \ + BOUNDED_SECTION_POST_LABEL(.inspect_table, \ + __inspect_table,, _end) \ + } +#else +#define MEMINSPECT_TABLE +#endif + #ifdef CONFIG_PRINTK_INDEX #define PRINTK_INDEX \ .printk_index : AT(ADDR(.printk_index) - LOAD_OFFSET) { \ diff --git a/include/linux/meminspect.h b/include/linux/meminspect.h new file mode 100644 index 000000000000..e58b00079156 --- /dev/null +++ b/include/linux/meminspect.h @@ -0,0 +1,261 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +#ifndef _MEMINSPECT_H +#define _MEMINSPECT_H + +#include + +enum meminspect_uid { + MEMINSPECT_ID_STATIC =3D 0, + MEMINSPECT_ID_ELF, + MEMINSPECT_ID_VMCOREINFO, + MEMINSPECT_ID_CONFIG, + MEMINSPECT_ID__totalram_pages, + MEMINSPECT_ID___cpu_possible_mask, + MEMINSPECT_ID___cpu_present_mask, + MEMINSPECT_ID___cpu_online_mask, + MEMINSPECT_ID___cpu_active_mask, + MEMINSPECT_ID_mem_section, + MEMINSPECT_ID_jiffies_64, + MEMINSPECT_ID_linux_banner, + MEMINSPECT_ID_nr_threads, + MEMINSPECT_ID_nr_irqs, + MEMINSPECT_ID_tainted_mask, + MEMINSPECT_ID_taint_flags, + MEMINSPECT_ID_node_states, + MEMINSPECT_ID___per_cpu_offset, + MEMINSPECT_ID_nr_swapfiles, + MEMINSPECT_ID_init_uts_ns, + MEMINSPECT_ID_printk_rb_static, + MEMINSPECT_ID_printk_rb_dynamic, + MEMINSPECT_ID_prb, + MEMINSPECT_ID_prb_descs, + MEMINSPECT_ID_prb_infos, + MEMINSPECT_ID_prb_data, + MEMINSPECT_ID_high_memory, + MEMINSPECT_ID_init_mm, + MEMINSPECT_ID_init_mm_pgd, + MEMINSPECT_ID__sinittext, + MEMINSPECT_ID__einittext, + MEMINSPECT_ID__end, + MEMINSPECT_ID__text, + MEMINSPECT_ID__stext, + MEMINSPECT_ID__etext, + MEMINSPECT_ID_kallsyms_num_syms, + MEMINSPECT_ID_kallsyms_relative_base, + MEMINSPECT_ID_kallsyms_offsets, + MEMINSPECT_ID_kallsyms_names, + MEMINSPECT_ID_kallsyms_token_table, + MEMINSPECT_ID_kallsyms_token_index, + MEMINSPECT_ID_kallsyms_markers, + MEMINSPECT_ID_kallsyms_seqs_of_names, + MEMINSPECT_ID_swapper_pg_dir, + MEMINSPECT_ID_DYNAMIC, + MEMINSPECT_ID_MAX =3D 201, +}; + +#define MEMINSPECT_TYPE_REGULAR 0 + +#define MEMINSPECT_NOTIFIER_ADD 0 +#define MEMINSPECT_NOTIFIER_REMOVE 1 + +/** + * struct inspect_entry - memory inspect entry information + * @id: unique id for this entry + * @va: virtual address for the memory (pointer) + * @pa: physical address for the memory + * @size: size of the memory area of this entry + * @type: type of the entry (class) + */ +struct inspect_entry { + enum meminspect_uid id; + void *va; + phys_addr_t pa; + size_t size; + unsigned int type; +}; + +typedef void (*MEMINSPECT_ITERATOR_CB)(void *priv, const struct inspect_en= try *ie); + +#ifdef CONFIG_MEMINSPECT +/* .inspect_table section table markers*/ +extern const struct inspect_entry __inspect_table[]; +extern const struct inspect_entry __inspect_table_end[]; + +/* + * Annotate a static variable into inspection table. + * Can be called multiple times for the same ID, in which case + * multiple table entries will be created + */ +#define MEMINSPECT_ENTRY(idx, sym, sz) \ + static const struct inspect_entry __UNIQUE_ID(__inspect_entry_##idx) \ + __used __section(".inspect_table") =3D { .id =3D idx, \ + .va =3D (void *)&(sym), \ + .size =3D (sz), \ + } +/* + * A simple entry is just a variable, the size of the entry is the variabl= e size + * The variable can also be a pointer, the pointer itself is being added i= n this + * case. + */ +#define MEMINSPECT_SIMPLE_ENTRY(sym) \ + MEMINSPECT_ENTRY(MEMINSPECT_ID_##sym, sym, sizeof(sym)) +/* + * In the case when `sym` is not a variable, but a member of a struct e.g., + * and we cannot derive a name from it, a name must be provided. + */ +#define MEMINSPECT_NAMED_ENTRY(name, sym) \ + MEMINSPECT_ENTRY(MEMINSPECT_ID_##name, sym, sizeof(sym)) +/* + * Create a more complex entry, by registering an arbitrary memory starting + * at sym. The size is provided as a parameter. + * This is used e.g. when the symbol is a start of an unknown sized array. + */ +#define MEMINSPECT_AREA_ENTRY(sym, sz) \ + MEMINSPECT_ENTRY(MEMINSPECT_ID_##sym, sym, sz) + +/* Iterate through .inspect_table section entries */ +#define for_each_meminspect_entry(__entry) \ + for (__entry =3D __inspect_table; \ + __entry < __inspect_table_end; \ + __entry++) + +#else +#define MEMINSPECT_ENTRY(...) +#define MEMINSPECT_SIMPLE_ENTRY(...) +#define MEMINSPECT_NAMED_ENTRY(...) +#define MEMINSPECT_AREA_ENTRY(...) +#endif + +#ifdef CONFIG_MEMINSPECT + +/* + * Dynamic helpers to register entries. + * These do not lock the table, so use with caution. + */ +void meminspect_register_id_pa(enum meminspect_uid id, phys_addr_t zone, + size_t size, unsigned int type); +void meminspect_table_lock(void); +void meminspect_table_unlock(void); + +#define meminspect_register_pa(...) \ + meminspect_register_id_pa(MEMINSPECT_ID_DYNAMIC, __VA_ARGS__, MEMINSPECT_= TYPE_REGULAR) + +#define meminspect_register_id_va(id, va, size) \ + meminspect_register_id_pa(id, virt_to_phys(va), size, MEMINSPECT_TYPE_REG= ULAR) + +#define meminspect_register_va(...) \ + meminspect_register_id_va(MEMINSPECT_ID_DYNAMIC, __VA_ARGS__) + +void meminspect_unregister_pa(phys_addr_t zone, size_t size); +void meminspect_unregister_id(enum meminspect_uid id); + +#define meminspect_unregister_va(va, size) \ + meminspect_unregister_pa(virt_to_phys(va), size) + +void meminspect_traverse(void *priv, MEMINSPECT_ITERATOR_CB cb); + +/* + * Producers, or registrators, are advised to use the locked API below + */ +#define meminspect_lock_register_pa(...) \ + { \ + meminspect_table_lock(); \ + meminspect_register_pa(__VA_ARGS__); \ + meminspect_table_unlock(); \ + } + +#define meminspect_lock_register_id_va(...) \ + { \ + meminspect_table_lock(); \ + meminspect_register_id_va(__VA_ARGS__); \ + meminspect_table_unlock(); \ + } + +#define meminspect_lock_register_va(...) \ + { \ + meminspect_table_lock(); \ + meminspect_register_va(__VA_ARGS__); \ + meminspect_table_unlock(); \ + } + +#define meminspect_lock_unregister_pa(...) \ + { \ + meminspect_table_lock(); \ + meminspect_unregister_pa(__VA_ARGS__); \ + meminspect_table_unlock(); \ + } + +#define meminspect_lock_unregister_va(...) \ + { \ + meminspect_table_lock(); \ + meminspect_unregister_va(__VA_ARGS__); \ + meminspect_table_unlock(); \ + } + +#define meminspect_lock_unregister_id(...) \ + { \ + meminspect_table_lock(); \ + meminspect_unregister_id(__VA_ARGS__); \ + meminspect_table_unlock(); \ + } + +#define meminspect_lock_traverse(...) \ + { \ + meminspect_table_lock(); \ + meminspect_traverse(__VA_ARGS__); \ + meminspect_table_unlock(); \ + } + +int meminspect_notifier_register(struct notifier_block *n); +int meminspect_notifier_unregister(struct notifier_block *n); + +#else +static inline void meminspect_register_id_pa(enum meminspect_uid id, + phys_addr_t zone, + size_t size, unsigned int type) +{ +} + +static inline void meminspect_table_lock(void) +{ +} + +static inline void meminspect_table_unlock(void) +{ +} + +static inline void meminspect_unregister(phys_addr_t zone, size_t size) +{ +} + +static inline void meminspect_unregister_id(enum meminspect_uid id) +{ +} + +static inline void meminspect_traverse(MEMINSPECT_ITERATOR_CB cb) +{ +} + +static inline int meminspect_notifier_register(struct notifier_block *n) +{ + return 0; +} + +static inline int meminspect_notifier_unregister(struct notifier_block *n) +{ + return 0; +} + +#define meminspect_register_pa(...) +#define meminspect_register_id_va(...) +#define meminspect_register_va(...) +#define meminspect_lock_register_pa(...) +#define meminspect_lock_register_va(...) +#define meminspect_lock_register_id_va(...) +#define meminspect_lock_traverse(...) +#define meminspect_lock_unregister_va(...) +#define meminspect_lock_unregister_pa(...) +#define meminspect_lock_unregister_id(...) +#endif + +#endif diff --git a/init/Kconfig b/init/Kconfig index cab3ad28ca49..d48647419944 100644 --- a/init/Kconfig +++ b/init/Kconfig @@ -2138,6 +2138,8 @@ config TRACEPOINTS =20 source "kernel/Kconfig.kexec" =20 +source "kernel/meminspect/Kconfig" + endmenu # General setup =20 source "arch/Kconfig" diff --git a/kernel/Makefile b/kernel/Makefile index df3dd8291bb6..83ec5310dfd1 100644 --- a/kernel/Makefile +++ b/kernel/Makefile @@ -50,6 +50,7 @@ obj-y +=3D locking/ obj-y +=3D power/ obj-y +=3D printk/ obj-y +=3D irq/ +obj-y +=3D meminspect/ obj-y +=3D rcu/ obj-y +=3D livepatch/ obj-y +=3D dma/ diff --git a/kernel/meminspect/Kconfig b/kernel/meminspect/Kconfig new file mode 100644 index 000000000000..8680fbf0e285 --- /dev/null +++ b/kernel/meminspect/Kconfig @@ -0,0 +1,20 @@ +# SPDX-License-Identifier: GPL-2.0 + +config MEMINSPECT + bool "Allow the kernel to register memory regions for inspection purpose" + help + Inspection mechanism allows registration of a specific memory + area(or object) for later inspection purpose. + Ranges are being added into an inspection table, which can be + requested and analyzed by specific drivers. + Drivers would interface any hardware mechanism that will allow + inspection of the data, including but not limited to: dumping + for debugging, creating a coredump, analysis, or statistical + information. + Inspection table is created ahead of time such that it can be later + used regardless of the state of the kernel (running, frozen, crashed, + or any particular state). + + Note that modules using this feature must be rebuilt if option + changes. + diff --git a/kernel/meminspect/Makefile b/kernel/meminspect/Makefile new file mode 100644 index 000000000000..09fd55e6d9cf --- /dev/null +++ b/kernel/meminspect/Makefile @@ -0,0 +1,3 @@ +# SPDX-License-Identifier: GPL-2.0 + +obj-$(CONFIG_MEMINSPECT) +=3D meminspect.o diff --git a/kernel/meminspect/meminspect.c b/kernel/meminspect/meminspect.c new file mode 100644 index 000000000000..0d9ad65ba92e --- /dev/null +++ b/kernel/meminspect/meminspect.c @@ -0,0 +1,470 @@ +// SPDX-License-Identifier: GPL-2.0 + +#include +#include +#include +#include +#include +#include +#include +#include + +static DEFINE_MUTEX(meminspect_lock); +static struct inspect_entry inspect_entries[MEMINSPECT_ID_MAX]; + +ATOMIC_NOTIFIER_HEAD(meminspect_notifier_list); + +#ifdef CONFIG_CRASH_DUMP + +#define CORE_STR "CORE" + +static struct elfhdr *ehdr; +static size_t elf_offset; +static bool elf_hdr_ready; + +static void append_kcore_note(char *notes, size_t *i, const char *name, + unsigned int type, const void *desc, + size_t descsz) +{ + struct elf_note *note =3D (struct elf_note *)¬es[*i]; + + note->n_namesz =3D strlen(name) + 1; + note->n_descsz =3D descsz; + note->n_type =3D type; + *i +=3D sizeof(*note); + memcpy(¬es[*i], name, note->n_namesz); + *i =3D ALIGN(*i + note->n_namesz, 4); + memcpy(¬es[*i], desc, descsz); + *i =3D ALIGN(*i + descsz, 4); +} + +static void append_kcore_note_nodesc(char *notes, size_t *i, const char *n= ame, + unsigned int type, size_t descsz) +{ + struct elf_note *note =3D (struct elf_note *)¬es[*i]; + + note->n_namesz =3D strlen(name) + 1; + note->n_descsz =3D descsz; + note->n_type =3D type; + *i +=3D sizeof(*note); + memcpy(¬es[*i], name, note->n_namesz); + *i =3D ALIGN(*i + note->n_namesz, 4); +} + +static struct elf_phdr *elf_phdr_entry_addr(struct elfhdr *ehdr, int idx) +{ + struct elf_phdr *ephdr =3D (struct elf_phdr *)((size_t)ehdr + ehdr->e_pho= ff); + + return &ephdr[idx]; +} + +static int clear_elfheader(const struct inspect_entry *e) +{ + struct elf_phdr *phdr; + struct elf_phdr *tmp_phdr; + unsigned int phidx; + unsigned int i; + + for (i =3D 0; i < ehdr->e_phnum; i++) { + phdr =3D elf_phdr_entry_addr(ehdr, i); + if (phdr->p_paddr =3D=3D e->pa && + phdr->p_memsz =3D=3D ALIGN(e->size, 4)) + break; + } + + if (i =3D=3D ehdr->e_phnum) { + pr_debug("Cannot find program header entry in elf\n"); + return -EINVAL; + } + + phidx =3D i; + + /* Clear program header */ + tmp_phdr =3D elf_phdr_entry_addr(ehdr, phidx); + for (i =3D phidx; i < ehdr->e_phnum - 1; i++) { + tmp_phdr =3D elf_phdr_entry_addr(ehdr, i + 1); + phdr =3D elf_phdr_entry_addr(ehdr, i); + memcpy(phdr, tmp_phdr, sizeof(*phdr)); + phdr->p_offset =3D phdr->p_offset - ALIGN(e->size, 4); + } + memset(tmp_phdr, 0, sizeof(*tmp_phdr)); + ehdr->e_phnum--; + + elf_offset -=3D ALIGN(e->size, 4); + + return 0; +} + +static void update_elfheader(const struct inspect_entry *e) +{ + struct elf_phdr *phdr; + + phdr =3D elf_phdr_entry_addr(ehdr, ehdr->e_phnum++); + + phdr->p_type =3D PT_LOAD; + phdr->p_offset =3D elf_offset; + phdr->p_vaddr =3D (elf_addr_t)e->va; + if (e->pa) + phdr->p_paddr =3D (elf_addr_t)e->pa; + else + phdr->p_paddr =3D (elf_addr_t)virt_to_phys(e->va); + phdr->p_filesz =3D phdr->p_memsz =3D ALIGN(e->size, 4); + phdr->p_flags =3D PF_R | PF_W; + + elf_offset +=3D ALIGN(e->size, 4); +} + +/* + * This function prepares the elf header for the coredump image. + * Initially there is a single program header for the elf NOTE. + * The note contains the usual core dump information, and the vmcoreinfo. + */ +static int init_elfheader(void) +{ + struct elf_phdr *phdr; + void *notes; + unsigned int elfh_size, buf_sz; + unsigned int phdr_off; + size_t note_len, i =3D 0; + struct page *p; + + struct elf_prstatus prstatus =3D {}; + struct elf_prpsinfo prpsinfo =3D { + .pr_sname =3D 'R', + .pr_fname =3D "vmlinux", + }; + + /* + * Header buffer contains: + * ELF header, Note entry with PR status, PR ps info, and vmcoreinfo. + * Also, MEMINSPECT_ID_MAX program headers. + */ + elfh_size =3D sizeof(*ehdr); + elfh_size +=3D sizeof(struct elf_prstatus); + elfh_size +=3D sizeof(struct elf_prpsinfo); + elfh_size +=3D sizeof(VMCOREINFO_NOTE_NAME); + elfh_size +=3D ALIGN(vmcoreinfo_size, 4); + elfh_size +=3D (sizeof(*phdr)) * (MEMINSPECT_ID_MAX); + + elfh_size =3D ALIGN(elfh_size, 4); + + /* Length of the note is made of : + * 3 elf notes structs (prstatus, prpsinfo, vmcoreinfo) + * 3 notes names (2 core strings, 1 vmcoreinfo name) + * sizeof each note + */ + note_len =3D (3 * sizeof(struct elf_note) + + 2 * ALIGN(sizeof(CORE_STR), 4) + + VMCOREINFO_NOTE_NAME_BYTES + + ALIGN(sizeof(struct elf_prstatus), 4) + + ALIGN(sizeof(struct elf_prpsinfo), 4) + + ALIGN(vmcoreinfo_size, 4)); + + buf_sz =3D elfh_size + note_len - ALIGN(vmcoreinfo_size, 4); + + /* Never freed */ + p =3D dma_alloc_from_contiguous(NULL, buf_sz >> PAGE_SHIFT, + get_order(buf_sz), true); + if (!p) + return -ENOMEM; + + ehdr =3D dma_common_contiguous_remap(p, buf_sz, + pgprot_decrypted(pgprot_dmacoherent(PAGE_KERNEL)), + __builtin_return_address(0)); + if (!ehdr) { + dma_release_from_contiguous(NULL, p, buf_sz >> PAGE_SHIFT); + return -ENOMEM; + } + + memset(ehdr, 0, elfh_size); + + /* Assign Program headers offset, it's right after the elf header. */ + phdr =3D (struct elf_phdr *)(ehdr + 1); + phdr_off =3D sizeof(*ehdr); + + memcpy(ehdr->e_ident, ELFMAG, SELFMAG); + ehdr->e_ident[EI_CLASS] =3D ELF_CLASS; + ehdr->e_ident[EI_DATA] =3D ELF_DATA; + ehdr->e_ident[EI_VERSION] =3D EV_CURRENT; + ehdr->e_ident[EI_OSABI] =3D ELF_OSABI; + ehdr->e_type =3D ET_CORE; + ehdr->e_machine =3D ELF_ARCH; + ehdr->e_version =3D EV_CURRENT; + ehdr->e_ehsize =3D sizeof(*ehdr); + ehdr->e_phentsize =3D sizeof(*phdr); + + elf_offset =3D elfh_size; + + notes =3D (void *)(((char *)ehdr) + elf_offset); + + /* we have a single program header now */ + ehdr->e_phnum =3D 1; + + phdr->p_type =3D PT_NOTE; + phdr->p_offset =3D elf_offset; + phdr->p_filesz =3D note_len; + + /* advance elf offset */ + elf_offset +=3D note_len; + + strscpy(prpsinfo.pr_psargs, saved_command_line, + sizeof(prpsinfo.pr_psargs)); + + append_kcore_note(notes, &i, CORE_STR, NT_PRSTATUS, &prstatus, + sizeof(prstatus)); + append_kcore_note(notes, &i, CORE_STR, NT_PRPSINFO, &prpsinfo, + sizeof(prpsinfo)); + append_kcore_note_nodesc(notes, &i, VMCOREINFO_NOTE_NAME, 0, + ALIGN(vmcoreinfo_size, 4)); + + ehdr->e_phoff =3D phdr_off; + + /* This is the first coredump region, the ELF header */ + meminspect_register_id_pa(MEMINSPECT_ID_ELF, page_to_phys(p), + buf_sz, MEMINSPECT_TYPE_REGULAR); + + /* + * The second region is the vmcoreinfo, which goes right after. + * It's being registered through vmcoreinfo. + */ + + return 0; +} +#endif + +/** + * meminspect_unregister_id() - Unregister region from inspection table. + * @id: region's id in the table + * + * Return: None + */ +void meminspect_unregister_id(enum meminspect_uid id) +{ + struct inspect_entry *e; + + WARN_ON(!mutex_is_locked(&meminspect_lock)); + + e =3D &inspect_entries[id]; + if (!e->id) + return; + + atomic_notifier_call_chain(&meminspect_notifier_list, + MEMINSPECT_NOTIFIER_REMOVE, e); +#ifdef CONFIG_CRASH_DUMP + if (elf_hdr_ready) + clear_elfheader(e); +#endif + memset(e, 0, sizeof(*e)); +} +EXPORT_SYMBOL_GPL(meminspect_unregister_id); + +/** + * meminspect_unregister_pa() - Unregister region from inspection table. + * @pa: Physical address of the memory region to remove + * @size: Size of the memory region to remove + * + * Return: None + */ +void meminspect_unregister_pa(phys_addr_t pa, size_t size) +{ + struct inspect_entry *e; + enum meminspect_uid i; + + WARN_ON(!mutex_is_locked(&meminspect_lock)); + + for (i =3D MEMINSPECT_ID_STATIC; i < MEMINSPECT_ID_MAX; i++) { + e =3D &inspect_entries[i]; + if (e->pa !=3D pa) + continue; + if (e->size !=3D size) + continue; + meminspect_unregister_id(e->id); + return; + } +} +EXPORT_SYMBOL_GPL(meminspect_unregister_pa); + +/** + * meminspect_register_id_pa() - Register region into inspection table + * with given ID and physical address. + * @req_id: Requested unique meminspect_uid that identifies the region + * This can be MEMINSPECT_ID_DYNAMIC, in which case the function will + * find an unused ID and register with it. + * @pa: physical address of the memory region + * @size: region size + * @type: region type + * + * Return: None + */ +void meminspect_register_id_pa(enum meminspect_uid req_id, phys_addr_t pa, + size_t size, unsigned int type) +{ + struct inspect_entry *e; + enum meminspect_uid uid =3D req_id; + + WARN_ON(!mutex_is_locked(&meminspect_lock)); + + if (uid < MEMINSPECT_ID_STATIC || uid >=3D MEMINSPECT_ID_MAX) + return; + + if (uid =3D=3D MEMINSPECT_ID_DYNAMIC) + while (uid < MEMINSPECT_ID_MAX) { + if (!inspect_entries[uid].id) + break; + uid++; + } + + if (uid =3D=3D MEMINSPECT_ID_MAX) + return; + + e =3D &inspect_entries[uid]; + + if (e->id) + meminspect_unregister_id(e->id); + + e->pa =3D pa; + e->va =3D phys_to_virt(pa); + e->size =3D size; + e->id =3D uid; + e->type =3D type; +#ifdef CONFIG_CRASH_DUMP + if (elf_hdr_ready) + update_elfheader(e); +#endif + atomic_notifier_call_chain(&meminspect_notifier_list, + MEMINSPECT_NOTIFIER_ADD, e); +} +EXPORT_SYMBOL_GPL(meminspect_register_id_pa); + +/** + * meminspect_table_lock() - Lock the mutex on the inspection table + * + * Return: None + */ +void meminspect_table_lock(void) +{ + mutex_lock(&meminspect_lock); +} +EXPORT_SYMBOL_GPL(meminspect_table_lock); + +/** + * meminspect_table_unlock() - Unlock the mutex on the inspection table + * + * Return: None + */ +void meminspect_table_unlock(void) +{ + mutex_unlock(&meminspect_lock); +} +EXPORT_SYMBOL_GPL(meminspect_table_unlock); + +/** + * meminspect_traverse() - Traverse the meminspect table and call the + * callback function for each valid entry. + * @priv: private data to be called to the callback + * @cb: meminspect iterator callback that should be called for each entry + * + * Return: None + */ +void meminspect_traverse(void *priv, MEMINSPECT_ITERATOR_CB cb) +{ + const struct inspect_entry *e; + int i; + + WARN_ON(!mutex_is_locked(&meminspect_lock)); + + for (i =3D MEMINSPECT_ID_STATIC; i < MEMINSPECT_ID_MAX; i++) { + e =3D &inspect_entries[i]; + if (e->id) + cb(priv, e); + } +} +EXPORT_SYMBOL_GPL(meminspect_traverse); + +/** + * meminspect_notifier_register() - Register a notifier to meminspect table + * @n: notifier block to register. This will be called whenever an entry + * is being added or removed. + * + * Return: errno + */ +int meminspect_notifier_register(struct notifier_block *n) +{ + return atomic_notifier_chain_register(&meminspect_notifier_list, n); +} +EXPORT_SYMBOL_GPL(meminspect_notifier_register); + +/** + * meminspect_notifier_unregister() - Unregister a previously registered + * notifier from meminspect table. + * @n: notifier block to unregister. + * + * Return: errno + */ +int meminspect_notifier_unregister(struct notifier_block *n) +{ + return atomic_notifier_chain_unregister(&meminspect_notifier_list, n); +} +EXPORT_SYMBOL_GPL(meminspect_notifier_unregister); + +#ifdef CONFIG_CRASH_DUMP +static int __init meminspect_prepare_crashdump(void) +{ + const struct inspect_entry *e; + int ret; + enum meminspect_uid i; + + ret =3D init_elfheader(); + + if (ret < 0) + return ret; + + /* + * Some regions may have been registered very early. + * Update the elf header for all existing regions, + * except for MEMINSPECT_ID_ELF and MEMINSPECT_ID_VMCOREINFO, + * those are included in the ELF header upon its creation. + */ + for (i =3D MEMINSPECT_ID_VMCOREINFO + 1; i < MEMINSPECT_ID_MAX; i++) { + e =3D &inspect_entries[i]; + if (e->id) + update_elfheader(e); + } + + elf_hdr_ready =3D true; + + return 0; +} +#endif + +static int __init meminspect_prepare_table(void) +{ + const struct inspect_entry *e; + enum meminspect_uid i; + + meminspect_table_lock(); + /* + * First, copy all entries from the compiler built table + * In case some entries are registered multiple times, + * the last chronological entry will be stored. + * Previusly registered entries will be dropped. + */ + for_each_meminspect_entry(e) { + inspect_entries[e->id] =3D *e; + } +#ifdef CONFIG_CRASH_DUMP + meminspect_prepare_crashdump(); +#endif + /* if we have early notifiers registered, call them now */ + for (i =3D MEMINSPECT_ID_STATIC; i < MEMINSPECT_ID_MAX; i++) + if (inspect_entries[i].id) + atomic_notifier_call_chain(&meminspect_notifier_list, + MEMINSPECT_NOTIFIER_ADD, + &inspect_entries[i]); + meminspect_table_unlock(); + + pr_debug("Memory inspection table initialized"); + + return 0; +} +late_initcall(meminspect_prepare_table); --=20 2.43.0 From nobody Tue Dec 2 02:19:50 2025 Received: from mail-wr1-f53.google.com (mail-wr1-f53.google.com [209.85.221.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 41C512EBBB7 for ; Wed, 19 Nov 2025 15:45:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.53 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763567127; cv=none; b=Cz7zfMNwKczf74wfh0r9NmlsNJTVgvIRHF4hZDH1dxnd/6uff5AQ3db6RU4XrUOWDziFTWr14Rz4McFq4/QfjB98T/025jyk1WI42rmVocUTIyhVQxWTYj0eSEckS8i+XmDFj8LmRrBWotE7t6Zum2MKIWQho0VS0zN8uYa7VQM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763567127; c=relaxed/simple; bh=u6+tt3XawPHF2h0PehB6Hh7l1nZTQ0AU8uD6w2tCd9w=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=LBNzxIQo+tjOk3fjIHj1yIyeTmd0ttUlU2hVVlROleEkjpusaChYbvw9UCCKo5QQbsoIuMedqJ8Hq+Ajw5v7ZZ35y99fHCYCBfG33ph55YEoo6CJpZ6WFtiY6kimtD3JF8EEOpJiPL+HP/GL7+KAA1jHmCFsqOyVF/qpipZyflI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=S5pyMbCL; arc=none smtp.client-ip=209.85.221.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="S5pyMbCL" Received: by mail-wr1-f53.google.com with SMTP id ffacd0b85a97d-42b32900c8bso3968611f8f.0 for ; Wed, 19 Nov 2025 07:45:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1763567120; x=1764171920; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=IgUegTKLQ5c0JCFFEcjPGQkSMjLGl3oe1WVgssxW3WQ=; b=S5pyMbCLkC+99Hx1gcI70qTu4rEHdL33Myi9JVWNml9rEIK8AWQfKJChpsnOS0UXSD xT/grITh57yDq5oiBWFs9gcA/vwkvJvSVf3fFbGjJew9lJHf/W54qPdFGXHI27RSZ4As 7wtTkt42jRzrr0w4QQR4QBSzJv4PWWykiLymHhJNfnm6CDzJ1dLWtfC3uBB9XM3mU1cK FOQ3ib967M/9a3nhOC8EWr6flSDFk6rCgVV1g9lIsY3rurcRSu3uOB6VQWjXNzku79Lo 2U28dsxwUkHJs6xhLfM/kz7nq1RnfFvGWiLU3ZHW4hdsQr3pf70KGHr6ddavAO0o5uqe rwAQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763567120; x=1764171920; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=IgUegTKLQ5c0JCFFEcjPGQkSMjLGl3oe1WVgssxW3WQ=; b=ghORUJ7vMLXvqvRVtxoPfAlmRe5BwmcG5XY4zTrrJw5OEczncJNhCJRti5Wvq8SHEZ T/31KCvr1y4M2Yn7Jfsux6QjxBCaOwCgcY47FEK3/TaCodVMGPJhWfy7otCAORvW1b7R fL/W6GtSONKDXjMIHt7CHu2H3N8QST18xfFiaDVjJE6QvMdlsWizxLMvY/gjDcOZJE75 6Afk/HS2Mr6KkQpd2n4U6NfDtX03vnr7VliE0UcUQvM4A+sbYoqZzcIPe+UpOYNUr3b2 4Ep/pRTIpMBxKj/f+VyWP9i5ALvFx8IQzhyY/qk5Tta9z6hARICEEV7mqNUH6Y7xlQwy SBAg== X-Forwarded-Encrypted: i=1; AJvYcCUR+2OZ+uHS5XcRbyBD04nC2Q1DSWqlzyyCHA+fnEJUiRARyNZllEGl/3IBNRmHuf1rgMcyaVh2Xu5Y95A=@vger.kernel.org X-Gm-Message-State: AOJu0Yx1iue2HVjur5tc2zOX++XuCLPkkxwXqD4HxiDMHovweGBzwaU2 NSoJ95neNySSL8GWdaVbLsBBwuik0mc7lIpKhsOHeggMn5i/ZFMJ5BvfWWeVQxr1u1c= X-Gm-Gg: ASbGnctZDP3x6m4YLQYWulW1K6K5Q8PQhDQxiplS5aG+OWVfH+inxulbTcf+BWgT42j TE9OekK5mhvEvJZeNZNIF+V71Y9+kRikbGO0BSqyv3AoRiGsh2+bhluch5tA7Icy3sZYfPrmBa6 gS5zMqRT/gtYxtMZ6H5eASumOvtVd3YkCsvBp/USguMaC1F2oIPwqdyPKDcnFUt9wXqIEv+nLXZ vRY17MDHbuyOz4UFyHKjBEw2yW2rAoaUGhUxAWDFtjE44rtaPM2dNjBTWU3Ju5/uB7OKrcmGj66 eslUGYC3HvKckEwBTsHjioskliIhrJQX/W8UhCej+5gmbQPnT4XlzGPi0xhmUTdkCCElqoqnEYU /p0TmXxRnC+mgO6XlRLIPPL7xkYlS4gWj1bma7bpL0BMLP4+sk2zZow96Pn4XffQQ34AawqkWMB k3DM5Zqk0yjbforBNToNuq1QHwb5xU7tOjO3pZfxR2 X-Google-Smtp-Source: AGHT+IE38LHRCo1rRgXHbp1dPmtNTHQzc/1FY0jCSEqGBXN/4naA4QLiTpPfAdRH3ooZXhi3gOLsPg== X-Received: by 2002:a05:6000:2087:b0:42b:3ab7:b8b8 with SMTP id ffacd0b85a97d-42cb1f5d859mr3485815f8f.25.1763567120163; Wed, 19 Nov 2025 07:45:20 -0800 (PST) Received: from eugen-station.. ([82.76.24.202]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-42b53dea1c9sm38765632f8f.0.2025.11.19.07.45.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Nov 2025 07:45:19 -0800 (PST) From: Eugen Hristev To: linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, tglx@linutronix.de, andersson@kernel.org, pmladek@suse.com, rdunlap@infradead.org, corbet@lwn.net, david@redhat.com, mhocko@suse.com Cc: tudor.ambarus@linaro.org, mukesh.ojha@oss.qualcomm.com, linux-arm-kernel@lists.infradead.org, linux-hardening@vger.kernel.org, jonechou@google.com, rostedt@goodmis.org, linux-doc@vger.kernel.org, devicetree@vger.kernel.org, linux-remoteproc@vger.kernel.org, linux-arch@vger.kernel.org, tony.luck@intel.com, kees@kernel.org, Eugen Hristev Subject: [PATCH 02/26] init/version: Annotate static information into meminspect Date: Wed, 19 Nov 2025 17:44:03 +0200 Message-ID: <20251119154427.1033475-3-eugen.hristev@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251119154427.1033475-1-eugen.hristev@linaro.org> References: <20251119154427.1033475-1-eugen.hristev@linaro.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Annotate vital static information into inspection table: - init_uts_ns - linux_banner Information on these variables is stored into dedicated meminspect section. Signed-off-by: Eugen Hristev --- init/version-timestamp.c | 3 +++ init/version.c | 3 +++ 2 files changed, 6 insertions(+) diff --git a/init/version-timestamp.c b/init/version-timestamp.c index d071835121c2..6f920d0e1169 100644 --- a/init/version-timestamp.c +++ b/init/version-timestamp.c @@ -6,6 +6,7 @@ #include #include #include +#include =20 struct uts_namespace init_uts_ns =3D { .ns.ns_type =3D ns_common_type(&init_uts_ns), @@ -29,3 +30,5 @@ struct uts_namespace init_uts_ns =3D { const char linux_banner[] =3D "Linux version " UTS_RELEASE " (" LINUX_COMPILE_BY "@" LINUX_COMPILE_HOST ") (" LINUX_COMPILER ") " UTS_VERSION "\n"; + +MEMINSPECT_SIMPLE_ENTRY(linux_banner); diff --git a/init/version.c b/init/version.c index 94c96f6fbfe6..eeb139236562 100644 --- a/init/version.c +++ b/init/version.c @@ -16,6 +16,7 @@ #include #include #include +#include =20 static int __init early_hostname(char *arg) { @@ -51,4 +52,6 @@ const char linux_banner[] __weak; =20 #include "version-timestamp.c" =20 +MEMINSPECT_SIMPLE_ENTRY(init_uts_ns); + EXPORT_SYMBOL_GPL(init_uts_ns); --=20 2.43.0 From nobody Tue Dec 2 02:19:50 2025 Received: from mail-wm1-f53.google.com (mail-wm1-f53.google.com [209.85.128.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B0CFB2E543E for ; Wed, 19 Nov 2025 15:45:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.53 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763567128; cv=none; b=c3CDo1ze4+b9Dfl66spC+T1D2vsTNm052RH0VB6Qjm3k8oiRWzRj4hAs5xTU882alyCqTZb3NmWx1D6XCsD6AcgHVbrJUPSx4SFx68kH0c9dPsojDQeD1e0wkTRdGBmVdpazYIQmHOS8Z5zxsvZd/o8EAaD4yrDTCwjKkno7M88= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763567128; c=relaxed/simple; bh=xVX5vMoWLhUppTQAzGqUyciUL0HvTWD+fRU1g1HFtlY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=rUCInn1eiu7vxa6HDff5IPY1MQ74LZgxbINfHQ7N6JhpTVfIs3XtwA5aQT1sX6BrurHkOPmjqTqoDQErglQQZGBijgasZb7xqGWaagHBBBB0KdyGubOmDXGeaL1kcxo9w90m+qySKtk6hVOnHg33jVUZUIFGrj4nAk3Cvi6TRRI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=s77ePi5V; arc=none smtp.client-ip=209.85.128.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="s77ePi5V" Received: by mail-wm1-f53.google.com with SMTP id 5b1f17b1804b1-477549b3082so56837775e9.0 for ; Wed, 19 Nov 2025 07:45:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1763567122; x=1764171922; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=0blJpzJVpLViS6yP++1+Q3N2n4IWObMjESar9bHwcO4=; b=s77ePi5VwhAc5RdCjyAb302P4Ka1p3s03BC0V2FspdVUm4i7WYiQ2/MLytX6QDfaGN kK0mUXAjWAWky+BcR4OpUoRFi0GuLC8Jj5SFvNrkKqqTO0fWekjRVtmOv5IQvQfdHEQK TgXteXNfAy3vUVfU4mt5qaDa2qJFDh+l7TG550TjqEsNBBo3aCcHsKC73Ycok+9pbhk4 4qiYo9F/ku0uKX/a+S6dfpVvgv0UCLbmIZ6q2Z3sPsILWyDBj5OUEh6kQHBhCPh7EmVD hwar1tExtLfqrIQdYXQl1vj4KnszoQmpLBQ0hyx18qnEvaC6g0olZ5w+plmslpAGCUNT kFyQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763567122; x=1764171922; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=0blJpzJVpLViS6yP++1+Q3N2n4IWObMjESar9bHwcO4=; b=xURSetuY7x03lNmjOmYRCq3oepUdy/lJOmloxaTBN45Wpo+OOVqOanivYvrY+LrWV5 B8VxWr0wLhDKS8fn37z4xAtrMkHIxGDt/5Q19dEJnsKRY+ggbRQjLJ/iW7VF2IWq7XHr giU9WMIdMtPYTZUGFvyANBv1lapxAIj1dirkyyvRPN+0teNNZV2qFmCQRdnqYshl3/Z3 7w1BTV7VG4R5kvPmrA2uwLf0gQ1jqtXjvEv7V+EpRiWJcqW2Qg5lKm3kMMZay2KJpD74 d5mFnDyLmw96YMBE7PuWLamJDMd4agXWAFUSlQbkxYgnfcza9G6JGoWEUPvyndl9mEhu v3Bw== X-Forwarded-Encrypted: i=1; AJvYcCWVYveE6X0ZdypavIpKkn9lX+TBRikp3FUFgkNYSl5DgXZ/slK7d0nTJLeaUk6bPE6/USh8bZp+GroDU0c=@vger.kernel.org X-Gm-Message-State: AOJu0YwBEpc649ziYSW1ozIgGFYTUWWKoMpZ8Q6+fLWez8K3z+jnwBVh 1i1RxaFc9Zbz2oiEbUSO1sb9ZVL+40Krt5Y7VCqYnGtfDHecA8jMB250UAA3ClLUIyM= X-Gm-Gg: ASbGncu8BK4A/JOt4Qfne5UokM1X7xPLr0a6xQhxXJNx9D1bVpn5Vzu+NrCJ/4lPlRq 0uDGlfa7WonDdbs2IwNibFQwPTrLGjYvWL3llnZRvkVQrMeWE/XkDtq4B/c0u+pxYLks9QXMdFD /HzY6bIJ9gv0aCNT16CGJo/pWLxl8xUsjFUyYQvX3cZ0kTn88enkpYexERXBgsxmr3CiZQ6e/d5 Rmg/syxMru0cKLJPrXm9e05l4L00tDNtyhsDK5//CS4HkN/lI8SDKHz3dMj9TJgDUkImavedtIq wchCzklLXeKxvVXQP7ZcBxsHjSFi6UkEnvPfUSJ1Aybw3yB3x9z/2oO7WdYO9pRpxfROP+EAHrS QDDnbxoMHaA7j+lWCUh/i2MtHix3036wzmmwE9lRmBTovWw0EvulbnkhiAwZO2nuEEMUGmsnTRS UQrbVHNHllR5W/Irdp7QM= X-Google-Smtp-Source: AGHT+IEf0A8SfCPAIU5Y+01ECXL2jbadglpozgNAZPe+3fJhQYPBk8r7h45IbtadEb3Wt583O3k4NA== X-Received: by 2002:a05:600c:3587:b0:477:58af:a91d with SMTP id 5b1f17b1804b1-4778fe522f3mr209598755e9.5.1763567121930; Wed, 19 Nov 2025 07:45:21 -0800 (PST) Received: from eugen-station.. ([82.76.24.202]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-42b53dea1c9sm38765632f8f.0.2025.11.19.07.45.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Nov 2025 07:45:21 -0800 (PST) From: Eugen Hristev To: linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, tglx@linutronix.de, andersson@kernel.org, pmladek@suse.com, rdunlap@infradead.org, corbet@lwn.net, david@redhat.com, mhocko@suse.com Cc: tudor.ambarus@linaro.org, mukesh.ojha@oss.qualcomm.com, linux-arm-kernel@lists.infradead.org, linux-hardening@vger.kernel.org, jonechou@google.com, rostedt@goodmis.org, linux-doc@vger.kernel.org, devicetree@vger.kernel.org, linux-remoteproc@vger.kernel.org, linux-arch@vger.kernel.org, tony.luck@intel.com, kees@kernel.org, Eugen Hristev Subject: [PATCH 03/26] mm/percpu: Annotate static information into meminspect Date: Wed, 19 Nov 2025 17:44:04 +0200 Message-ID: <20251119154427.1033475-4-eugen.hristev@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251119154427.1033475-1-eugen.hristev@linaro.org> References: <20251119154427.1033475-1-eugen.hristev@linaro.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Annotate vital static information into meminspect: - __per_cpu_offset Information on these variables is stored into dedicated inspection section. Signed-off-by: Eugen Hristev --- mm/percpu.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mm/percpu.c b/mm/percpu.c index 81462ce5866e..cdc5b30f6a99 100644 --- a/mm/percpu.c +++ b/mm/percpu.c @@ -87,6 +87,7 @@ #include #include #include +#include =20 #include #include @@ -3346,6 +3347,7 @@ void __init setup_per_cpu_areas(void) =20 #endif /* CONFIG_SMP */ =20 +MEMINSPECT_SIMPLE_ENTRY(__per_cpu_offset); /* * pcpu_nr_pages - calculate total number of populated backing pages * --=20 2.43.0 From nobody Tue Dec 2 02:19:50 2025 Received: from mail-wr1-f54.google.com (mail-wr1-f54.google.com [209.85.221.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EB2E32EBB88 for ; Wed, 19 Nov 2025 15:45:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763567129; cv=none; b=ckdm5S00d2tDYos30BkUu/B5SR0/nVAh63dkE+hQmG3d6WsaKxfBIiOOBpfDt2JmEOQXxZ5fksL67x3xpwlDA2cxk2BUyW8Ju0QZwPDCdqdm2glDqnlMtB+BfWGhECerNui+356hoRyITZLp50Er5BSigRF/AObxoGGfQqjM858= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763567129; c=relaxed/simple; bh=T6SjDhmcY0qxcuyqrC2MrBGCJa3hOQc9OYm2K6gInfg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Nwe5G8OmVZJ5f5gUSFC0vGA0+6VjMlFdgZwuZq1vuMVGkNj2zv+8vmkyYZnXfNJSsgN0ZBtMKAJmRWi53zfpWdlcGB1h9yDpOlSfwJ5VLnCiK3fxsctgMkQQbedAXp2tFgv3SeF0/UReyLrSIn1uaQKI782g38M0G5ft9KQzavk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=FslOMpT0; arc=none smtp.client-ip=209.85.221.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="FslOMpT0" Received: by mail-wr1-f54.google.com with SMTP id ffacd0b85a97d-42b3d7c1321so4797160f8f.3 for ; Wed, 19 Nov 2025 07:45:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1763567124; x=1764171924; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=NCvJkYlF4keL+Fd6f7hwRGbLb7cgm1v1S6Qn3Ctc9SY=; b=FslOMpT0D6lQ2kcCfXCiK0uWzCKjdNJ+AScQFNAM8TZvG3xEM7hVRVsKm91uZMaTvz 4ob7Vilx6or0EGs2w+NmOwSkxBsRgfBYuD4SXQ1WbbhJKL95YIWP18GQZJrCJn4gXokf tudwNkwtKWBIJqQsMpTYbscsCy2OJigihpRNBGv+IyyKzjhSkKhfzVARu4Qyx6Hkq0mm 1I86zQNM4dXOBcXvNdoMUynBcD7yv7L6gKD5o1nmiPzDy6GzgNzrtWtBJYAKSrgDIaK6 pRjDKWJeLrjp7UAQu+Ih0+8lSAKK0ipcr5Lla6ZRc+MOkqYY/bqS7qUUjRISp7uAjz90 dUuA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763567124; x=1764171924; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=NCvJkYlF4keL+Fd6f7hwRGbLb7cgm1v1S6Qn3Ctc9SY=; b=uSyqphp3kCCYvDBz0q47gLb3vJPYuYjt6D+um2CyUeXA+zu13nC6CHk+74NRu7vOYK rRjT3ua/V4v36eYm0SOtTTuOeMS29NJy6FctUxhO4yQQAiuwECsd7oFkEG5n2JJLrNEB f+7TLKfuwKwXPMSOP91XfhNfLsRa3xKlv+v0yL/kVraqey6yYKp69sRYScQj8xQDhA+a sYomgi9FbfB/LD3gXHOf8IIeuVdbHEUg6lBoxHwBvOztwj5Ow8unnOPjwHTfB7QGe5aW N5IuMIAHgPZE+tr+kPPVQA26jvkAYTaiAJC1TcczRvrqTmNFdlXEpZfEsTPhcZ1cwYQ4 aIJQ== X-Forwarded-Encrypted: i=1; AJvYcCVeE3+nxrFRcstRS4OaavEiwAmbeKlMXwwkhTRWeFGzUDMKuvTeRzzwphlT+99mkQGc9vVhnxVHIDwd5hU=@vger.kernel.org X-Gm-Message-State: AOJu0YxXI5wLYm4GQ+2KIOVht/LGwoj3cQy0cd2+7fdmYpknCGed+LEl 12jEv95hnhElaPxZuV9CLtTXgxNrUS9ESWLZTexFJ+Ng34qgf76ZAmAkA6Gb0Jbfcn4= X-Gm-Gg: ASbGnctmwAZQfpE09wQJW3JAV8YgKVuBzHeixyJZH24qkyyq/hWYQlAJydMJLZxxVeF ioo/0o4imfTJvE0Lxx9d/OiS8/yzsN1YHr7PIormNNwOKtU7CRgk9o0yE13MNxdbWXaekUdSrWG FjAjKt39y4zi2ZcAz0EMyfD9I48KExdyxU/PrlMFkNpE94LnCGuE6BqemRyIBcqP2LSn1b/TxZ9 tz8iu6ibZNKQlYiR9nqMQmnwH3KrXuKIyEkCuGwspxVEdeK4CCBnIWbzGp9trIXhJbNsn5TtWy3 wv0+/sAHpSbdM26E8kc/3O+p8UqTiavfcbwIO1cBqmqHsqUEXWUI7ZJYhfZ7+vEMfCadHuYc2wQ xZ864z9jU96kkSjcqHX0OZW2vUwroFWTBKu3HQ1+8S4tNzO/ly9Jl8DUE1oEh6na5Ql6qUDV9u5 Sxm4kxKjsLEfZmNAOi9KThVIuu5EZuTA== X-Google-Smtp-Source: AGHT+IFVCfX9pNo5qLPfR5wjMBWTLaRukJCHurtJsWmWrjGoOxpQq2PCC7itN5NhSfJZMSf9UOyBtQ== X-Received: by 2002:a05:6000:1ace:b0:42b:3366:632a with SMTP id ffacd0b85a97d-42b59386ademr21562007f8f.39.1763567123749; Wed, 19 Nov 2025 07:45:23 -0800 (PST) Received: from eugen-station.. ([82.76.24.202]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-42b53dea1c9sm38765632f8f.0.2025.11.19.07.45.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Nov 2025 07:45:23 -0800 (PST) From: Eugen Hristev To: linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, tglx@linutronix.de, andersson@kernel.org, pmladek@suse.com, rdunlap@infradead.org, corbet@lwn.net, david@redhat.com, mhocko@suse.com Cc: tudor.ambarus@linaro.org, mukesh.ojha@oss.qualcomm.com, linux-arm-kernel@lists.infradead.org, linux-hardening@vger.kernel.org, jonechou@google.com, rostedt@goodmis.org, linux-doc@vger.kernel.org, devicetree@vger.kernel.org, linux-remoteproc@vger.kernel.org, linux-arch@vger.kernel.org, tony.luck@intel.com, kees@kernel.org, Eugen Hristev Subject: [PATCH 04/26] cpu: Annotate static information into meminspect Date: Wed, 19 Nov 2025 17:44:05 +0200 Message-ID: <20251119154427.1033475-5-eugen.hristev@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251119154427.1033475-1-eugen.hristev@linaro.org> References: <20251119154427.1033475-1-eugen.hristev@linaro.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Annotate vital static information into inspection table: - __cpu_present_mask - __cpu_online_mask - __cpu_possible_mask - __cpu_active_mask Information on these variables is stored into dedicated inspection section. Signed-off-by: Eugen Hristev --- kernel/cpu.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/kernel/cpu.c b/kernel/cpu.c index db9f6c539b28..1f2df5a5b9ab 100644 --- a/kernel/cpu.c +++ b/kernel/cpu.c @@ -38,6 +38,7 @@ #include #include #include +#include =20 #include #define CREATE_TRACE_POINTS @@ -3089,18 +3090,22 @@ struct cpumask __cpu_possible_mask __ro_after_init struct cpumask __cpu_possible_mask __ro_after_init; #endif EXPORT_SYMBOL(__cpu_possible_mask); +MEMINSPECT_SIMPLE_ENTRY(__cpu_possible_mask); =20 struct cpumask __cpu_online_mask __read_mostly; EXPORT_SYMBOL(__cpu_online_mask); +MEMINSPECT_SIMPLE_ENTRY(__cpu_online_mask); =20 struct cpumask __cpu_enabled_mask __read_mostly; EXPORT_SYMBOL(__cpu_enabled_mask); =20 struct cpumask __cpu_present_mask __read_mostly; EXPORT_SYMBOL(__cpu_present_mask); +MEMINSPECT_SIMPLE_ENTRY(__cpu_present_mask); =20 struct cpumask __cpu_active_mask __read_mostly; EXPORT_SYMBOL(__cpu_active_mask); +MEMINSPECT_SIMPLE_ENTRY(__cpu_active_mask); =20 struct cpumask __cpu_dying_mask __read_mostly; EXPORT_SYMBOL(__cpu_dying_mask); --=20 2.43.0 From nobody Tue Dec 2 02:19:50 2025 Received: from mail-wr1-f50.google.com (mail-wr1-f50.google.com [209.85.221.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E51FD32ED5D for ; Wed, 19 Nov 2025 15:45:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.50 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763567131; cv=none; b=iLmmG/VQMV0YB2AVj1TdtmSbLdkpxb8J4hqBS9dBnI+slB8f9kTZDGLMrH6bv5capVm+aRsf8V3RJsbl7HvK0Q4wfZUir455qxPYktz0n0Phz8lA5w/UHD+5NBSF2gdPwkOTDSNL9e6ptRcYAZvSFP+dNSz+8YN6d4Ky94GWWQk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763567131; c=relaxed/simple; bh=uHw2K4abduiDzGpZ4eX0j1eSGliuYPoG3xQUhEMZuY4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=RCkIi4CqV61qKcoPmGalZJK1iJ7c6r5gaiCnjpGlQmsXhQEPFhuDYyFKH3yBp5aEF5Tnd8AXFFqGoh23vkIDEPVuY4HtXoDgFY1nBfP+MX4lRO/X2W/SSTNNdak01zLAIJzm8wmkNhVK/6+6JEECOnNSYis04iINCOff6TDL5gI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=POzM0FwJ; arc=none smtp.client-ip=209.85.221.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="POzM0FwJ" Received: by mail-wr1-f50.google.com with SMTP id ffacd0b85a97d-42b3ad51fecso5104990f8f.1 for ; Wed, 19 Nov 2025 07:45:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1763567125; x=1764171925; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=3irtgR9V6ILkzi6aCmzqNOzM4wzsrVUTWgR/+hcFNWM=; b=POzM0FwJqd/SdL87jP2GMAUIGjXey4fOCpL7ccvdQFlLBGoh6TpPgeAOPAXKPy3rC6 2f3BvlcDX4lGoOR84lem+RbdtLt8RPGa2tbgMBuPxaKNO9opaYqdf80cop3Q/VowQgGH YYkotKtpK0JABL5JcU1bH7o5RsJIPKV6mp4ED0W7ecl9GKcdZ79YCxbL0muGEPLcKqMz V6THVAxGDvUJThgal+ibL1TYjlGAVALilt5bF29kE3NJAqCBjI75PkcU1CeyuwyN4uq4 O4kcmlKLnYIOJl89JsWU9g848fXyvYpsKSEPvVHwlzHnJpQY5MTIgruFA6oe0bBx7Hqs kNYA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763567125; x=1764171925; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=3irtgR9V6ILkzi6aCmzqNOzM4wzsrVUTWgR/+hcFNWM=; b=Xda3dApPRxmhj2ytvUY5AHwhK862Ez/L5TNpaNBpJJ5OXSXl2S9De//zJ1QRD5vaTz +k9sNCR67V8HASRhvTHiTABNN5QLAttvS6YsQe3Nt7Dx+Tv7ZslYOvoUpcAv7apxuBPh MhvyegwOpL+vHAAY9tR0ksx/KpBzifeLSf8fjDemYjrbZa8koADHnLY7+LzIOxr0AQ5E XtxXFVRetpVy32QmbBabCLi+XX0lM9YxcMqFtJK3NMl0qDe29Qs3z6W068Peg0UmsXv/ se2NnEZ0Hmjhr6rJ6ydqibjqfzZkxP+yrnzDvA7GTKFpbtrelj5ER39S6ADtDtqHZ7sL FZNg== X-Forwarded-Encrypted: i=1; AJvYcCU8yLxRXEm0u87hMSXYnmxtwYtBS5zKmRnPr3CImHwf137VjbXokPEoNn9BkLf+pff+VUd/ohDFWBImwic=@vger.kernel.org X-Gm-Message-State: AOJu0YzHdiFXvuLq22ROB8z6Xy5rCztTDL+gvxgrMHSalTYiWxdycLpW Z7EJYCMNpcNd4LaUvYchOUTquGisZre940g1VV6HTJ/sAqjNv3+qncMQnXtcbVySRWw= X-Gm-Gg: ASbGncus4GgjAVfHNe37Bd+r81kLIa2XBUOSGHcC1vNIwbGG/6wQa8UNjnzHmWPHyKQ q9NbrOOVa95ODN45jjrqm2+KW45FLSfOk23d13bR4kOfZpaywBynfL0EMpP7b0AY4u77ZMvA9cb 8ze8dYaxTtTzLTDTuek/FFXyKW33yACt+jX/s+wipx5m8Qq1Cqg+mdgPZ4eei0hC2235OAjlDma KtmEnW5SA+qQDnXqzNG2+Qlrkayw8+DbDzHUh2PLuvUuZ3dHzFMNw3BS7cHUAdYZqIzLKTYPsdt XNXx5WYmH1YvgLcHIzlDNiX+MIumIhI1Ly+O2SO8nwd0jDjMtcH7rhPKer5Euqu0zc2KRQFSwxr Fqy8437WV8HZ6MMtJf3Nbu356DjBIsi4JUlbgaQTyB56xEaIyGfjecc/1BwgGMnqHJbzfcwBp5L u4szH/7vwwOcZLWf+DUai+ANavn6ubbQ== X-Google-Smtp-Source: AGHT+IH7OiMHuWdKqmUscjGj0hpAhy0+8U72IgAGXn7ATooehRTT7HxTJk0qp9VlE6dzqjBsHdcltA== X-Received: by 2002:a05:6000:2901:b0:42b:3e60:18cd with SMTP id ffacd0b85a97d-42b5933dfdemr19022522f8f.11.1763567125510; Wed, 19 Nov 2025 07:45:25 -0800 (PST) Received: from eugen-station.. ([82.76.24.202]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-42b53dea1c9sm38765632f8f.0.2025.11.19.07.45.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Nov 2025 07:45:25 -0800 (PST) From: Eugen Hristev To: linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, tglx@linutronix.de, andersson@kernel.org, pmladek@suse.com, rdunlap@infradead.org, corbet@lwn.net, david@redhat.com, mhocko@suse.com Cc: tudor.ambarus@linaro.org, mukesh.ojha@oss.qualcomm.com, linux-arm-kernel@lists.infradead.org, linux-hardening@vger.kernel.org, jonechou@google.com, rostedt@goodmis.org, linux-doc@vger.kernel.org, devicetree@vger.kernel.org, linux-remoteproc@vger.kernel.org, linux-arch@vger.kernel.org, tony.luck@intel.com, kees@kernel.org, Eugen Hristev Subject: [PATCH 05/26] genirq/irqdesc: Annotate static information into meminspect Date: Wed, 19 Nov 2025 17:44:06 +0200 Message-ID: <20251119154427.1033475-6-eugen.hristev@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251119154427.1033475-1-eugen.hristev@linaro.org> References: <20251119154427.1033475-1-eugen.hristev@linaro.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Annotate vital static information into inspection table: - nr_irqs Information on these variables is stored into dedicated inspection section. Signed-off-by: Eugen Hristev --- kernel/irq/irqdesc.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/kernel/irq/irqdesc.c b/kernel/irq/irqdesc.c index db714d3014b5..89538324a95a 100644 --- a/kernel/irq/irqdesc.c +++ b/kernel/irq/irqdesc.c @@ -16,6 +16,7 @@ #include #include #include +#include =20 #include "internals.h" =20 @@ -140,6 +141,7 @@ static void desc_set_defaults(unsigned int irq, struct = irq_desc *desc, int node, } =20 static unsigned int nr_irqs =3D NR_IRQS; +MEMINSPECT_SIMPLE_ENTRY(nr_irqs); =20 /** * irq_get_nr_irqs() - Number of interrupts supported by the system. --=20 2.43.0 From nobody Tue Dec 2 02:19:50 2025 Received: from mail-wm1-f42.google.com (mail-wm1-f42.google.com [209.85.128.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F3CEC354703 for ; Wed, 19 Nov 2025 15:45:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763567133; cv=none; b=XSMAx9v2grfoAdWkjmVQikd+JmEUY4uYzCFrx3o0bgxBbn8SyQfXtbITOD/R6qX6OmRSPm8BceBI3ZDQyRY0y4ENbVmot9/AzER1MwqcrZf9ef3ns3Nrqje1tpSo4TER5prHqMrCelxmnWnmyXMZ6DJ03NRq03hVegttsu1eDgs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763567133; c=relaxed/simple; bh=VU47rRSEpIhBbnpqxo3Mzoi4kyXh9HmEgVPJi/PKKQQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=gOZ69klYB780YuyBSFn2mZQabjBbs/Y7FHvIkU4oFVTBAr6R02EuXakD7KXDEOSera7T2kCJKfhualAsEkxndJHQyg4JMbp2BopsNLNVIeLw1YphSrzIKbTZco2kmYBPywf8MYAo/VBAImxtLKexHMrv56pqsrzNnwEv/N2l7Dc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=XZ/ijRdZ; arc=none smtp.client-ip=209.85.128.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="XZ/ijRdZ" Received: by mail-wm1-f42.google.com with SMTP id 5b1f17b1804b1-4779cc419b2so48344595e9.3 for ; Wed, 19 Nov 2025 07:45:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1763567127; x=1764171927; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=tjfIjN6LzAYPexJPKxlzOegJPOplIDmw8UmBc2QBBmw=; b=XZ/ijRdZu5x0OvTVmkMq1wPbsmeKFbLQbYrPafVtvHT+ZqFCKf2Qcp9C1tVp2N/J0D knNKJXhbr9JziRTGWFdIQncXLZViZHEaisM6DwHPeG9AVVqt8e5GgvS/eZ6W3CQ/wgNE eUAxxuNkPdWWUIiLOxyTbNxpAEDi0zbJRjyi0M/skuHii8wzYx9Fd2XFdKA55bwmURB0 E/GzFp+ssYwIxqtSwO6ujSuf9arYgXH7dCM0Qa9fwXjuXaTftH8SAdowmnTn83UEVeRo Dr6xOSIAlKga7MCQloURP4hs/LnWJvAeIdLWYMQ+WB3ui+rujTltgYm6XmZue5TsfJXv q+HQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763567127; x=1764171927; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=tjfIjN6LzAYPexJPKxlzOegJPOplIDmw8UmBc2QBBmw=; b=l0A5z9BZHCwze37zRlJPNbG71Dx2ju8jX0Me3nfsc75zgoTqJVBqjBiV3JvnI5u44l 77z0vt+JvUnMjaSyz6GPM2R4rg7RlwKoou24/sVO5X+3fqeZ1syZClACW34qaXRbmnIP JWoVfwkxwKW7pGBhDOdN7SKAlUFvH213ioY/B3/WvYlQu6S0ufJ7NvGo/d/SewLzxMJ5 OxLEroEuvslCrxrHwDXABpWom0pTYC4ks517KlBszEYTsDNGQtILlsrVSxIIV/vF0H/4 yUxwYgY/dKEFZUCK5bkoctZd10BRBT40UMbc/h2cjeyUaG59Zb/1doh2LdqyM1rpcb4N xQOA== X-Forwarded-Encrypted: i=1; AJvYcCURprGN6Abtdy/TgJ3RbCHQONfr2mm9Nl5OGIMu9iO1wP/jKdFFYrN1ZkTRGBkWMQDBoQQAfrS1Byuamy4=@vger.kernel.org X-Gm-Message-State: AOJu0YwooUkDSsIB7cwNJHzCog0bWBPOaU0TpfPROLdLCw3yEt1eldRd 8vwY4/wJ3o7vxxqle97Po23hiSI/BkoTgYNy47mwupuTfaEnQ/ba80H3M9eyyHA6vbk= X-Gm-Gg: ASbGncuFagiFHDxvnS+/q6Y3q9Zi5dg93xW422EKi5dBLTJXQpCbBemUaAn7JvCA1E8 DutmCDCtc49WATbGQ7tHqjNsEP1puPtVV0NqaHQqxU2hDS9ViSwTNGYcKKi8a1aNggVf9cztV7s Cg9tFLD1a7T8jIZ8vLPQTyglNTc3rPrQ8kkM5FpRF6chM/ZoJ4sac5EW3ZO1kgEvfeqoAylum2/ gmJVVHGaGRu6tnWy0zH1CamusCtnI/K7cSl5qa1tj5UtdFqObv4TbDq90S3DPa3ZERQ4CgYcvd/ c+j7QUvennPTNpCGu2Uk6w1He30O8niW7BzRzaiFAnfJfnQcYXop+UXUU7/bH37N39aHfsA9wyO RV+i9IRpbuqHAScO2llXz5/odA9LS68qBt1o3p6NLfCZ5TGwybDKNCFZChuKgiAlhKukmfyh2sG hwg7rG66KB9mCEhxfSknJiYNGylNYUvw== X-Google-Smtp-Source: AGHT+IEfh56DkbcMOsGMiLrQQwNoxfW0lTNMGX96p1i+gi2+G5lC/DiQdo+bbBRy4PiX1VmL8kOK2Q== X-Received: by 2002:a05:6000:2a0e:b0:42c:a506:9dbf with SMTP id ffacd0b85a97d-42ca506a058mr10726960f8f.39.1763567127227; Wed, 19 Nov 2025 07:45:27 -0800 (PST) Received: from eugen-station.. ([82.76.24.202]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-42b53dea1c9sm38765632f8f.0.2025.11.19.07.45.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Nov 2025 07:45:26 -0800 (PST) From: Eugen Hristev To: linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, tglx@linutronix.de, andersson@kernel.org, pmladek@suse.com, rdunlap@infradead.org, corbet@lwn.net, david@redhat.com, mhocko@suse.com Cc: tudor.ambarus@linaro.org, mukesh.ojha@oss.qualcomm.com, linux-arm-kernel@lists.infradead.org, linux-hardening@vger.kernel.org, jonechou@google.com, rostedt@goodmis.org, linux-doc@vger.kernel.org, devicetree@vger.kernel.org, linux-remoteproc@vger.kernel.org, linux-arch@vger.kernel.org, tony.luck@intel.com, kees@kernel.org, Eugen Hristev Subject: [PATCH 06/26] timers: Annotate static information into meminspect Date: Wed, 19 Nov 2025 17:44:07 +0200 Message-ID: <20251119154427.1033475-7-eugen.hristev@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251119154427.1033475-1-eugen.hristev@linaro.org> References: <20251119154427.1033475-1-eugen.hristev@linaro.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Annotate vital static information into inspection table: - jiffies_64 Information on these variables is stored into dedicated inspection section. Signed-off-by: Eugen Hristev --- kernel/time/timer.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/kernel/time/timer.c b/kernel/time/timer.c index 553fa469d7cc..c6adea734b93 100644 --- a/kernel/time/timer.c +++ b/kernel/time/timer.c @@ -44,6 +44,7 @@ #include #include #include +#include =20 #include #include @@ -60,6 +61,7 @@ __visible u64 jiffies_64 __cacheline_aligned_in_smp =3D INITIAL_JIFFIES; =20 EXPORT_SYMBOL(jiffies_64); +MEMINSPECT_SIMPLE_ENTRY(jiffies_64); =20 /* * The timer wheel has LVL_DEPTH array levels. Each level provides an arra= y of --=20 2.43.0 From nobody Tue Dec 2 02:19:50 2025 Received: from mail-wm1-f53.google.com (mail-wm1-f53.google.com [209.85.128.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C710835F8B1 for ; Wed, 19 Nov 2025 15:45:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.53 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763567136; cv=none; b=LI9STHwwPKAjkKjsMU/jAxnIc5R+VynpIxw/cnrFZECgq67hyUlIXuQg6I5jzX/od3GRNTwU5kBFN6u350sy/13aKumnaiuU9YpWIrIO5GFMKde0LyzLBWZnBAwBynAZtXRo2qR2JJyMPiahlDQf63tmxElllW48wTMx0QowJag= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763567136; c=relaxed/simple; bh=o6BmMGmoTbTaL/NtdpUUmzGGU5vJ7cVEMCY9+Mbhsuc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=l6Se3KmuS0QIr2fMFCTP7MC1W94tFLERZCO/N6dbA/p21y3cPtKDW0Qx+ml/+DB/XpZE7DY84JtFk+sX9DCNfS2UUPrmnwm/ypaX93v2dEK3qtWIUcg+hmQKrr+RkgqXx6fvgAc4/Lf//sdFeva34Nuph/tUcei5IP/wRh6xlrk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=N97gHFJI; arc=none smtp.client-ip=209.85.128.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="N97gHFJI" Received: by mail-wm1-f53.google.com with SMTP id 5b1f17b1804b1-47775fb6cb4so50230075e9.0 for ; Wed, 19 Nov 2025 07:45:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1763567129; x=1764171929; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=QgfZoRmCPzcZDOEfTe8kWXd16fGbdAbRWXioprv0N44=; b=N97gHFJInsFrGAqWXSOC/t/ip/ZFunAGSLYV+sKzWA5YLMvcNzF4HcIjkZQ30w+/8l b2NEkLl+5wQZEeu2dyGiiYvoGvRCs9uxQGYtRFf2HU7fxvjIk4olW8WnAVRi8eVxFZx1 UlSE+dC4+lWgzhgCrkKaUvADoNcSRGotpAoValiwpGmbEaFUryttt3FwhmktPXVdic/A vsUycPOVgkU2YZZgl4vqzYcWvwH/bfSrTDwhlAI/HbZ3WDsvUwLkf+NrIuto02BJ/h0d eIzrHPrz8EVcC6kjiBrbDOdboOa8zfoPHPFQMvNaobGZfCEACLBLqBnUpMX2REFiOVt4 D1DA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763567129; x=1764171929; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=QgfZoRmCPzcZDOEfTe8kWXd16fGbdAbRWXioprv0N44=; b=QXxl/8uGY2BanfetkSn14X+hbPHyFVGgWKPuaT6nTVsz9u7wewQrGelCtzq5LeGm85 GMXuP3y10WUs0MpH4I9ZAKPHsHYld7FD0Umw4X0P1jQdDbia6wcvLWabQWwtI1hJdOMn DKsjV+VVY2vNNpNAQ9WssuUmkp/Qz+X0TxAWV1+04Vrx36gx4WAYCFYurNvRJ23XuRXd igLlXsbMK0Gq1CYloQLBHpYY7WrlcaaDMDljXfx59QWNXhCARrVfSUajhCCGJuk+agIF n/Y6ObtS2Rxg2va07PkaUGXHW3A8Ap6T5OKEuvHo6HFmVe2829tDD0sTxoM2xeRUv/7F E8/g== X-Forwarded-Encrypted: i=1; AJvYcCWRvloqi35Kdn+1n05xtQoMPu0LIGlz6zZeP8kcsjzziw9KvCA0FXl5O5NV73iijqE6RwIfeUrLGVv2aes=@vger.kernel.org X-Gm-Message-State: AOJu0YwBrnXawf2W6ywQk2KNMFQzB8adi6BSytYUSTclziTPSx1q9wCP xpQ6lt2X/kzoaMxFe/RpdYvONUbxc8PtG8PRzlyPNdiGAzA2Oq0Pi8Dioy8Cu2A0mLA= X-Gm-Gg: ASbGncs7677f1SUZk+zPmziZ36HflwLQ0NKrC/RZis+d/hMBhpM0yFrkVIghXhNs+eR ynWnWaV7HYmsuUqHjNrdOxk9QBPcdRxPb9lhcekZWgowOP5b84BWJKfCMy5deNj8XHlF97MR+NF rKNIoKL+TH0YzTDAdvt229usc14cjERPdeuL89MhJO+aOdr1BuMXbu+m/6SMd9wb/KZXaLOwo61 7wNK4libImWbsY/p4e5lJNQ+/5mUJ0zKiMV38ZrjT8I1EsjXLLNOzU8dynHkHOeD1uufXCQALMx t0JP9CmV3jZu0cLQfRKplzcBBYhCGiubuJ4GpJFmeVzlI5Jg3qAkpbt92Uw3vWUV2GAtpy/99sg 0jkRfkQhC0xPaNbzuI+iTDfW86s2tT166f9reJeQdmVXtfLvn8o/QuLAD1cOhn7hxBCtcCC8Hxk pKogMY6Do2eqQBU2dcUYuU3zIKpklcJQ== X-Google-Smtp-Source: AGHT+IEsAcddfcsUUvEjJGVD9iD03mMaqDkbeYnd/gOudjAAgUoPc2H5D0xayvELD1uec3MJtxxFcg== X-Received: by 2002:a05:600c:4585:b0:477:54cd:202e with SMTP id 5b1f17b1804b1-4778fe59a0bmr205474775e9.2.1763567128896; Wed, 19 Nov 2025 07:45:28 -0800 (PST) Received: from eugen-station.. ([82.76.24.202]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-42b53dea1c9sm38765632f8f.0.2025.11.19.07.45.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Nov 2025 07:45:28 -0800 (PST) From: Eugen Hristev To: linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, tglx@linutronix.de, andersson@kernel.org, pmladek@suse.com, rdunlap@infradead.org, corbet@lwn.net, david@redhat.com, mhocko@suse.com Cc: tudor.ambarus@linaro.org, mukesh.ojha@oss.qualcomm.com, linux-arm-kernel@lists.infradead.org, linux-hardening@vger.kernel.org, jonechou@google.com, rostedt@goodmis.org, linux-doc@vger.kernel.org, devicetree@vger.kernel.org, linux-remoteproc@vger.kernel.org, linux-arch@vger.kernel.org, tony.luck@intel.com, kees@kernel.org, Eugen Hristev Subject: [PATCH 07/26] kernel/fork: Annotate static information into meminspect Date: Wed, 19 Nov 2025 17:44:08 +0200 Message-ID: <20251119154427.1033475-8-eugen.hristev@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251119154427.1033475-1-eugen.hristev@linaro.org> References: <20251119154427.1033475-1-eugen.hristev@linaro.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Annotate vital static information into inspection table: - nr_threads Information on these variables is stored into dedicated inspection section. Signed-off-by: Eugen Hristev --- kernel/fork.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/kernel/fork.c b/kernel/fork.c index 3da0f08615a9..c85948804aa7 100644 --- a/kernel/fork.c +++ b/kernel/fork.c @@ -106,6 +106,7 @@ #include #include #include +#include =20 #include #include @@ -138,6 +139,7 @@ */ unsigned long total_forks; /* Handle normal Linux uptimes. */ int nr_threads; /* The idle threads do not count.. */ +MEMINSPECT_SIMPLE_ENTRY(nr_threads); =20 static int max_threads; /* tunable limit on nr_threads */ =20 --=20 2.43.0 From nobody Tue Dec 2 02:19:50 2025 Received: from mail-wm1-f49.google.com (mail-wm1-f49.google.com [209.85.128.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5E4B82E8DE3 for ; Wed, 19 Nov 2025 15:45:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.49 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763567137; cv=none; b=erD/Q1p1R7Al583WjXWoqMebP6dueEtwSdQnroaeH5zle5oa6u+MwCa9hnPZ9nbYycb0uor1ejaWyusuZlk9M6SVu9ZiZVzGsSUtkLyCeUZ4G/tXumgJ1FVXe57NI4MjgVfTL//P/U6CVH7Z8HUQ4vwrgUVSBRxgvXfsul+wx30= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763567137; c=relaxed/simple; bh=E0xWWAAtZ+sb1tFoy69j+X8UfYdpBq6LQ0ZttxzoUlk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=c+9utiFdO9oVORq7vvCjO//Dhm48Zuv4v+O+yWSj/t8U9aQSx902NBAE4WN5Qp/yTiuZuhumdKTKezy/TAPIkH3uhNJmXcWFbQUXRALMC106bFQ6ndktnALplEKhKThjpCTObJV7Y1huod7GLRmTkyUc+SYTi4pjQJj46mqCnPk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=bFLOD1dQ; arc=none smtp.client-ip=209.85.128.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="bFLOD1dQ" Received: by mail-wm1-f49.google.com with SMTP id 5b1f17b1804b1-4779aa4f928so50064945e9.1 for ; Wed, 19 Nov 2025 07:45:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1763567131; x=1764171931; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=93DS/ScHi6FgD35ajGLpv/dHTyNaaklJOjylE6wX7jU=; b=bFLOD1dQC0Q4Eym89MV7724Zm5/qYdVd2/MyrMm0XvxbrzU2lDJ7f3Hv1VBREo0swI VNOqEN4cIlEgl+4RG3ftwarzTx6ULTRfRqQECW4NCGOea5bakUcUwadftn+o9l5qcuQr GqOhGsYig2eyjmviFGaWge0Ow+AucMs/GddQ7Kvm24vYmAkB9N2JvTJG65NJ/KsZPbV2 WLjgsvnPwFwpu+sLHn5AI3lW/12WVyHGZzzBopJ60S7mOvi8gmM7wjOlCW9IqzOHKDLp paCwK/zQhMrhsuME+ta7z/kdBso55S8pQQVjvaunWcA3poAn3wdp0V295gegBTryfFZD wv7w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763567131; x=1764171931; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=93DS/ScHi6FgD35ajGLpv/dHTyNaaklJOjylE6wX7jU=; b=rPM6lvd67jzhUvla0u/CqQWajqmx/qA3d4XfHOsaNbaHCTcPl3j88BLtAbi1d4namy xSFIQn7TKRKfF204WgUYO8pqdlHJkTt0ElwP94NXHdxEtyVuVff02lKs93+4gcOwCh5L ryhm9WB3Bj2fEVaIts7JwI50XJ5xaBA2qojzACOXM8/FRCMPXtPMZBaYdQlT/i1EYCVV 4V/zq0upzQBh/jYhqBe4dECHNZr7tLD4dxL1ydeekS8jQPtV23P8l1PzE8iBwMKMWT5w GL7R55v61JoJqDI9PW8XnLh+cKs12dbgZqjEsis5YhlCct4qhz3mapvDknwhPqJX/tRX 1JcA== X-Forwarded-Encrypted: i=1; AJvYcCUltce/NoiwmAvSsz9TqJHxsjjkvTo0semmUVt7Pp6drM5rECoGPtzcnwYOmRGxQDtmz6YVIgu0w6GH5rg=@vger.kernel.org X-Gm-Message-State: AOJu0YzgD941blH6Vt/Zi794aeiziqhjlqkvUocTCbhKWW/MEgU+aLUo arH3IInTbG5GXDUsR43+AnxQaoll/jBZTDYQWm3NRKMQ7422NMrrZPqgL//4kNOxh7M= X-Gm-Gg: ASbGnctZGBgwqCKHnJWSkfYh/lC8+0UUU70Znzc3JCCAwLFbsd5mZdzC4WEPEyBZADK 0cTElc4+vL6iznESkO4+aIAM+mDwUbcvpEY7FBzYZe0EInDaRFIHff9pVQ2pFUqBs+YJPPbLgS5 whUz3EtA6YqtVtV/6aSuOOQq8kf5HYqE+S9HI8EAom2f29AkGo479NGx3+CLmH1VmaBOAydX+DZ tBPzonLMUfzaq4UUgmJ++vD8JlQjG2wgVUFPN5c6FTH7usEKybUYJfXzO1qDIJB/wue0Z46dVNV 4fVH+crmblyYt7U56ojQm6S7cpKxQu3hDBFZGikNLVLMlnS+wxhf9SeEJYHAsHyY31TLBH+xo55 uH226N9xoN1Id5KBRnS33sX+HrfhFWcdkzx9gyqxnnH58r93yFTaq0ksYEdQQD64KtkdthO1TJH BpTIJD+3GlN3y6qMZikUho5dM43hPNp6sxAJDeVPkd X-Google-Smtp-Source: AGHT+IFTd+L8MIsFVmd5+4R/tV4nej4oyMMzTvyobs7oRMR9eeDnvkZRxA29k7Ua9rj2plkllb3d8g== X-Received: by 2002:a05:600c:c48f:b0:477:7b16:5f80 with SMTP id 5b1f17b1804b1-4778fe49c0bmr204044185e9.10.1763567130586; Wed, 19 Nov 2025 07:45:30 -0800 (PST) Received: from eugen-station.. ([82.76.24.202]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-42b53dea1c9sm38765632f8f.0.2025.11.19.07.45.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Nov 2025 07:45:30 -0800 (PST) From: Eugen Hristev To: linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, tglx@linutronix.de, andersson@kernel.org, pmladek@suse.com, rdunlap@infradead.org, corbet@lwn.net, david@redhat.com, mhocko@suse.com Cc: tudor.ambarus@linaro.org, mukesh.ojha@oss.qualcomm.com, linux-arm-kernel@lists.infradead.org, linux-hardening@vger.kernel.org, jonechou@google.com, rostedt@goodmis.org, linux-doc@vger.kernel.org, devicetree@vger.kernel.org, linux-remoteproc@vger.kernel.org, linux-arch@vger.kernel.org, tony.luck@intel.com, kees@kernel.org, Eugen Hristev Subject: [PATCH 08/26] mm/page_alloc: Annotate static information into meminspect Date: Wed, 19 Nov 2025 17:44:09 +0200 Message-ID: <20251119154427.1033475-9-eugen.hristev@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251119154427.1033475-1-eugen.hristev@linaro.org> References: <20251119154427.1033475-1-eugen.hristev@linaro.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Annotate vital static information into inspection table: - node_states Information on these variables is stored into dedicated inspection section. Signed-off-by: Eugen Hristev --- mm/page_alloc.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 600d9e981c23..323521489907 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -55,6 +55,7 @@ #include #include #include +#include #include #include "internal.h" #include "shuffle.h" @@ -207,6 +208,7 @@ nodemask_t node_states[NR_NODE_STATES] __read_mostly = =3D { #endif /* NUMA */ }; EXPORT_SYMBOL(node_states); +MEMINSPECT_SIMPLE_ENTRY(node_states); =20 gfp_t gfp_allowed_mask __read_mostly =3D GFP_BOOT_MASK; =20 --=20 2.43.0 From nobody Tue Dec 2 02:19:50 2025 Received: from mail-wr1-f45.google.com (mail-wr1-f45.google.com [209.85.221.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8C8FF368268 for ; Wed, 19 Nov 2025 15:45:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.45 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763567140; cv=none; b=jdcaR6eLWKJKp0e54+ia90W3LeU68K0k8lEAR+O5lVBZbMclq7JcLZPkiDtoIF0G1a8vzlY+rH4kYDHi+5Nww+WKOniCeBjGcK3CrZkZDD4tC5+avPkiiSUBQ4iBx8jGg2e1yKSsytZ4RlqND4nLG8YyYVF01CCY5ZHIV4y79EA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763567140; c=relaxed/simple; bh=TD1by0OTaP880US48xY3+1tAtbimE4nLFyenW4Dl/t0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=CP5tLoPREFZOP5y7aHswO10EpTEUhDFlMwS3QmUq6s7e0lBxgcX9mtA4WqQeYUzoG3En7Gu9WYJbdvrJZA2rh9FIe1BarsCtrz2OouOHJqPJ5YiG4SXt//wKHMzmPW/7rEtkM7ir19HOyYAydw2rqApkECOTJmkh4UcjCuB1QPY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=kmDHNoQu; arc=none smtp.client-ip=209.85.221.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="kmDHNoQu" Received: by mail-wr1-f45.google.com with SMTP id ffacd0b85a97d-42b3c5defb2so4676962f8f.2 for ; Wed, 19 Nov 2025 07:45:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1763567132; x=1764171932; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=THAjTq9x4zT81mmTnIarOvW/kNy7ppuR0bAFxzz05mc=; b=kmDHNoQu64HbmUGpkc9vYVbHScLy0U0K3t13WEAzv2EDq8a8uPl0d4aWu6NxEH4N1t DYYE8ac89yB69Gol4kY2PYMld6Mj6ywoy/rzvjIZJaK5HRAdqiRUeyuEFTVsLejLbh6W 3TJ/neVjVhIoqjX30M95snlbaU209rNFQn27MGf9j4vlM2WJL/UQ+DElN6BeNUSNt0m9 MtOlEDObIPHZ8AQoxYJFwIPUr/dgA/ysyug1orn6TqhN4UiVORtBU+5OYM511Gy710PF t+B5gphP+SGCjRgl3wzXRoSe9gTtaPOY3qj52wB5VXVOyBK1swi0MrDrAiE86iSXtahV SpGg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763567132; x=1764171932; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=THAjTq9x4zT81mmTnIarOvW/kNy7ppuR0bAFxzz05mc=; b=MNbA33iMzf8xZxFqL8AhWMck2M4D4dtz2XGdpRR76Q+ps0ywU8vVXE82bnOB42WU0Y oVgR0SPiGg+TaUTnH3EhHWb+HukCd3GqHCRREfNy68TQw4YR+pAl37EAZgxKr6p/34vG WIgXZk466LDtFtB3J9kkpZYPTcDr2hXaoeYsNn82wML3ruLAaRdwYfs2joDpVzd6NScA 1N84LaiMus/UE0CtAfZJ1oSxaVrJ0NNQMOLABcnb8QtRuE+3+o+F/hiqkFwFQaUCYXrZ mOssVz6yZATFkAzjFS074+qhqn9b66IyPe/ch+1wf94w2zfDu52dGDIiFRkQhKgm5nE3 M8ng== X-Forwarded-Encrypted: i=1; AJvYcCUgs4Q5QAShXslwRwCr3DQbLuNSmmo5Mbl10sX7qlnqRkfI5Qz/W535k1zdjkG9tct4NAlCHMc0uLrZDYs=@vger.kernel.org X-Gm-Message-State: AOJu0Yxp2F7j+qGsrBzClxXYQxWliCwJDGJt+dT1bM916x1rNpbLARA4 Rewt92jYTEaSbNX2AMjJxRQPFdoYh3TsiCiBjFVnOzD+X8j8G0nZtgQBpFfUBrZHkQQ= X-Gm-Gg: ASbGncuC8M07N6DJIlE4AQloQClVjTBQ5s99LSM62Hx7GYS+q+CM2u87pPigQEJGfRT vzeNq1nStin81dJeZ3eeFUiSyXeiVSGyPmhn6BXbr3SkSzBsR1K18us7sI08la9q/6wQuQ8/y/B dlVjdmWlwX5lQECbXlWtTK6Gp0ZEW2DXFZq9mGDWrQVmd+WXLc1EY998miieeZlZ9qRd+k0kCde SlUK6MP2o8ler93hhG5vjWE7ll7rcs0+Kv6VvTlawSZqIhrMP69+cORaOeW6bzrMFOcikJ82RvO Qw/vQmyR55XHzNSGk5Fp24TIq5Ro6LlY3vIF/4A89IfCkHaJNCfBl6RYJDimOf1Ua8hfWt+nLe0 ps6tYr09bJ3z/Dsor0N79XdzEfIRcLKtgZlDxrYjLXggMshEQCV5J/vgssudsUJkKq7C3OM1OMn 9h+yvkEF2uAYFMvf+htO1mKsuZQo9ABA== X-Google-Smtp-Source: AGHT+IFM/SLutYeAmIo2p7oRt8B5TNnuLzBZ4qt+3E18Kli5wgQjVTHlMxDsxZxKW/tnJD9yRmbxGA== X-Received: by 2002:a05:6000:2a0a:b0:42c:a449:d68c with SMTP id ffacd0b85a97d-42ca449da11mr9102186f8f.30.1763567132399; Wed, 19 Nov 2025 07:45:32 -0800 (PST) Received: from eugen-station.. ([82.76.24.202]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-42b53dea1c9sm38765632f8f.0.2025.11.19.07.45.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Nov 2025 07:45:32 -0800 (PST) From: Eugen Hristev To: linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, tglx@linutronix.de, andersson@kernel.org, pmladek@suse.com, rdunlap@infradead.org, corbet@lwn.net, david@redhat.com, mhocko@suse.com Cc: tudor.ambarus@linaro.org, mukesh.ojha@oss.qualcomm.com, linux-arm-kernel@lists.infradead.org, linux-hardening@vger.kernel.org, jonechou@google.com, rostedt@goodmis.org, linux-doc@vger.kernel.org, devicetree@vger.kernel.org, linux-remoteproc@vger.kernel.org, linux-arch@vger.kernel.org, tony.luck@intel.com, kees@kernel.org, Eugen Hristev Subject: [PATCH 09/26] mm/show_mem: Annotate static information into meminspect Date: Wed, 19 Nov 2025 17:44:10 +0200 Message-ID: <20251119154427.1033475-10-eugen.hristev@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251119154427.1033475-1-eugen.hristev@linaro.org> References: <20251119154427.1033475-1-eugen.hristev@linaro.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Annotate vital static information into inspection table: - _totalram_pages Information on these variables is stored into dedicated inspection section. Signed-off-by: Eugen Hristev --- mm/show_mem.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mm/show_mem.c b/mm/show_mem.c index 3a4b5207635d..be9cded4acdb 100644 --- a/mm/show_mem.c +++ b/mm/show_mem.c @@ -14,12 +14,14 @@ #include #include #include +#include =20 #include "internal.h" #include "swap.h" =20 atomic_long_t _totalram_pages __read_mostly; EXPORT_SYMBOL(_totalram_pages); +MEMINSPECT_SIMPLE_ENTRY(_totalram_pages); unsigned long totalreserve_pages __read_mostly; unsigned long totalcma_pages __read_mostly; =20 --=20 2.43.0 From nobody Tue Dec 2 02:19:50 2025 Received: from mail-wr1-f43.google.com (mail-wr1-f43.google.com [209.85.221.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8C5D8369209 for ; Wed, 19 Nov 2025 15:45:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.43 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763567143; cv=none; b=b5EupDWVoBMN9+o9P2fA+Q5pxr+bpmT0dKbCeXBGc17YhHvYgVrprnGar8oB9+Ew7kUqXhObiDwqG+IiUDFS3dNFRb514n5IZl+az7PG7Dwk4d9KwJL1CSg7JR9tp49DBHjFH/srRQK/RDSDZ9YLRyWIJmnjiDA12+URB1klTHo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763567143; c=relaxed/simple; bh=+VK7KRl6+Lq6c3QG0QoLNUfpAYwW2X9fA09G/NfS6uk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=bW88JQnV0c1NStZyGTX4hprTHeEpRJYkenmmUk5pOj88vjuaGCW1k80jyC10ksh67Lm3u9Aji8HqnlCssWKMcjSL08qpQg6qVutaaQsXXMaVNgH2kDhRmMTxbCSmYx6N8wlmsaui0fxBYCrS0WT+0TO6iqniYrH012oPcEjEudU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=j6sLEfh9; arc=none smtp.client-ip=209.85.221.43 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="j6sLEfh9" Received: by mail-wr1-f43.google.com with SMTP id ffacd0b85a97d-429c48e05aeso712912f8f.1 for ; Wed, 19 Nov 2025 07:45:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1763567134; x=1764171934; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=AuFAdi/dQ7TYcP6kPKC/D+o7MTxWjWW8Ku2RD10GvbQ=; b=j6sLEfh9uv7+dsvFnDqDQa6anzRkocsy8dt+OoGqRNipZTLpbhM0kN8gp+hG0HbaBs MMBo7xYfGVPH43vHvKGRCgch64x3w+5gOHyhKTn6HQ+sYqIorf4m52B2SrG4bBRx89Ci k7s7HPQsG+hLYQe0dBWwwYUE3j83EEMt+amQKWLX6AugMw0fo3ZbbVB5M+piJ6Meo17+ DvU/V8qk2/79vb7SU4ODsNiDcw+a5f4qtSc80/uGNdJXinhamtY1cOT2Gtifllx8JCIq 7cY4R9Y0192OrEL58Af8mu4tpPfVY0/Be+sl7rGwPj7IfS35Td5zUv2USdiF44V8DV8K PVjw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763567134; x=1764171934; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=AuFAdi/dQ7TYcP6kPKC/D+o7MTxWjWW8Ku2RD10GvbQ=; b=ItBcUGWp5gnh6jMGqn/U2QO8sLNxQrgloAZqsONSzsKU/yeKDRpv+BVDuK50exNcbZ +rysJO2oc3ixK14qfios1aHRG0TWsdDijLcOH8Pg0ifRzpNKolN/Bf6bxUKd3Kj5+SoD bWSZ448YmmQhHslDVgYnug7cjcPp5XJO0zpwE9rwBmQ9CdR7zV3ZLo/oH9/1JTVXPpzJ 0i32EpsS9NGrDi4KKmbdnc4DAKKp+by/CRDY8ERPtZYbPPvb1vmMjwSyxEq+fCG6Kipk 21SrvYPD6x55MN99QVYlCv3mudbK1QoDc/83ANZQ7ELDqeYPlO3pS6YDhoju4lAL4CZN 7/4Q== X-Forwarded-Encrypted: i=1; AJvYcCUMuNsJULLvRllbjRsZETlu8DOfToOQnx83MHDyY1VUOOFuyrKGAGvMfrey7chUBfSDnIilcWBtP/kbzGk=@vger.kernel.org X-Gm-Message-State: AOJu0YwZZzpo9G1yhnQRYXcn0POyF24yi+Wyb0NwyEz1IdaSeQKAgBlV h152o/zHc5zcWo00NINy0hCqiTIt93qNX/1l/EjVdkf0ZyqJoPrSmHIURbmNYtbI5jB2Tgo2RFd FSMR+ASL/FQ== X-Gm-Gg: ASbGncu/yYIJVReZovssbPhNYumrmJyP0dIQHUYHdZPP8P0T+ioRd4s0V5BrfPQTBCv vMJ9KcTNSQ1E26C6MfY/lJYI3TPriy8Wsy8RSP/SvshEuUg9j1B+tQZkNWk3jzjDw65xmcCypzS xHMELy9jPjhO0g56zY0GgqgJ1eeRwe3789fYS3VTpdHhM5N0iWcFw1F0AzBPBy3jfImWJcTLuqa ++GmOckEDjX5cAGlGKHKZ3XUh+koh9q/Wiu/j2loDigC5gd3xfJYGLbEdwleLtxhaNeVLwhZ02V dAKAqQHNP3QNCOfAB0FMhHFmFGJgMvL9FpnoH5XWnIIOxITYoZhGm6t1CZcRPSFbufi2ltp6DU+ bXs19wYBXte1OSLTSxDvpsjWBZj5ISsFal3mBw9J/Nok++FafGSIDohW/jXiiuSHff57YdTcnIF Zcf7WyThPhrUHS0UjlyYoHklihFvuzuA== X-Google-Smtp-Source: AGHT+IEEW1UNe8+i9pRkQXcVi1K6qHmkkggtbzPn6ocK+c8Bp9XYSPJPKkUMg9h5XQagLem1rvsEdA== X-Received: by 2002:a05:6000:26d0:b0:429:eb80:11f5 with SMTP id ffacd0b85a97d-42cb20e4a02mr3468125f8f.26.1763567134112; Wed, 19 Nov 2025 07:45:34 -0800 (PST) Received: from eugen-station.. ([82.76.24.202]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-42b53dea1c9sm38765632f8f.0.2025.11.19.07.45.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Nov 2025 07:45:33 -0800 (PST) From: Eugen Hristev To: linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, tglx@linutronix.de, andersson@kernel.org, pmladek@suse.com, rdunlap@infradead.org, corbet@lwn.net, david@redhat.com, mhocko@suse.com Cc: tudor.ambarus@linaro.org, mukesh.ojha@oss.qualcomm.com, linux-arm-kernel@lists.infradead.org, linux-hardening@vger.kernel.org, jonechou@google.com, rostedt@goodmis.org, linux-doc@vger.kernel.org, devicetree@vger.kernel.org, linux-remoteproc@vger.kernel.org, linux-arch@vger.kernel.org, tony.luck@intel.com, kees@kernel.org, Eugen Hristev Subject: [PATCH 10/26] mm/swapfile: Annotate static information into meminspect Date: Wed, 19 Nov 2025 17:44:11 +0200 Message-ID: <20251119154427.1033475-11-eugen.hristev@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251119154427.1033475-1-eugen.hristev@linaro.org> References: <20251119154427.1033475-1-eugen.hristev@linaro.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Annotate vital static information into inspection table: - nr_swapfiles Information on these variables is stored into dedicated inspection section. Signed-off-by: Eugen Hristev --- mm/swapfile.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mm/swapfile.c b/mm/swapfile.c index 10760240a3a2..ee677be19041 100644 --- a/mm/swapfile.c +++ b/mm/swapfile.c @@ -42,6 +42,7 @@ #include #include #include +#include =20 #include #include @@ -65,6 +66,7 @@ static void move_cluster(struct swap_info_struct *si, =20 static DEFINE_SPINLOCK(swap_lock); static unsigned int nr_swapfiles; +MEMINSPECT_SIMPLE_ENTRY(nr_swapfiles); atomic_long_t nr_swap_pages; /* * Some modules use swappable objects and may try to swap them out under --=20 2.43.0 From nobody Tue Dec 2 02:19:50 2025 Received: from mail-wr1-f46.google.com (mail-wr1-f46.google.com [209.85.221.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CA0A736A00F for ; Wed, 19 Nov 2025 15:45:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.46 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763567144; cv=none; b=Xc8had5EkyuYcAV0fT5RnaEYCO1K7gUbJhrIEe607OaoiTXdmZXiWYwqdYcSBZBzvW4uqTPw/vrwikZXjy4q4TEif4SX/NXSiQvzNy4RtdipTkX+ivemjghGQH34cWSG/TvjUcf6rgOUQ8W3dyGt2lQGD3ZOrgeihwjMsjvGbEE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763567144; c=relaxed/simple; bh=3D6cMAtJFcH0eGhpLiRPBCAWIwBu4/DIokVo2lKhkeY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=h5KaOGfCVn7cKnkqT8ayKqJc0wmswIDF4A8URf9DaUqBAn3IzLmin/oOKRifb6f2Zt4ngUoOxBYMAamzgqtcJNDbwPAzd53EJP3FDZfsOS+ngSEmLwqd+MJ0FtpqDUnZWHLj0nvXJPr+7u46YB7J8roqPvORXFNT4lk5OQlnT/s= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=pYLbNjJI; arc=none smtp.client-ip=209.85.221.46 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="pYLbNjJI" Received: by mail-wr1-f46.google.com with SMTP id ffacd0b85a97d-42b3669ca3dso3464149f8f.0 for ; Wed, 19 Nov 2025 07:45:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1763567136; x=1764171936; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=1EgUtWpxUoehpDvVbPcVA+GkHlZFESzHxIeFdx8HGLc=; b=pYLbNjJIY4xqxEIuEns8uXjvZ7F9isi/7jugo5Qj7mhP9MDL/QpwdMISZcJdNL9qP/ y9ZVXz8oEfwgevPWLkpZcPeLF47jsOb/XLf6/K0XXuPwugKhs+phJYcFTU6ZYG5E4S/r o+Gp6z+r3MWbQ861Bcu8Uuld23esVOU+yE3rs15fEovLoc4dr+ngBE2HsPuDyaaBMk7k PRsZEYjW7PPvzzPVl2RzcO++pOHfy+eUzYEjW15SHSG2mnuw9/5gHaT85gJU5KvJyeWx dle+WOQC/9zPb3r7giPWeiI3kW7J2GODRp8Myf5WewGW6sR4l53Vhkhm3IGgtNkPpyaU tTVw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763567136; x=1764171936; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=1EgUtWpxUoehpDvVbPcVA+GkHlZFESzHxIeFdx8HGLc=; b=xM67kbz18xhh1NLugAdNumT+r60i4NRGUHCQ32zb4WFYEcZn77vPuwShRSLbgHSZc1 G4C7CLq6OS2YkpI48wrnkVKFf9saHq/wIOZXay4SfLCYSw/6yHeWUzyNWR0hsKeBDXBG L+/viubVevMGU9wc/p4W18w6rMpIyBBEC/jb4UVpMuArNuQCFkcgv36V7bajN/Xbxh0o ZknX2eMmrZGyhUrg8yMQpuIMnTzNQTEgT6M1mTEVICB6n+h0xTLJ6tp9E7/c/bbTLtky Q4GcUFbZxN5r+0ZwfrOxdLdloPZ0wrsqUKrhvkj4cdxad6xnQV0rFcVC7H0RcPYc/bzX jc0g== X-Forwarded-Encrypted: i=1; AJvYcCXjS9dTtWpxhKWn+3LFsvu0zsqLH5+wj0CgTZp9f77NXeXdf2M2h5QYHFs7+yjOJ0uwVd/BJO5MGGpCeMM=@vger.kernel.org X-Gm-Message-State: AOJu0YxpA+Ja/1xLMop52ROx8JhyBDOk/X/enyYKYo3bePOBWY/Np5ac j75my1DIX8raaXLYoEjF83unupi0NK/EuWW+CURqRnt/cJ7UKAbbAMvLNVVtTtVs1yw= X-Gm-Gg: ASbGnctwOj35dN38xQ8J7jfnOsKBsOLyd5kUFIt7h1Co+h7YJ7KrwjFkieV0Auz6HOe bhv9iSoZ8SNipqGbujl4XPENMezaUFR0xhUT7vxm5ibBTUIozL5Ulky1HVPPduSHKDdUCWP24Ai f9vQW7hIxm3Y5u/jAf8X9Zil4us/kdHCuqrwHZT2IpWErtVUHqxf9tgwxLZbncVfFJ36rlimro6 IOTityAZWq+viDJt4fIn8hAXn7IaptbRUVXdhT7WDWR1eMSaYeod9e4ziu8fV6GvIuIPZsl458B Fj0sR967oN18dXWCb0Z7CdifEdW9D6TwEQ+2Q790xZlVUautF/2OYv3c1VNttsh/Fnc4RHOp5wD NycbR+hFi/7zQ+8fCAb6ENw6DTiIghYYnqpkTPL6YJynN6v+4jO9VnRHc/vYAQzvYyCD2FI566E /90kmuoJ06gmx4pn6Vz0SXtp6RocWUcg== X-Google-Smtp-Source: AGHT+IGKFFWZ+AqolHJ3imLY6SMDSF30b2mMpFX+Q/YU64RzAj2P3ofwp9AZZn8blv/guB2oFBfRQw== X-Received: by 2002:a5d:5f93:0:b0:42b:43cc:982e with SMTP id ffacd0b85a97d-42b595a497fmr21650580f8f.36.1763567135863; Wed, 19 Nov 2025 07:45:35 -0800 (PST) Received: from eugen-station.. ([82.76.24.202]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-42b53dea1c9sm38765632f8f.0.2025.11.19.07.45.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Nov 2025 07:45:35 -0800 (PST) From: Eugen Hristev To: linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, tglx@linutronix.de, andersson@kernel.org, pmladek@suse.com, rdunlap@infradead.org, corbet@lwn.net, david@redhat.com, mhocko@suse.com Cc: tudor.ambarus@linaro.org, mukesh.ojha@oss.qualcomm.com, linux-arm-kernel@lists.infradead.org, linux-hardening@vger.kernel.org, jonechou@google.com, rostedt@goodmis.org, linux-doc@vger.kernel.org, devicetree@vger.kernel.org, linux-remoteproc@vger.kernel.org, linux-arch@vger.kernel.org, tony.luck@intel.com, kees@kernel.org, Eugen Hristev Subject: [PATCH 11/26] kernel/vmcore_info: Register dynamic information into meminspect Date: Wed, 19 Nov 2025 17:44:12 +0200 Message-ID: <20251119154427.1033475-12-eugen.hristev@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251119154427.1033475-1-eugen.hristev@linaro.org> References: <20251119154427.1033475-1-eugen.hristev@linaro.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Register vmcoreinfo information into inspection table. Because the size of the info is computed after all entries are being added, there is no point in registering the whole page, rather, call the inspection registration once everything is in place with the right size. A second reason is that the vmcoreinfo is added as a region inside the ELF coreimage note, there is no point in having blank space at the end. Signed-off-by: Eugen Hristev --- kernel/vmcore_info.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/kernel/vmcore_info.c b/kernel/vmcore_info.c index e066d31d08f8..6a9658d6ec9a 100644 --- a/kernel/vmcore_info.c +++ b/kernel/vmcore_info.c @@ -14,6 +14,7 @@ #include #include #include +#include =20 #include #include @@ -227,6 +228,9 @@ static int __init crash_save_vmcoreinfo_init(void) arch_crash_save_vmcoreinfo(); update_vmcoreinfo_note(); =20 + meminspect_register_id_va(MEMINSPECT_ID_VMCOREINFO, + (void *)vmcoreinfo_data, vmcoreinfo_size); + return 0; } =20 --=20 2.43.0 From nobody Tue Dec 2 02:19:50 2025 Received: from mail-wm1-f50.google.com (mail-wm1-f50.google.com [209.85.128.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 583A436A01B for ; Wed, 19 Nov 2025 15:45:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.50 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763567144; cv=none; b=GCfTw9sV1YqPb5O4u3smBR7q531Jp14fKB39f4ZomdSBGg2ISP8Vs8bHu4e52g4XBE/K4kcuwX2JbUEQIzZ7B0O8OTMeAoEcMU8Y7WAIN4Pv0pLUSiBYztcTLhquSvjrvI3BZV9VXUiQU5G2CjwiRIMYClj19GrGbtYpsag4Bv4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763567144; c=relaxed/simple; bh=bdt5n2rAVI8cStNvPmdZt8oM87hfXgPy8mlP/xL4jOQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=MUWu8EVP60C5771frZVWPmau3glCo9SIAOQMx72dUZKgN0Exfv/0RLdFomuxmpB0pVzWTiX7knC2lGRAhTXNrzyU4BXlEqMi90zFk5+i2cezskOiGY0+KUv+JYZEVBDV0G1/aS4+pESTY1k7sYzzcVYUBiqltg+hLEMCoA1ClFw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=bz492DHl; arc=none smtp.client-ip=209.85.128.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="bz492DHl" Received: by mail-wm1-f50.google.com with SMTP id 5b1f17b1804b1-47775fb6cb4so50231715e9.0 for ; Wed, 19 Nov 2025 07:45:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1763567138; x=1764171938; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=slnZKLktel7FGULom0AhklQ/3aJdt8tuo66g65NOCPI=; b=bz492DHl5yOzE9yJqimKdlgCFvBmcsPkvDkuBNCriAVZnkeSAqY3nP7LGbyBZvdxbW oc2HOPgDgVH18yyt6HjNfvydEL8GIuHXv2Pofai7w1UKXlmII3hPumvCXNOvOePSROSi e/2BiBnIWC2n2sNn+FoRECLcoeEkoo+4CnwCEhpQwBpUULBVqNYLT4F1hgITIZqkJLqQ bfeKsPz9KlTRqx2ZVlK2A6artCAtJV32H7NQpEOqVUMiDR1uo3umGlgdSfA+RVSV9ygb zLmQSslT7dn9MaSqtfyzoxsSoi+0bpd+NdlBvr5Az29P7gmjqheUCt9rGNgINWi3WwuL Kn/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763567138; x=1764171938; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=slnZKLktel7FGULom0AhklQ/3aJdt8tuo66g65NOCPI=; b=H1b6Pdvc4kjY+ddW62mgZNcoQjBs5QH9G5vjMRP3J43hVRkNgfvo6ZYjTP7m1ZWgT0 WOxDJ9Hb7F0tQ3UsMTnc6hsESaMHCiLD7jNYyCoXHNMxPyssoDG2rXOXc5OW/TRAIduC v0+flp8VzgHOUgA14ooGoPM/fJkkHPX+ElW9JAlO0CSkFATBgpOLIc7kcmhig1gFWbLq HqR2uIx7teLg0ROer8bcKPa2rtqWi8G3BToUWUS/TTEisFflNgBljUFDIpCkpt+LgXX5 gw1Zhn8sfvZsk6XSSQ2z57A2iP007OamBxz9KcBuU36VG6KQcSXyG3q9U/h3VIKv+/gV Cp9A== X-Forwarded-Encrypted: i=1; AJvYcCUJgF9Xfd/EzhvX9+e8nAs0DWmFzcixn16ep/2peYWbCDGb7PU77vZcd6/G54XqbLst1eieMf+WdDltz2g=@vger.kernel.org X-Gm-Message-State: AOJu0YxdXO44sXeSTRm/7GPe5QALSKSi7uL4tGLVVrwIZWZ/NUYdc4Sh h9KGgLd5xnb+vddFP4E1SoBZxTAQcf7UcjZcrsRQ0UWoZ4cJg2WDZQo7b7tPp/bMH4BywmPq7T7 iRtVb6Hhnyw== X-Gm-Gg: ASbGncuwOkSS7+nbHxToLGz40XXYSZHhS5ycGyDDMOgPeg7hQmC2OTrIk9wzDCWIXHd +3K28qvJjoeBxSKQfqno2GyAN82/VKZSJeqnyQUfbObtgI2A5s1u4z6ZrQDxyNRn39TLuXwXunQ wW4qq1nKcq5uAf4rK8i8H6K6yDSQfOCzVMv+PWAQ3WxvobQAi1omwsS51NRDpHWLOjKwHbu5nqf FeEMVJBmtJJAlXqveOfAbmAr0VXO2O+8B4yw1eXWSRYPLfkXI3bcMSpqr/xVXu6CCLjQSLuXJ0N fpg1tTDa4D1jacIZhIEzM+5M/KatjehoufHYIYnfsp2HJiyvJwba+EO8TRbs3AASzRy3UMbq0Av jAwbvFr34g1WsGNKTrPRsSbfL/MZzyR1v5+D1pvzIAGd9Zpb3bRM2SwYoMvBBO7Gq7OXBSLzwZT laJxamZjd6o97i2N2oJCrKGoRilUuFzPOO3U11v+n3 X-Google-Smtp-Source: AGHT+IH9XA5XKwB+eYd4P52AVjjtUkCjRx7TcK6UtIfvF/aP3IOPVELnIO3YhYk8yezAw62YpuQ83g== X-Received: by 2002:a5d:64e7:0:b0:42b:47da:c313 with SMTP id ffacd0b85a97d-42b593395a0mr22250899f8f.3.1763567137600; Wed, 19 Nov 2025 07:45:37 -0800 (PST) Received: from eugen-station.. ([82.76.24.202]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-42b53dea1c9sm38765632f8f.0.2025.11.19.07.45.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Nov 2025 07:45:37 -0800 (PST) From: Eugen Hristev To: linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, tglx@linutronix.de, andersson@kernel.org, pmladek@suse.com, rdunlap@infradead.org, corbet@lwn.net, david@redhat.com, mhocko@suse.com Cc: tudor.ambarus@linaro.org, mukesh.ojha@oss.qualcomm.com, linux-arm-kernel@lists.infradead.org, linux-hardening@vger.kernel.org, jonechou@google.com, rostedt@goodmis.org, linux-doc@vger.kernel.org, devicetree@vger.kernel.org, linux-remoteproc@vger.kernel.org, linux-arch@vger.kernel.org, tony.luck@intel.com, kees@kernel.org, Eugen Hristev Subject: [PATCH 12/26] kernel/configs: Register dynamic information into meminspect Date: Wed, 19 Nov 2025 17:44:13 +0200 Message-ID: <20251119154427.1033475-13-eugen.hristev@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251119154427.1033475-1-eugen.hristev@linaro.org> References: <20251119154427.1033475-1-eugen.hristev@linaro.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Register kernel_config_data information into inspection table. Debugging tools look for the start and end markers, so we need to capture those as well into the region. Signed-off-by: Eugen Hristev --- kernel/configs.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/kernel/configs.c b/kernel/configs.c index a28c79c5f713..139ecc74bcee 100644 --- a/kernel/configs.c +++ b/kernel/configs.c @@ -15,6 +15,7 @@ #include #include #include +#include =20 /* * "IKCFG_ST" and "IKCFG_ED" are used to extract the config data from @@ -64,6 +65,11 @@ static int __init ikconfig_init(void) =20 proc_set_size(entry, &kernel_config_data_end - &kernel_config_data); =20 + /* Register 8 bytes before and after, to catch the marker too */ + meminspect_lock_register_id_va(MEMINSPECT_ID_CONFIG, + (void *)&kernel_config_data - 8, + &kernel_config_data_end - &kernel_config_data + 16); + return 0; } =20 --=20 2.43.0 From nobody Tue Dec 2 02:19:50 2025 Received: from mail-wr1-f49.google.com (mail-wr1-f49.google.com [209.85.221.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E36FC366DDE for ; Wed, 19 Nov 2025 15:45:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.49 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763567145; cv=none; b=hoD8ygJUs9uj3y8bnj4ZhjachyGPctkzZAUH413wMAm9enUsI2H1lud4XZKc89UxEMj5V+2WZIkjkiwCWCDaWG04iiYpRMhEY5YntwNYKKGZI85QVkEAbe3bz7UAgcMaZZckyYkAKY2X7cFRkYC3fEunYd41pCm5nL31jwgMh3A= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763567145; c=relaxed/simple; bh=JX9G2IddNBochneGYWQCKynmuHEMYdz6GZlhqVo2tUg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=fN6ZsKRN4krKXUiQD++qujYoEjPMuYnrCqg4ld/fhoBOZo929shfdjm49jk5gGfuKdAUnzlizYGOYQprHfwq/dBZVgCwe9g65iSnfLPGKgqB7W5Wv0BQu7+BtU/heENfUlC2nS5YTsWuCl8DHiLFKWiPTDe4RRbdA2d2j5wFmZY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=rAnSdbFB; arc=none smtp.client-ip=209.85.221.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="rAnSdbFB" Received: by mail-wr1-f49.google.com with SMTP id ffacd0b85a97d-42b2dc17965so5618250f8f.3 for ; Wed, 19 Nov 2025 07:45:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1763567139; x=1764171939; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=JjJbR05GJTjvP4eC8iuNclWxk1mMm5RuLT4aWNn+uIg=; b=rAnSdbFBCLvJLjGUsRP/QcCxvZOZSBH0Zgq71o4AlrJ42jn5rslMLmFXW2AxVikkjc TCFSyFvag+KDqaGb+sGs6y6Xav09Zyp10l3ZPFhA94o2Ri3OzwIj02xzj+m0FuSPn/Gv hD1RwrF7bt3oyLRQ5AQJ5JdP2XYKa+DRSBQ8FahHCby8Rmw4HIxn1MEMOVXs7a2B6/2u EVKQhhdTnuxBtaFrS4GyTGu+YV6B791L869p/wQHxmNOdi+WqgZOXrqw3s6bGiwy5FTy Tw6bwTM4dfJLyCpzNUExW1r8gLRr75kF8oll6wI7RdBr3kTbO/KRsqKSb6aLjhuH5/bX l6IQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763567139; x=1764171939; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=JjJbR05GJTjvP4eC8iuNclWxk1mMm5RuLT4aWNn+uIg=; b=akTjTHeiVTtVtQjwPMOil9LnGcl2oNGe6JI3y6Uo1JCdfasWN7jgs67BvoLK4ApFih b2ubfhr2LH3+4M+z+V25K1/9ze1Mi2WQCi45gD62zO/YJNdkn71sBXmUS79pryY3lhBa nk6tBF+IybMPSD7W7VSp3HpatrbPgCHTSmlSw13c7aP1lzSZ1rZvdZGVJHyHZSNlPf+P THFoHmnvYyfAhOAXd+Byftov6r/ST0BKXQqR0YMhO4aHgrEA2gKgmLxLew1i1BlKc7Hr jAAa7xObSKje1hKHFpgAj2IPnTdYsK9oxvFbcNJ9saFp9nc9+fWHm0zucMeMVRe3d4EN BJlQ== X-Forwarded-Encrypted: i=1; AJvYcCW9gDXsdqcoW/Ij5uhCiEl+rdPlPdN+53AX3RuqIy3Lx1dc0Yt5hwu8fo4G4rh5O7OClwUGkGTY1vY7DuA=@vger.kernel.org X-Gm-Message-State: AOJu0Yw7gdaU+be+A4d3TbIUcZCNdZPFLzeqkT9VGGef46WhEVjFHGaF 2dNkUQxM85ZRBa6LAgakPz6HcOmVnKmgOFO7sZJpVBE01eyJB0j+EuUdlk7uiiiJg5l/WcpB9g7 UZYs+wfAYyA== X-Gm-Gg: ASbGnct8e2kgmjskuzOb1f4XM/TC8PansZxDY5hv+Ficjrlh+0q+q03HRcOTa/nzaVf q14n9ZeWmOeBrOaj6BnoFHPCBcfK/fpI6m9jS3ihiaV3c51lGu0OcbWyQbaCl37xRu1ZQyvYVWb 4dwUOKADCEtsd/d4PYQ7idV5i3Pm46bMi9yzVlLw9etOaG8jaxBQioYM/OgnMSN4F3rwrsG/T6j ey2p8sAmXJj5dPJvlC0sQT80v6GO0CkkP/L1xSmtapgU/B6ynCqepTy+8TV0A+iliVpXcW67FXj bOJQjvvSvzfG5YRCIefAZlI0Srz+5vpg6yVqzmUsumPCUkBYBhZUiCNtkrU/Xi/EzhWgf/RINbu FIXkrLD22l1u3MjqwJ5PXArxV4VFlO3NifHgbKwjHfWnh23JaTxR5eAkCIxiNVIvIxEC+1HFYtB /d9xYNq6gfNJKmNu+fwxVmRDn7w4R5Vg== X-Google-Smtp-Source: AGHT+IEyhedKwAlBM3EiuchJNsF2kJSsWS7yZo6BNIFhuE+C/7ka0URI4Q7HQ+TXxvH0Bkqj0xsuVQ== X-Received: by 2002:a05:6000:2c11:b0:429:cd3f:f43b with SMTP id ffacd0b85a97d-42b5933e404mr19233459f8f.4.1763567139371; Wed, 19 Nov 2025 07:45:39 -0800 (PST) Received: from eugen-station.. ([82.76.24.202]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-42b53dea1c9sm38765632f8f.0.2025.11.19.07.45.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Nov 2025 07:45:39 -0800 (PST) From: Eugen Hristev To: linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, tglx@linutronix.de, andersson@kernel.org, pmladek@suse.com, rdunlap@infradead.org, corbet@lwn.net, david@redhat.com, mhocko@suse.com Cc: tudor.ambarus@linaro.org, mukesh.ojha@oss.qualcomm.com, linux-arm-kernel@lists.infradead.org, linux-hardening@vger.kernel.org, jonechou@google.com, rostedt@goodmis.org, linux-doc@vger.kernel.org, devicetree@vger.kernel.org, linux-remoteproc@vger.kernel.org, linux-arch@vger.kernel.org, tony.luck@intel.com, kees@kernel.org, Eugen Hristev Subject: [PATCH 13/26] mm/init-mm: Annotate static information into meminspect Date: Wed, 19 Nov 2025 17:44:14 +0200 Message-ID: <20251119154427.1033475-14-eugen.hristev@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251119154427.1033475-1-eugen.hristev@linaro.org> References: <20251119154427.1033475-1-eugen.hristev@linaro.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Annotate vital static information into inspection table: - init_mm - swapper_pg_dir - _sinittext - _einittext - _end - _text - _stext - _etext Information on these variables is stored into dedicated inspection section. Signed-off-by: Eugen Hristev --- mm/init-mm.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/mm/init-mm.c b/mm/init-mm.c index 4600e7605cab..6931549bb7a2 100644 --- a/mm/init-mm.c +++ b/mm/init-mm.c @@ -7,6 +7,7 @@ #include #include #include +#include =20 #include #include @@ -19,6 +20,13 @@ =20 const struct vm_operations_struct vma_dummy_vm_ops; =20 +MEMINSPECT_AREA_ENTRY(_sinittext, sizeof(void *)); +MEMINSPECT_AREA_ENTRY(_einittext, sizeof(void *)); +MEMINSPECT_AREA_ENTRY(_end, sizeof(void *)); +MEMINSPECT_AREA_ENTRY(_text, sizeof(void *)); +MEMINSPECT_AREA_ENTRY(_stext, sizeof(void *)); +MEMINSPECT_AREA_ENTRY(_etext, sizeof(void *)); + /* * For dynamically allocated mm_structs, there is a dynamically sized cpum= ask * at the end of the structure, the size of which depends on the maximum C= PU @@ -48,6 +56,9 @@ struct mm_struct init_mm =3D { INIT_MM_CONTEXT(init_mm) }; =20 +MEMINSPECT_SIMPLE_ENTRY(init_mm); +MEMINSPECT_AREA_ENTRY(swapper_pg_dir, sizeof(void *)); + void setup_initial_init_mm(void *start_code, void *end_code, void *end_data, void *brk) { --=20 2.43.0 From nobody Tue Dec 2 02:19:50 2025 Received: from mail-wm1-f51.google.com (mail-wm1-f51.google.com [209.85.128.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E336636C0AE for ; Wed, 19 Nov 2025 15:45:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763567147; cv=none; b=mJF3+qcK6bjri63e77cJusjFfHcSwA73/N8CGXGHvrXOfbIwAUpY/WCeRIsg19Pe84+bWD/LoPsBKns0qwWwU2nyplrtOHl5d4nYFGPZrtvY9uCQcVll7ULPxXJbWHWQm9dAs/7ff3U0XppN9Fj6E8rqqeepwpK9FexypaAqCuA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763567147; c=relaxed/simple; bh=oxMJ7nEx298nSQNAUvIm+RfzZDeUkq7JnffHAGnHY2g=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=szqVy9uO83/hnDUETIizO/tAXUcnwY7op3WN2fU9sqb9L344nZLYp1FYYXzsDazzO5lSQOcykj2iAmfGxcnHciCjEJQPPsw+W2s8ODiqwANtw3GYf5KD09E0L0MHC9QiglX3u6IeE5AwPNqVa0qFjxA1tyqoNed5vWkpW3djSV4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=FsCbIJad; arc=none smtp.client-ip=209.85.128.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="FsCbIJad" Received: by mail-wm1-f51.google.com with SMTP id 5b1f17b1804b1-4777771ed1aso48472845e9.2 for ; Wed, 19 Nov 2025 07:45:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1763567141; x=1764171941; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ERGSngcgAQCpMTKH+vT5ZfmIUQiWuwubvJ1CKsgHOkU=; b=FsCbIJadiUYCr6ejMirqwdULle+dFIB303mznY92UxGov8aRpXM1+QZ0YZAJZUD4WL dEklnlMCpvxXLYdxfYsOMAAtdJ7Y89yogdYrFJamQiRz30daYx5LMFbN32HWiJubddSV yKSmzvQbxm0kZ9/kKiXGX8ElkghkgmgldHj7ofdE/8tU2HEt33UbAYAY1F3di2i4/P0U 23nzNwXa9vf8tpAXj4yyp7i95O+QXZpgrtz3n/IVl1PCKWqIBOzKJ876OYZYt+aiyuMe u+98CAqWIInRKYI88txn1aq/8lAHBVFah13SAXvoapuq9p6LywhU7eCXy7B7xaClvy7C x/IA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763567141; x=1764171941; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=ERGSngcgAQCpMTKH+vT5ZfmIUQiWuwubvJ1CKsgHOkU=; b=uxZ0pFpAEhTl7fgrZ2ymWCeiLZzD9JMy5WsvH5PkG50n/O87kj2347j2blZCQ6Q17S bbGYE/CsTj4iHWji6j0f0r43RFpJSpI7FPLMWAXqLnuQNBhpnDD/+9EeYNL1UKszrDz1 8+e8GZ6RsUfEiSXPqkwT8P9NrmU1A1GgG5Z6PH+cZUBAIdRAWi8JPOP3aoSshWFUM2js gJJahUTX0ZTDhBa5k7lGW7Se0VyUCKpcUfDXcZ0zhtnHrkaUyg821T01I4MJVJuCBTxK jOo1CkskntHV5KEyMXMtF12Ic1sUmTg9PVDH43DJ9SrTl7vjmjz/piiXSO93JLPs7DV5 +2aw== X-Forwarded-Encrypted: i=1; AJvYcCVAKBidltyPPYgv6FIO0hBV2QjXvcohiYYw6PXaegWhsvidHqgW/2VVR8WYEcI5+WjnsUN7k2Wq896OuCU=@vger.kernel.org X-Gm-Message-State: AOJu0Yxpojfe8Mj8+erJ/NXQQQn/QiIM/tibKrzxEqt11S935J5fiNmG hQTc9O9P9Qf0Xx2z8f6o/t0lOloncb9JGYsoN47VNk8/y9NzsbWuPw4Nj0RRDyjP35s= X-Gm-Gg: ASbGnctIQEm8bA+95gvkzbrKbc9fTdMhZrByCow+Y9m58VpwtyeLZyjujGjP0+W7BVp XNCP/ZvRWmapivnmzwGutTAl4fGq4YNdnFy6sPiNpBjj25+V5eQQ85smpIcEbfzoXelSN2c0I2E zWO3WodAR+bD8l7W4syGQDV7wFho1rhJ39YFEKNlB2dQ5fU0fSU46oTcV6wA80QaIa/1wp1O54W CS1Pq5AhjDn9JX7dBIRHy0S/1CAwBZI2pXS6nXyRWINLtbUKHNFzImQd+jOm5HRPTmIhLuX4X3N kfMiT85Qp0F9EM4UFAJKR06Gvqfyn6agxc1/s3c/hK5xdZvq9EKEdfYcUaaqw784BwDhINjdyl7 rVu1AJvE1+4ofL6zw2qRN2a/gRMiMS3XhCubDABABWVvdvBlQUAou+8kKvs9lseBdRtWSRzSlfa yMrI+9QP7+Bz3uVz5JfMcIMkb0Nl9qKA== X-Google-Smtp-Source: AGHT+IGbRbXBdWPtS8s2pezZSC/ny/HyWuyG8gk1o+dQWRtSU7DtMYRlEtgHBlikDrn4myL+c90Kfw== X-Received: by 2002:a05:6000:2410:b0:42b:3978:158e with SMTP id ffacd0b85a97d-42cb1f9e99amr2655929f8f.30.1763567141134; Wed, 19 Nov 2025 07:45:41 -0800 (PST) Received: from eugen-station.. ([82.76.24.202]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-42b53dea1c9sm38765632f8f.0.2025.11.19.07.45.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Nov 2025 07:45:40 -0800 (PST) From: Eugen Hristev To: linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, tglx@linutronix.de, andersson@kernel.org, pmladek@suse.com, rdunlap@infradead.org, corbet@lwn.net, david@redhat.com, mhocko@suse.com Cc: tudor.ambarus@linaro.org, mukesh.ojha@oss.qualcomm.com, linux-arm-kernel@lists.infradead.org, linux-hardening@vger.kernel.org, jonechou@google.com, rostedt@goodmis.org, linux-doc@vger.kernel.org, devicetree@vger.kernel.org, linux-remoteproc@vger.kernel.org, linux-arch@vger.kernel.org, tony.luck@intel.com, kees@kernel.org, Eugen Hristev Subject: [PATCH 14/26] panic: Annotate static information into meminspect Date: Wed, 19 Nov 2025 17:44:15 +0200 Message-ID: <20251119154427.1033475-15-eugen.hristev@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251119154427.1033475-1-eugen.hristev@linaro.org> References: <20251119154427.1033475-1-eugen.hristev@linaro.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Annotate vital static information into inspection table: - tainted_mask - taint_flags Information on these variables is stored into dedicated inspection section. Signed-off-by: Eugen Hristev --- kernel/panic.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/kernel/panic.c b/kernel/panic.c index 24cc3eec1805..e99539e18054 100644 --- a/kernel/panic.c +++ b/kernel/panic.c @@ -37,6 +37,7 @@ #include #include #include +#include #include #include =20 @@ -56,6 +57,7 @@ static unsigned int __read_mostly sysctl_oops_all_cpu_bac= ktrace; int panic_on_oops =3D IS_ENABLED(CONFIG_PANIC_ON_OOPS); static unsigned long tainted_mask =3D IS_ENABLED(CONFIG_RANDSTRUCT) ? (1 << TAINT_RANDSTRUCT) : 0; +MEMINSPECT_SIMPLE_ENTRY(tainted_mask); static int pause_on_oops; static int pause_on_oops_flag; static DEFINE_SPINLOCK(pause_on_oops_lock); @@ -662,6 +664,8 @@ const struct taint_flag taint_flags[TAINT_FLAGS_COUNT] = =3D { TAINT_FLAG(FWCTL, 'J', ' ', true), }; =20 +MEMINSPECT_SIMPLE_ENTRY(taint_flags); + #undef TAINT_FLAG =20 static void print_tainted_seq(struct seq_buf *s, bool verbose) --=20 2.43.0 From nobody Tue Dec 2 02:19:50 2025 Received: from mail-wr1-f45.google.com (mail-wr1-f45.google.com [209.85.221.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 28E8236CE07 for ; Wed, 19 Nov 2025 15:45:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.45 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763567151; cv=none; b=Xl50DUT7Youhvjxht/NdvOMCcEsEqfOGTkIXpkNMc9cJCfCECf6u/xfU2Hvg6FrjFvNpQqiQUuOBqQI3aFYqeYvkllCSFqcBmJ5hdkabSbCfn13KEoWmoWN2QP3FqLP+i1BJjWFxK2vjUMl4pRYlG0y7ydFBxAQepDwPrQ+9pfE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763567151; c=relaxed/simple; bh=b7ZOQzNfYMyF79i/MOcMgt4XB6zny2khgQb+AuAIOw4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=d4R7IWXy2XxrszMCJ9sEaPwDEHfqfAK8rejMkosItDAusTWgmSypiAn6HUtNwYsGvTS0Zrq3ti3UPbN0XIn9oYjlgCfEfJl/Kh+0r/npKpMI+lQ9VXAmneT7ThFyLWKrmWwYZVfSwQRSpKsA9BZeQJxuGSgE+dCSzsEILwkyR5M= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=XeaDF8kX; arc=none smtp.client-ip=209.85.221.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="XeaDF8kX" Received: by mail-wr1-f45.google.com with SMTP id ffacd0b85a97d-429c8632fcbso4851371f8f.1 for ; Wed, 19 Nov 2025 07:45:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1763567143; x=1764171943; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=VVYkZ+YGVFmg/wGLFr+Mopllp1/vePaMucgqpmR/GFM=; b=XeaDF8kX7ZMHl7X8ve6YNTs6euc7cDzNwMF9/a96PZftfKYfkZ/jXE/thXL/LIiIaQ Q02MWmIB0O+JZ4GbrTxisOUMxALtAyHyz7jTCadkeqf2n22P1NIagu441f3tgFfM7QcK dPVYhDfsgeVsAh6mkKLn7q2BI2RpjPAWudhIFGd5mliSmMThEjsoxYZzUd8k5X7CyRsw sHUf1zcJWaopAFbyIAHxwLNqAwpL2GPHXcCGTngCCzojxG1y0pFkuHuu7f41aalfT3XU P6RMp8UgCgz+zFoKCmXIQRXYYotpvNuXYRt/Q/hWzlmcyHHgx4Vpn62xuszXtlAhNHlv FbIg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763567143; x=1764171943; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=VVYkZ+YGVFmg/wGLFr+Mopllp1/vePaMucgqpmR/GFM=; b=koGvk6w+P1tOlwzSblI9A00arJEF8XQfPf8XKsHbEEIGhKVKC+JyTnvTWHgCXPaLU5 W11GxG5EOrkCr45d0suy6YMHD8qkysnVKmvQPlEEdg3VPTS2f7wsEcfDuYpP3vQIN8Bb Ushrzi37qkm5O16l+Hh1HwXTfXkllzYeWDgqfiDvAD/VtMAXS5s3/gsgw5pvMvrmjJMn Jd4t4ouSiSl0aoaTeQ3tghdDdfaVIFhgmXT0+ZvyCyJvEY6f9X025765WNNJEDD2x+uS 2LpyUL/TV1ia8+JO9So86WyEcjhFyhK57ttQS5gX7KaS9Yn98JE1ve5L4lTG2cMvPHQB ceUg== X-Forwarded-Encrypted: i=1; AJvYcCX5dCgGcaRNCbD1wiiF0iCnZpKA5M3NbaM91HcWbl8XVAt+BGkbl2HpfWgxG5TtirJJ4SYilRe3D3IkhYs=@vger.kernel.org X-Gm-Message-State: AOJu0YwmUEkTWCX3aAthF4ORd13sav1MSNlnxSi+q5ZMlKYZzzMoMcjC fUKuR6kBWAPud/z5UZYUsRwWlsyKk4aatxtgHDEUeIm4w6ksHb0KV/fH1cDanesT7QQ= X-Gm-Gg: ASbGncsQH2Py1EpEwaZ0L2Kb+a+7q8rZmi8DEltiryJeMeh8bhB3QXJI8iRmLIwG9xd IflKlvLcsdlmU70m5dmQznTXpcJWLO9eEoJcowjLX1y8un52w80P4eVSAu56Bc0X2BQUMtpg62Y elqC22nGVP/I22GNaNeQuW5GDuBPp+p7PF9tKocj7klF8Hfk4NDMby9ZU+RpNfOrPQIhtUY8/bL WgCarS2tjznKzQevyhFdgYpJhJbHTmjHTBy3a8ATMsHLlDP4H6GMUQ4zJvnXXSNPhhIScLqwsnq gBKeB24y4NWcAJFH4mPIoE1C4FHJ+nRcYh4dw6fjZnTNnsRgo7R2IwigPLzqUJ68p8ncrIq0foD Dp7juAQ0fmlfQjRUNq4mtF3QSAY7MsqSPhghyRCuscQHZAMi38ClwI7u8Nx2tzwscFtMxMUNef3 IbLHQoFdUMVyljrYuP5eNqvBS/0M2b6w== X-Google-Smtp-Source: AGHT+IEZRkUZWC9WWo9OX6jj9I/ZWQe6urgV7WqPXknOd3CwNTmQvHOBkmKtLsoZT2TI4A/OTOkOYg== X-Received: by 2002:a05:6000:200f:b0:42b:3806:2ba6 with SMTP id ffacd0b85a97d-42b593394b4mr21022814f8f.25.1763567142926; Wed, 19 Nov 2025 07:45:42 -0800 (PST) Received: from eugen-station.. ([82.76.24.202]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-42b53dea1c9sm38765632f8f.0.2025.11.19.07.45.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Nov 2025 07:45:42 -0800 (PST) From: Eugen Hristev To: linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, tglx@linutronix.de, andersson@kernel.org, pmladek@suse.com, rdunlap@infradead.org, corbet@lwn.net, david@redhat.com, mhocko@suse.com Cc: tudor.ambarus@linaro.org, mukesh.ojha@oss.qualcomm.com, linux-arm-kernel@lists.infradead.org, linux-hardening@vger.kernel.org, jonechou@google.com, rostedt@goodmis.org, linux-doc@vger.kernel.org, devicetree@vger.kernel.org, linux-remoteproc@vger.kernel.org, linux-arch@vger.kernel.org, tony.luck@intel.com, kees@kernel.org, Eugen Hristev Subject: [PATCH 15/26] kallsyms: Annotate static information into meminspect Date: Wed, 19 Nov 2025 17:44:16 +0200 Message-ID: <20251119154427.1033475-16-eugen.hristev@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251119154427.1033475-1-eugen.hristev@linaro.org> References: <20251119154427.1033475-1-eugen.hristev@linaro.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Annotate vital static information into meminspect: - kallsysms_num_syms - kallsyms_relative_base - kallsysms_offsets - kallsysms_names - kallsyms_token_table - kallsyms_token_index - kallsyms_markers - kallsyms_seqs_of_names Information on these variables is stored into inspection table. Signed-off-by: Eugen Hristev --- kernel/kallsyms.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/kernel/kallsyms.c b/kernel/kallsyms.c index 1e7635864124..06a77a09088a 100644 --- a/kernel/kallsyms.c +++ b/kernel/kallsyms.c @@ -31,9 +31,19 @@ #include #include #include +#include =20 #include "kallsyms_internal.h" =20 +MEMINSPECT_SIMPLE_ENTRY(kallsyms_num_syms); +MEMINSPECT_SIMPLE_ENTRY(kallsyms_relative_base); +MEMINSPECT_AREA_ENTRY(kallsyms_offsets, sizeof(void *)); +MEMINSPECT_AREA_ENTRY(kallsyms_names, sizeof(void *)); +MEMINSPECT_AREA_ENTRY(kallsyms_token_table, sizeof(void *)); +MEMINSPECT_AREA_ENTRY(kallsyms_token_index, sizeof(void *)); +MEMINSPECT_AREA_ENTRY(kallsyms_markers, sizeof(void *)); +MEMINSPECT_AREA_ENTRY(kallsyms_seqs_of_names, sizeof(void *)); + /* * Expand a compressed symbol data into the resulting uncompressed string, * if uncompressed string is too long (>=3D maxlen), it will be truncated, --=20 2.43.0 From nobody Tue Dec 2 02:19:50 2025 Received: from mail-wm1-f46.google.com (mail-wm1-f46.google.com [209.85.128.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 364773730D1 for ; Wed, 19 Nov 2025 15:45:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.46 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763567154; cv=none; b=khvpBi0Gfsl4YsYx4eNJP9V5AT/vgrq5YgNcf13suxaECMjHTNRh+8YPNCI5iV7szbljw8B10Wg0AiSrcvGHJsprM2LUIdzfSpCxw3pxMQmi9HAvOKX0c5W5KpKELLfTrh7sT+TvYYmzOmo1E/hqU8brEYlEDSCdbzoMScSg2HI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763567154; c=relaxed/simple; bh=1fpsqew6FkRmrcxog8da4NhZ+AALs5Fn4Z4m4DLttGg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=QhAe8rXJixwFZTBlsOAZlIMmXWTScFXKh0b8xI0ECsi2siz71oCRLhdoONfEa88ZrpBWWcQOVljTypvPiGuiK6Q0xPiGuOZhQJLS6nThRBGC5DCD03SxzcBsn6SRoF7rsozh9dbNPn9wJvtl1dm+x1wRkvxGrQ5G1/uenfoeMqk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=TDFZ1Lau; arc=none smtp.client-ip=209.85.128.46 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="TDFZ1Lau" Received: by mail-wm1-f46.google.com with SMTP id 5b1f17b1804b1-477563e28a3so8031105e9.1 for ; Wed, 19 Nov 2025 07:45:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1763567145; x=1764171945; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=qf0q06JpGKFVTNkejD0yb20CFvUyN2OLH5ZYFwRjaWU=; b=TDFZ1Lau6WPw6tyZUAI40mJfoARSjm8gLGa8hZEvOVsTVCAvvEoljNzjcqBTO3a1h9 UX3wEiFW6HWi3GXSZ7R7C/wR9O0fSPFtMH1z8YTC6poYITj+PkCAMn2Uxa8k1QP9IEZg ZT3mUC3nibavdyK8E1rX5NRrHwzyeBVoWusZ8P1ljTrYjPJxQoBpdiQ9aW/xIQ7zdBfl lURYj6pwWn0cfxS5Fv226Pjg+zV/5OcnYIJN+UrO37SelHg2c+odhEiQCb4xNHL5/wh1 2AzQ6Z/LAR1mF/VSx3U8b0YZ7wWAXgFO6Bw6877BgJDcul1GYRjqMQGMkLv8OYLKigZv TsyQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763567145; x=1764171945; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=qf0q06JpGKFVTNkejD0yb20CFvUyN2OLH5ZYFwRjaWU=; b=Flza2OE4TW+YpYtH/ADuCznj1IdXNnwBpCrgmH0Vo3pqgU6tDJo4oQ18TH9iNzD5uF RNDZ7Z4pJajqNwkxOAG2SH8V0PIaAhW2/1ET6aUdv2EABDumBsMnuYfUOgk3kGUTeXMg 1ocbQHOcFATvnoIDVFF7V78WaeGo/Plt8YYSsXPVTJqkJbS3HuEwd8Ecn/qBmRGzzh5U UqKfiolHnmCzmYNLDGMRwQiv9reK/ruAE49hDV9HOwA+4ACCL7bG/woEptosthG6Z1go hlmFcXDkipDTy5BkttpR8M3ayj5p4reaiRvEodNRGGDyG7JSx8SLgnN8jPLlgqcHqWY0 RTSA== X-Forwarded-Encrypted: i=1; AJvYcCV6q5VJI/4iaNiQ/ALtCPzw5Sv9OnB2wSzNFoRdcfPM7eWrCWOBkcV9kvvJYJjpft3LI7dR+NV+TZiAX/I=@vger.kernel.org X-Gm-Message-State: AOJu0YygilSrIo0wGm7myfB1dBjWF1Dl451TDx/V9mSE9L8jvqLACuyD EsbEeLcEYoMSJR74pArQzzk0KM6TWZIQLO5LvVmySYapGbin4XHh5sh0Ppw02U9JUhA= X-Gm-Gg: ASbGnctBfBOyl7hGjCcxwiVUGAUE+IH4qEIc0TV1RGiOIlOiEHd/wKb3XWxVPaMsoPD 8mfN/1+OmJ1lfKmojKxt8efbSEikrt57AGO2/whLxHvDdLRXG2JZWG+wXOJB5DFfXuVSkOCE60f q6aFIAxpowIdt+ztGTkxrH4/0XEH9ixgv3VP+PBK0UmPOadm/pONe70aa3UMAUmNZqk5S6L0XMC fRQqfPe8JC0dgkxRqEmc+H54kqdxlC8jZ6Zr81WMiVZpShnYD2ovikCpz67FRFP3oGBduUBy66+ 18xw26HZIOGbEmR+KMk8PK8NwY11EbeReKlvriBHVRdSUifeas4TLg+sdMS4IBiPpjH6oFwjLEW /MJZs9lbRL67n4fkTRMnnnoU0I6UQ1M2cbEUsIzARqeM12q0Qph5bhp5X7bko3EANoBmGtFtSLg o1RBm7K8sREQcVXZYSnpuwp9NY8hwFig== X-Google-Smtp-Source: AGHT+IG9WtxjjgmkiAX9yQZlIznike3yBomBYuHSDjoJXaquW6OMMeXhxlHfzRespLZJBzb+ERriSg== X-Received: by 2002:a05:600c:2313:b0:471:793:e795 with SMTP id 5b1f17b1804b1-477b1787bafmr21362035e9.0.1763567144657; Wed, 19 Nov 2025 07:45:44 -0800 (PST) Received: from eugen-station.. ([82.76.24.202]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-42b53dea1c9sm38765632f8f.0.2025.11.19.07.45.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Nov 2025 07:45:44 -0800 (PST) From: Eugen Hristev To: linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, tglx@linutronix.de, andersson@kernel.org, pmladek@suse.com, rdunlap@infradead.org, corbet@lwn.net, david@redhat.com, mhocko@suse.com Cc: tudor.ambarus@linaro.org, mukesh.ojha@oss.qualcomm.com, linux-arm-kernel@lists.infradead.org, linux-hardening@vger.kernel.org, jonechou@google.com, rostedt@goodmis.org, linux-doc@vger.kernel.org, devicetree@vger.kernel.org, linux-remoteproc@vger.kernel.org, linux-arch@vger.kernel.org, tony.luck@intel.com, kees@kernel.org, Eugen Hristev Subject: [PATCH 16/26] mm/mm_init: Annotate static information into meminspect Date: Wed, 19 Nov 2025 17:44:17 +0200 Message-ID: <20251119154427.1033475-17-eugen.hristev@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251119154427.1033475-1-eugen.hristev@linaro.org> References: <20251119154427.1033475-1-eugen.hristev@linaro.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Annotate vital static information into inspection table: - high_memory Information on these variables is stored into dedicated inspection section. Signed-off-by: Eugen Hristev --- mm/mm_init.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mm/mm_init.c b/mm/mm_init.c index 3db2dea7db4c..c31062a3ff47 100644 --- a/mm/mm_init.c +++ b/mm/mm_init.c @@ -32,6 +32,7 @@ #include #include #include +#include #include "internal.h" #include "slab.h" #include "shuffle.h" @@ -52,6 +53,7 @@ EXPORT_SYMBOL(mem_map); */ void *high_memory; EXPORT_SYMBOL(high_memory); +MEMINSPECT_SIMPLE_ENTRY(high_memory); =20 #ifdef CONFIG_DEBUG_MEMORY_INIT int __meminitdata mminit_loglevel; --=20 2.43.0 From nobody Tue Dec 2 02:19:51 2025 Received: from mail-wr1-f41.google.com (mail-wr1-f41.google.com [209.85.221.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5371D377E98 for ; Wed, 19 Nov 2025 15:45:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763567154; cv=none; b=scSA/tGkLVNuExiBYO6Wz/ms5UsJOc/ZMopyh7lCbzYiAJYQKfm2vyMx7TyXJIX6NFpP8wdJaeY51SCY9ipBJC5gi/uhadEK33BZ+4NFdyxEWxGlewzF6WgOhuxPpGWw84dl4VGJF6ibr7U4/9q3GiwTXW9q5+T+TgfjtEhwQqw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763567154; c=relaxed/simple; bh=puCNsUx1cqEsVIIsTQXC2Zu04afcvVugn2nqwtYBNCc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=b0tXHPZjX/3HgSG5KsScONZTFmAPhZqsjQ3aDtIhujW8/bqv3vKKiAnGYlEjiNfpO3SK5P63OEBPTYdT7zymDHUSxmkcAct2TlvnjJD8k70q0t0HPX1XQCGP6A1v4N2MNxi+my5yAWDU8tHP09KaXLeTA3EuEVTsYCPkpZYNXNE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=u2cvfbXn; arc=none smtp.client-ip=209.85.221.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="u2cvfbXn" Received: by mail-wr1-f41.google.com with SMTP id ffacd0b85a97d-42b32900c8bso3968894f8f.0 for ; Wed, 19 Nov 2025 07:45:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1763567146; x=1764171946; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=cDp3sMBoTlmxBrCfHcN3bT849KzRdDNMVpiuychnTdo=; b=u2cvfbXnHZX8S86mhbmVlDKoHQ2qZIBOHUToZr3q51jGLlJFmHxxQcU/fm1uw3dr/L ryR8SU3D5iO0H6+339AdAvKpGNAn1CK6/oOlstGHI4cd4xG6+/w44Ge5Or0ybjFmHaS3 TmyiHTUji9gaHk7uex4IBqSQYtfvzqDF4k1l4LfR1824PbZuKmIt9zwUJc4RzpmuIicf FnV8EwOu8LdVRf/aAcAWgL+Gv4kc4rnhvuoRDiBZpPwDdKCtUw0xPkaSpKH5yXwWXj/t JHK8eUL5sBMFkiK5dz64vZJDZsK1hF9kybnlSUvlmbITELWgyWL8yGyyhYzSYh/yxDZ1 XWqA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763567146; x=1764171946; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=cDp3sMBoTlmxBrCfHcN3bT849KzRdDNMVpiuychnTdo=; b=A71J4icD64Vn/jiCYqydPOX79dst2rvV3vlwFsRqgpnQYi8kzLfByF8TkpZZ/lnOhy Won05NtGthtxrKeOla4GhGuASnnFQuClfQcJHArfZ6tWOKR3u8PEuGZK2NKC+a068CpR PcII1tPovf0cQR9NbuUwJ8b/GBpFmG9j0yZJN4qdmtjGj92xAi/c40yvKgYVb656IAT6 k7oB+UQX9az0zAN/Dnt+2UcZP3kBzAq61hv8jyutcXYp0nG8oplyPp6VZtF55HF04KOJ CBk13mnMAo6a+n6j05X5pv00oYtyj536jFYbmNyDANxW/oXeQMErjx4CRPXNjhfnatgo NJJQ== X-Forwarded-Encrypted: i=1; AJvYcCV57SjY08KKbo0mChmAD8P1SkdVgQ6FwK7AomgmwjLVgzRWsnx2v/uB7eamHvRgR4nYJp+NtNEr7t/kCjQ=@vger.kernel.org X-Gm-Message-State: AOJu0Yz4u8BpLpSSlMwVe7JWmvU0UXPcHT9HQgJeD2EvZcS/alfIk7Lb vH/kTHT+2w+yxifFdveGB/1PR2pOvrHgVgo5jE+pt/T8ngg5qdhGKGFgJhpi6Re5/X8= X-Gm-Gg: ASbGncvJH+AHytundK0NROoMaE8Iu+4Uho7wO6stllxcfpklwoSbu/3ct7/aLmls5z4 3uE06TI6Ue5jTJPTLS7yxkFuGJxMP+OVU6rxyAsS7FTfjQlYefHIeuwmbC8oGqtaNJdC7o4Twv7 o+W2e+SH8Q+/29zrsibqrFAOm4T6EsV0h1qachRcvfT5kD2is/naYSVFArUIRTOfMR1EV3HoRJA l0ME0FyAn1T6zQ3mSSQOZG6+DM+VnNVauWoSVP2FyrEg0VHCEJxcgKF7Ay+6QTNvE8SWoSpIZiE dmQBD7g8bs0aKCw82VTev1g6/TMlwz4OSUBm/4yO0XoARYDNkOPBpRnoKEmnuc6EZ/RxXO2wXo0 sp3sSuWqXsXFg68RA2YzynaA+8pz4M6aAOkmpXuIRuSX2rJPxCdwyl+Bzs+oLg3Ja0adISpYmoH v/i/G8hRGR4EP/GxmKNd4= X-Google-Smtp-Source: AGHT+IHSn97ivXqqEi+3+TEBhok4L0zKY5jBJq8AwBEmyjMgjDaigOLXet9t8Pqm4XTXHvlHGh5HZw== X-Received: by 2002:a05:6000:2891:b0:42b:39d0:638d with SMTP id ffacd0b85a97d-42cb1f9e35bmr3506384f8f.28.1763567146421; Wed, 19 Nov 2025 07:45:46 -0800 (PST) Received: from eugen-station.. ([82.76.24.202]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-42b53dea1c9sm38765632f8f.0.2025.11.19.07.45.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Nov 2025 07:45:46 -0800 (PST) From: Eugen Hristev To: linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, tglx@linutronix.de, andersson@kernel.org, pmladek@suse.com, rdunlap@infradead.org, corbet@lwn.net, david@redhat.com, mhocko@suse.com Cc: tudor.ambarus@linaro.org, mukesh.ojha@oss.qualcomm.com, linux-arm-kernel@lists.infradead.org, linux-hardening@vger.kernel.org, jonechou@google.com, rostedt@goodmis.org, linux-doc@vger.kernel.org, devicetree@vger.kernel.org, linux-remoteproc@vger.kernel.org, linux-arch@vger.kernel.org, tony.luck@intel.com, kees@kernel.org, Eugen Hristev Subject: [PATCH 17/26] sched/core: Annotate runqueues into meminspect Date: Wed, 19 Nov 2025 17:44:18 +0200 Message-ID: <20251119154427.1033475-18-eugen.hristev@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251119154427.1033475-1-eugen.hristev@linaro.org> References: <20251119154427.1033475-1-eugen.hristev@linaro.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Annotate runqueues into meminspect. Even if these are static, they are defined percpu, and a later init call will instantiate them for each cpu. Hence, we cannot annotate them in the usual way, but rather have to call meminspect API at init time. Signed-off-by: Eugen Hristev --- kernel/sched/core.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/kernel/sched/core.c b/kernel/sched/core.c index f1ebf67b48e2..a68367daddb4 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -69,6 +69,7 @@ #include #include #include +#include =20 #ifdef CONFIG_PREEMPT_DYNAMIC # ifdef CONFIG_GENERIC_IRQ_ENTRY @@ -8792,6 +8793,7 @@ void __init sched_init(void) rq->core_cookie =3D 0UL; #endif zalloc_cpumask_var_node(&rq->scratch_mask, GFP_KERNEL, cpu_to_node(i)); + meminspect_lock_register_va(rq, sizeof(*rq)); } =20 set_load_weight(&init_task, false); --=20 2.43.0 From nobody Tue Dec 2 02:19:51 2025 Received: from mail-wr1-f54.google.com (mail-wr1-f54.google.com [209.85.221.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EFE8E393DC0 for ; Wed, 19 Nov 2025 15:45:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763567155; cv=none; b=T/ehr72QiLamBJzPofGk5h/cWr6z7V9ZkMHcHhjnaTJh5Ileap6M4yIDm7sz2BG5a5AvRwH7ecO3rdOBBdINPm74f2BqvLTipgfRVCt2gn0gq4o9SAJcJwOo6m0PSBR6aek0KqmUqgC6vOH3W2e/q0mcgymk5gxxCP/CJsc6I2c= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763567155; c=relaxed/simple; bh=P2BpXmRz69DL/Mo9gvHTNRnm0uC420IorTT0EImakDQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=S18k6XNgYM1aSnlFz7cpRPMgJavlczHqbxDe8kkrioRK8j7+P+hWzkm5U3U1VaZLw0bEy9Yv5walo2450XcbxUSxZlluNn8eikTQlWUJCM5oRtzg1cXtmS9vAlyol95PSxwteB6AzDj+dP8bdHB7WPjdDQAMBCRUjZaMpsNUk+U= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=gvo8Ljd/; arc=none smtp.client-ip=209.85.221.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="gvo8Ljd/" Received: by mail-wr1-f54.google.com with SMTP id ffacd0b85a97d-42b32a3e78bso5589477f8f.0 for ; Wed, 19 Nov 2025 07:45:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1763567148; x=1764171948; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=l/EyDboeiBDU/UfklOwVUegNW3M8PrbX9Ov8/f+MrlA=; b=gvo8Ljd//s70Ad6SW76idmhN0fRup0Xow21Ym1r2UBYinVsb5JC3n8VBpMue/pLWkU htLFLuUG9II22JuzokqrUBl0FIowDCJB+lvn2qVtL1YvmFo7+wDaTYDGikVNNEn1YcH8 Iuhzb3XiCrFIuROQ3mOZhNdTianSbsO+8pjZSfDIvE4fFYqNI8gtbghZ+usPXOFIq8iq i7U4tprdGjDoAg5SYQnep+sFOZ250TUOuoTa24+ZPpIoZVtyds47wZSiGn/keBZApxa7 Pam02IHJfIOB0F9q/5d2km4Th7hREloIwrLIh/HTlXC2IOIcZEQ7v0o90NFN6ydDKPp6 rVHw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763567148; x=1764171948; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=l/EyDboeiBDU/UfklOwVUegNW3M8PrbX9Ov8/f+MrlA=; b=xEn2+KTJt+n5TS/dN9yMGMhVU631R50G0hAMLzYDWwEp/jhZdL/EFYv9rjYH2vsUzV oDMiFZZaE//t7RMz5vVN/dbHOD4G5E3VMe5+kPiVSXfplWpasAKBFXKWr+RLGZSSzJ/9 EGVU34Tyo0Jff1x4ElKaHBm095/i9t5AKOIT3U0GGuIKEUBygy2ii57/tdm4FrGP7vIz u+2q63DwNvF5oFSxetL1b/nLicq4/s8nlkosx/GGGVCV8a/UGGgk/9J1QuJPdKARB/zG x4S5Csmz2tYTu00ZFrylYpUcjUIG76Y8pKPYNDpJqBEP+9OT5tPFZDCeAjt3KuH6zVeW X6dg== X-Forwarded-Encrypted: i=1; AJvYcCVrVE54p7nSlTXNE7SSLdCRAZOCib4WWnfENCaminjxUG3xsXttSsoHAUpSY281jq61POa82KMsZ/TwqmI=@vger.kernel.org X-Gm-Message-State: AOJu0YwFuN9rHeLFrP+68r5gkli+U5JM6cjSiWcyDk/MJkyAQqNF6Tv+ e/FGLFzuw5uQhncUtutm7Fu2y/6gfkFxSPP/LxSgb8CBd4r9uP2tJK7lmWCKmzGp3oM= X-Gm-Gg: ASbGncvw6TALqPskxLWWW4++iAMVtK/77VuDCRdb+j39wRyCnx4l8C/L1bZFZBVmDgM N1/bU5d0BLvOB4qKD0U5MVwyyQqjHx9e2rS35mWCseuhXBkhrB6CbZM7wd/8BCdYczf7LDEDv8v KRNCIyAUxOoc4sRwPs8BGjICEtTiiM3/mxNhdQFP7ZT4+r8BROJMpdWzHhp43eNyf2DalpqWbQj BOSEcTh5uDFCDVmIsntVmpuVcShdiUGdzUTsf8vc36ETacN3lzLaEO5mNb7EycLyTW8sSl1jrOy PswZPuonPB7h/3DjhTtOJF9m2Q1qpNkbld8jsJ55G27D34On4ex16JNFLFI30C7ekd6bB0A1vIJ L47LTHjW60CzRAbTPXwUwg0HBRQvsq6VEBqltW/xBNZbSKu4mvoGL+m0YApBXb3i06ii35TjK3/ WBHxN/fDrI2Vz0plaBDHA= X-Google-Smtp-Source: AGHT+IG3jCLeDmXIRQk0s6Z/im1uj+pkHlGcqCZtyflKDhFiJA87zd6Y92IL7f4uFHeiMPUMai5jbg== X-Received: by 2002:a05:6000:64a:b0:42b:396e:2817 with SMTP id ffacd0b85a97d-42b59378468mr19534486f8f.40.1763567148170; Wed, 19 Nov 2025 07:45:48 -0800 (PST) Received: from eugen-station.. ([82.76.24.202]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-42b53dea1c9sm38765632f8f.0.2025.11.19.07.45.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Nov 2025 07:45:47 -0800 (PST) From: Eugen Hristev To: linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, tglx@linutronix.de, andersson@kernel.org, pmladek@suse.com, rdunlap@infradead.org, corbet@lwn.net, david@redhat.com, mhocko@suse.com Cc: tudor.ambarus@linaro.org, mukesh.ojha@oss.qualcomm.com, linux-arm-kernel@lists.infradead.org, linux-hardening@vger.kernel.org, jonechou@google.com, rostedt@goodmis.org, linux-doc@vger.kernel.org, devicetree@vger.kernel.org, linux-remoteproc@vger.kernel.org, linux-arch@vger.kernel.org, tony.luck@intel.com, kees@kernel.org, Eugen Hristev Subject: [PATCH 18/26] mm/memblock: Add MEMBLOCK_INSPECT flag Date: Wed, 19 Nov 2025 17:44:19 +0200 Message-ID: <20251119154427.1033475-19-eugen.hristev@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251119154427.1033475-1-eugen.hristev@linaro.org> References: <20251119154427.1033475-1-eugen.hristev@linaro.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" This memblock flag indicates that a specific block is registered into an inspection table. The block can be marked for inspection using memblock_mark_inspect() and cleared with memblock_clear_inspect() Signed-off-by: Eugen Hristev --- include/linux/memblock.h | 7 +++++++ mm/memblock.c | 36 ++++++++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+) diff --git a/include/linux/memblock.h b/include/linux/memblock.h index 221118b5a16e..c3e55a4475cf 100644 --- a/include/linux/memblock.h +++ b/include/linux/memblock.h @@ -51,6 +51,10 @@ extern unsigned long long max_possible_pfn; * memory reservations yet, so we get scratch memory from the previous * kernel that we know is good to use. It is the only memory that * allocations may happen from in this phase. + * @MEMBLOCK_INSPECT: memory region is annotated in kernel memory inspecti= on + * table. This means a dedicated entry will be created for this region whi= ch + * will contain the memory's address and size. This allows kernel inspecto= rs + * to retrieve the memory. */ enum memblock_flags { MEMBLOCK_NONE =3D 0x0, /* No special request */ @@ -61,6 +65,7 @@ enum memblock_flags { MEMBLOCK_RSRV_NOINIT =3D 0x10, /* don't initialize struct pages */ MEMBLOCK_RSRV_KERN =3D 0x20, /* memory reserved for kernel use */ MEMBLOCK_KHO_SCRATCH =3D 0x40, /* scratch memory for kexec handover */ + MEMBLOCK_INSPECT =3D 0x80, /* memory selected for kernel inspection */ }; =20 /** @@ -149,6 +154,8 @@ unsigned long memblock_addrs_overlap(phys_addr_t base1,= phys_addr_t size1, bool memblock_overlaps_region(struct memblock_type *type, phys_addr_t base, phys_addr_t size); bool memblock_validate_numa_coverage(unsigned long threshold_bytes); +int memblock_mark_inspect(phys_addr_t base, phys_addr_t size); +int memblock_clear_inspect(phys_addr_t base, phys_addr_t size); int memblock_mark_hotplug(phys_addr_t base, phys_addr_t size); int memblock_clear_hotplug(phys_addr_t base, phys_addr_t size); int memblock_mark_mirror(phys_addr_t base, phys_addr_t size); diff --git a/mm/memblock.c b/mm/memblock.c index e23e16618e9b..a5df5ab286e5 100644 --- a/mm/memblock.c +++ b/mm/memblock.c @@ -17,6 +17,7 @@ #include #include #include +#include =20 #ifdef CONFIG_KEXEC_HANDOVER #include @@ -1016,6 +1017,40 @@ static int __init_memblock memblock_setclr_flag(stru= ct memblock_type *type, return 0; } =20 +/** + * memblock_mark_inspect - Mark inspectable memory with flag MEMBLOCK_INSP= ECT. + * @base: the base phys addr of the region + * @size: the size of the region + * + * Return: 0 on success, -errno on failure. + */ +int __init_memblock memblock_mark_inspect(phys_addr_t base, phys_addr_t si= ze) +{ + int ret; + + ret =3D memblock_setclr_flag(&memblock.memory, base, size, 1, MEMBLOCK_IN= SPECT); + if (ret) + return ret; + + meminspect_lock_register_pa(base, size); + + return 0; +} + +/** + * memblock_clear_inspect - Clear flag MEMBLOCK_INSPECT for a specified re= gion. + * @base: the base phys addr of the region + * @size: the size of the region + * + * Return: 0 on success, -errno on failure. + */ +int __init_memblock memblock_clear_inspect(phys_addr_t base, phys_addr_t s= ize) +{ + meminspect_lock_unregister_pa(base, size); + + return memblock_setclr_flag(&memblock.memory, base, size, 0, MEMBLOCK_INS= PECT); +} + /** * memblock_mark_hotplug - Mark hotpluggable memory with flag MEMBLOCK_HOT= PLUG. * @base: the base phys addr of the region @@ -2704,6 +2739,7 @@ static const char * const flagname[] =3D { [ilog2(MEMBLOCK_RSRV_NOINIT)] =3D "RSV_NIT", [ilog2(MEMBLOCK_RSRV_KERN)] =3D "RSV_KERN", [ilog2(MEMBLOCK_KHO_SCRATCH)] =3D "KHO_SCRATCH", + [ilog2(MEMBLOCK_INSPECT)] =3D "INSPECT", }; =20 static int memblock_debug_show(struct seq_file *m, void *private) --=20 2.43.0 From nobody Tue Dec 2 02:19:51 2025 Received: from mail-wm1-f53.google.com (mail-wm1-f53.google.com [209.85.128.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A276C393DCE for ; Wed, 19 Nov 2025 15:45:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.53 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763567158; cv=none; b=MkjmJjZjxHbg2yHvyj9lMM+ryyVkbuo8WAa4Z/MIHstU9IUHKyiOyrAI7nUioJWi5C1uSK0wCWUap/IX2VhXvSXHwnZGW/zTkvJdl5CABxmTG6w/mOdkJZ3TZ9sUFDhzeWuyHG84fL/V713xCq8XkMDUG5h2zUPcCg0MGWSjyts= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763567158; c=relaxed/simple; bh=f3/jMwmnVv3mI87uodqbEJ5zmLRyilWaBRh2oB7xeIA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=H6mdolap57BhHVma92CdbqTG0d1q0ZpHs8HtCDng9Z6MOyKNIk6sxzXEPiWlJk5j5aRaOVM5BSM9vkbKo30TbkSUfEQ4ishmMeXoVn9ayNnSaFUD9iC9VWYq6zNFPA9HUhSLKCca3FUyZQ6TPNBv4VO3SWbU8bLtoylUiIZO+i0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=XXrmnSHa; arc=none smtp.client-ip=209.85.128.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="XXrmnSHa" Received: by mail-wm1-f53.google.com with SMTP id 5b1f17b1804b1-477549b3082so56842895e9.0 for ; Wed, 19 Nov 2025 07:45:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1763567150; x=1764171950; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=TG3MkEScUQgKy+QWFE7rEK/ceT0KdBZscolLPvZ1jcY=; b=XXrmnSHaTf1vf6uqqllPUT0sMUElMq1GY66Her4KbnbRi5e+DUU+M+SWXGUt2CZ6yi Fcfg1D6NcZVjy26O1mHYrbiVIPaAlLBA2GBqvpgLMBXyymHP7sB69YUN84ZdMxEQx29S DToilDeS7YIqZBRpQLn/r+GmhRa5gNuXE+wcynhuswMQIYn0NsTWAoMVNaNDtskjuf6d eua2UlS0Q7BEVBAS9dnTmdA56yZpIwU8XFShysHoYhbEidZl0ofZ+gQZPlTrTx3l7IgY d2eNag3MWaOS0TVX4RMZONoYBqxONt/LCOMwvGtHCkIwtA0Jveoa88lEMBckYQCQjlIx QEGQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763567150; x=1764171950; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=TG3MkEScUQgKy+QWFE7rEK/ceT0KdBZscolLPvZ1jcY=; b=bNBZ/ZrADYdo30SeqaAVrjf8SmaC1mgs0K7CE2bVvFYxzY/GmcEzcVmAXJYQt2txBE hwCmoFO2ER8P8h4oWGbMsVj6/t4x10+AshP2tUSh7/zFyQMw4KAbNNKQXaflNYJnoCxw SRV/CJJoI896hnlfDvf6pYAE0oPgYiTExE39rADhE6eBJoP+sBUKnpQaQhziz1glBXuJ zIkCbhv+gUCFJT67tAR+ARVaaBykbt9P5tEmFo8MoPLyCHS1yhgWRn6xgK3L524PiDBS 6Fjh3uvr1Z7fgAM12bBdZmcR+eVHNqTftVjUdZ2mQ4riNLjGRKCx2hdnQgQ9bNsRttMt Nxpg== X-Forwarded-Encrypted: i=1; AJvYcCW4xwS6dDWN29UMdJjOq+FW3i2d7nB/35VbSAAWNIabxfaOk/J71HAolWTlcpK9m7zemkEtvlis6c3+QQI=@vger.kernel.org X-Gm-Message-State: AOJu0YyQbqEWg3umkft1K6DuPMYUW64DTauxATTS50uc9HynxgpRVGj3 a6Zp3zSl7Xezrm1rKysCh5vcXNka87ly2yWpgqBTemb94bMBMFqpxUkTRK0YdM38TVs= X-Gm-Gg: ASbGncuuw61SgEQXrnesCr2EhO3ZWphtHkbnrBOrgw1xdY9tXfCf/PtR259HU4UuxfP pZx5dx7xFPzEkuUWQDIBfDPqqXxUPxYdWJ1IneUa7n5M9Uq3gGL62yRhDDCBb6/+tb+VyrjEvzD z/biqRS33mhwNfobB5avji9w2XXLEvSWejzR+dWnH1X8sKP4qsg5EceprmQnBWq4gTdrzaOnBOC jNJrVqKi0Zs3joFL+euQQ1A7ud19LDXRz15iEvi/c6dctkC3PVhWO3SaAg00rSHQq7RP1hfOZt3 SE6leOB7nsi/R8pD3FIj2Jds5tvDesO9YXy/gjhyIUFPBlb2eIQe6IHyVgPkE0h6bRNScCPHuhJ BQRghJLqaQvpF5RTrV6J3js7YDrDR/yLguh3SdGbs8hKJ6FyEs0cgNVQQ9ErT1jxhd6MGZ9Fwhs l/kFo5VmeUqxLvIyVDxe6NwEq2atupHQ== X-Google-Smtp-Source: AGHT+IHArpVzpD3LO0mA1+dNKflLF3LKgYCdBzRW5r7OQjPk30YRri90746lAxdaW694nNfBsFGkIg== X-Received: by 2002:a05:600c:a05:b0:475:dc5c:3a89 with SMTP id 5b1f17b1804b1-4778fea881fmr202472465e9.34.1763567149948; Wed, 19 Nov 2025 07:45:49 -0800 (PST) Received: from eugen-station.. ([82.76.24.202]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-42b53dea1c9sm38765632f8f.0.2025.11.19.07.45.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Nov 2025 07:45:49 -0800 (PST) From: Eugen Hristev To: linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, tglx@linutronix.de, andersson@kernel.org, pmladek@suse.com, rdunlap@infradead.org, corbet@lwn.net, david@redhat.com, mhocko@suse.com Cc: tudor.ambarus@linaro.org, mukesh.ojha@oss.qualcomm.com, linux-arm-kernel@lists.infradead.org, linux-hardening@vger.kernel.org, jonechou@google.com, rostedt@goodmis.org, linux-doc@vger.kernel.org, devicetree@vger.kernel.org, linux-remoteproc@vger.kernel.org, linux-arch@vger.kernel.org, tony.luck@intel.com, kees@kernel.org, Eugen Hristev Subject: [PATCH 19/26] mm/numa: Register information into meminspect Date: Wed, 19 Nov 2025 17:44:20 +0200 Message-ID: <20251119154427.1033475-20-eugen.hristev@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251119154427.1033475-1-eugen.hristev@linaro.org> References: <20251119154427.1033475-1-eugen.hristev@linaro.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Register dynamic information into meminspect: - dynamic node data for each node This information is being allocated for each node, as physical address, so call memblock_mark_inspect that will mark the block accordingly. Signed-off-by: Eugen Hristev --- mm/numa.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mm/numa.c b/mm/numa.c index 7d5e06fe5bd4..379065dd633e 100644 --- a/mm/numa.c +++ b/mm/numa.c @@ -4,6 +4,7 @@ #include #include #include +#include =20 struct pglist_data *node_data[MAX_NUMNODES]; EXPORT_SYMBOL(node_data); @@ -20,6 +21,7 @@ void __init alloc_node_data(int nid) if (!nd_pa) panic("Cannot allocate %zu bytes for node %d data\n", nd_size, nid); + memblock_mark_inspect(nd_pa, nd_size); =20 /* report and initialize */ pr_info("NODE_DATA(%d) allocated [mem %#010Lx-%#010Lx]\n", nid, --=20 2.43.0 From nobody Tue Dec 2 02:19:51 2025 Received: from mail-wr1-f48.google.com (mail-wr1-f48.google.com [209.85.221.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5384436CE02 for ; Wed, 19 Nov 2025 15:45:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.48 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763567159; cv=none; b=UDaZaRzDo4v7soVA2R+R1yKsKkbpYD7xj8xP3Ao7Cqxmo6Q4rzihiJNgEKbYPxjp2ASAEy6WezMV1AWQpCQUJbgwl4i2s63ruF9W87NgWo6Ah7/YwMSU+e1BMD7a7C2+vPmEHtIeQKWDn2IRgRV9rOFnm+4QTrYVpg0ty/ZhQWg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763567159; c=relaxed/simple; bh=UTLUC0zYLNIpIU6hlTY4UtGB00tOu5axyPBTWNkQRLE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=POrqjO7iiCijdHIP2CoeUB0fuQ5sAWxkFel7Iro4csrPCvt6oneIYHqkbnoSrKCm4lapaGTPaIkgadWe/8RO4j1dTUDUg7eNJjZYrH6CGHJRNj5uiuckxHTKQ8hSbZqfRjZmHO3ecITGBsPNgCvudSijQ1mxjf2V7mSJ5fuFLz0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=topb2Bvh; arc=none smtp.client-ip=209.85.221.48 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="topb2Bvh" Received: by mail-wr1-f48.google.com with SMTP id ffacd0b85a97d-42b31c610fcso5924807f8f.0 for ; Wed, 19 Nov 2025 07:45:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1763567152; x=1764171952; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=uk1lFWru0IGdhKwRKbnhtV9p6FImm0O6RRZYNI9uc9w=; b=topb2Bvhry0CkWkwgvz5KAsjSApRvdGEL1pk4gMYp+l4C8pvgogsHSnOylyQYtNqmK xj7iQtzRUmAd9OItTRZYSMc/IzfCoVaVreqgx/0YEF3wJeXogmRbE18mBN+eLD00CRbY iQ7DeBReF3MEWzqmOejNVnppa85e7BV6FTKJYdyxTgm96vEEgfbr1/sNC+CpwzR4u3Br fChbO4MWB2+bwmXjYximwr6WjjZcWE4JLslUhK2xGsDrBD7MCbXDaWd71K9ivllolQQp zIEgSm+Da5qdhnUixIs7MzqvUebI3nSqy6Lw2+6JzsNBgyLN8jGP+XjoNUVRUMGhXAlZ mtKg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763567152; x=1764171952; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=uk1lFWru0IGdhKwRKbnhtV9p6FImm0O6RRZYNI9uc9w=; b=WlyQaalXPWNVk6UEIY6TqZU8pwSv14lNKvwu4JKHDPLhPaKtF9WRaltvfukOOlsuB2 aGjdT/on+PE+UYM1GkY1KQjAooiYeUvdkIoWpt7Gna+7gvQVoiWaiYlGEJAexHlc/njT 65EtnyA6hiY84xCG5M2CISRFm7bnhYbBV18kkb+1NazdunUqM905zGhoK3Ga8ie7xyor t1SlWPRaqWQvuUwGHJ5RfpGUlhB9M+MEIyKR7FTjUPaQzl9O3ghMu7971PaCRFMrGsA4 Oc4nOE7440bQStY7oSAKml+4lDodQmrNphMvXDDAMYAzVONWEZE9iiajhvLbStjpVslC 9UnQ== X-Forwarded-Encrypted: i=1; AJvYcCU7gA47SKqfUAQsUCwAh86vTABROkux5B0RvRproCINTA8jpw/5orwShXg0umMIa9kIerJ/N/WhyZrrCI8=@vger.kernel.org X-Gm-Message-State: AOJu0YztFcDOC936flLAjHj/4zMXRW9HXiiG6zK4xjqlC6dQg80ZHUa3 oHU2Pn/jVbjI2Ho/wKzZ6aNCovlo5N7duSMUuCmL4mpHdJY5iBLRUR2KoiUKhHTqk7c= X-Gm-Gg: ASbGncu+6DsgqaUmpi/1aQSaLCrz5Xxlk3W+Xz5iDgYLbtAe4zPxgEhlaa3T70rW1/j lNgPNMfyBNnI7M6EZHOSFqXvH/HnfZY9Cak3mnHUDoODSsyB7zGuB/6RRQbw3q8qBwVLKedrNgB gvMbA9DkcvypvMGSB70B01bqmjYOYgKCArc7dAtHo5uNZzURM7QqCUiQa/piG6fk7rPxPtZn2OQ Z5+z6A/LCBiTBGSTU8rr7Z9JaiyggC7a1Wb+mACFwCTOxz6c8PHxfKiKhifBtRHcojgMkvtOyQJ XhUO9to3MLLDuy2WLbIJGP3X7pzsEDrY7Utol/xB0u39921sD854HdJOxvxxQCpleq1XhkyW+cB /au6pFGlDsFt79A3+T6SB0MVZ9ko4/4HBo7BJIVh2zq44v8PvlCVljsEHJYOPYwVQ+IagFN9Q2p id9q6GuZVCvMoM5asWdKnWuaMZjOkSww== X-Google-Smtp-Source: AGHT+IGiIxmeqrKKXMpyNCEgyddWcck0X4KYjA7E97PFt6A4ulW3WkSU04Vt6omGLvNuAQXzgiycDA== X-Received: by 2002:a05:6000:2888:b0:42b:3ab7:b8b9 with SMTP id ffacd0b85a97d-42b5934db2cmr19180692f8f.20.1763567151698; Wed, 19 Nov 2025 07:45:51 -0800 (PST) Received: from eugen-station.. ([82.76.24.202]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-42b53dea1c9sm38765632f8f.0.2025.11.19.07.45.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Nov 2025 07:45:51 -0800 (PST) From: Eugen Hristev To: linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, tglx@linutronix.de, andersson@kernel.org, pmladek@suse.com, rdunlap@infradead.org, corbet@lwn.net, david@redhat.com, mhocko@suse.com Cc: tudor.ambarus@linaro.org, mukesh.ojha@oss.qualcomm.com, linux-arm-kernel@lists.infradead.org, linux-hardening@vger.kernel.org, jonechou@google.com, rostedt@goodmis.org, linux-doc@vger.kernel.org, devicetree@vger.kernel.org, linux-remoteproc@vger.kernel.org, linux-arch@vger.kernel.org, tony.luck@intel.com, kees@kernel.org, Eugen Hristev Subject: [PATCH 20/26] mm/sparse: Register information into meminspect Date: Wed, 19 Nov 2025 17:44:21 +0200 Message-ID: <20251119154427.1033475-21-eugen.hristev@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251119154427.1033475-1-eugen.hristev@linaro.org> References: <20251119154427.1033475-1-eugen.hristev@linaro.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Annotate vital static information into meminspect: - mem_section Information on these variables is stored into inspection table. Register dynamic information into meminspect: - section - mem_section_usage This information is being allocated for each node, so call memblock_mark_inspect to mark the block accordingly. Signed-off-by: Eugen Hristev --- mm/sparse.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/mm/sparse.c b/mm/sparse.c index 17c50a6415c2..80530e39c8b2 100644 --- a/mm/sparse.c +++ b/mm/sparse.c @@ -15,6 +15,7 @@ #include #include #include +#include #include "internal.h" #include =20 @@ -30,6 +31,7 @@ struct mem_section mem_section[NR_SECTION_ROOTS][SECTIONS= _PER_ROOT] ____cacheline_internodealigned_in_smp; #endif EXPORT_SYMBOL(mem_section); +MEMINSPECT_SIMPLE_ENTRY(mem_section); =20 #ifdef NODE_NOT_IN_PAGE_FLAGS /* @@ -253,6 +255,7 @@ static void __init memblocks_present(void) size =3D sizeof(struct mem_section *) * NR_SECTION_ROOTS; align =3D 1 << (INTERNODE_CACHE_SHIFT); mem_section =3D memblock_alloc_or_panic(size, align); + memblock_mark_inspect(virt_to_phys(mem_section), size); } #endif =20 @@ -343,6 +346,7 @@ sparse_early_usemaps_alloc_pgdat_section(struct pglist_= data *pgdat, limit =3D MEMBLOCK_ALLOC_ACCESSIBLE; goto again; } + memblock_mark_inspect(virt_to_phys(usage), size); return usage; } =20 --=20 2.43.0 From nobody Tue Dec 2 02:19:51 2025 Received: from mail-wr1-f47.google.com (mail-wr1-f47.google.com [209.85.221.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 05380302CB5 for ; Wed, 19 Nov 2025 15:45:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.47 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763567163; cv=none; b=ZND3QJ1WHzsxCFp4pJzs7N2tjnBjUSpBbRBHawt5jOJs9tNY2a0fXYiJUCBCwd+Lq4lUg9vKHYja9o3UnWIfWlLje6ajGk3VF8BJmyCydCDOBckNaiAL9w+P/akiqILMSO4mq4yZSevLPLbCA7qk03ZFqwbyOqD7Y98EHiVyUxU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763567163; c=relaxed/simple; bh=seLIx9q9vL0GJtrOwhh44Y8oeZ01I2U3Qbuzz6J6f2s=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=QVVTkZRv+g9oUDgFzCK8859gO9kuu3a3FqVp2ygHugMGxHZ0OimmrL2d0nKi6ofjeKQPaYzOT3SEFdi2oH16e8bWYojGl37U4VulHiguv021xr1MTXEuXgdUVRwk+1uzsIJTMsl/BX8pYnM2LbbfPaPWz41BDL854aY+x2vLQ1E= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=OlsKOf7C; arc=none smtp.client-ip=209.85.221.47 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="OlsKOf7C" Received: by mail-wr1-f47.google.com with SMTP id ffacd0b85a97d-42b32a5494dso4139081f8f.2 for ; Wed, 19 Nov 2025 07:45:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1763567153; x=1764171953; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Y7Ucs3kp0oXjJAHNPlew8LSoAGCaHnYy/9pb2BVOQfw=; b=OlsKOf7CJM2UCkg8sSzf3D6dnC50mCYotNLiG83mI1qis2cSNEl6iYyMVoNUiPWFtn q+XeohqZ2L4g2rfVHlxX/Z74xnezMqq6Q2RDI7kKiJAAVdhgk1bmjDpTEad7w+oD+d5r XhwrehKHLA8zA/6PTLm1D8myUX20MDo61BthVNchOC3ajJi+FtetAbFElpDNH0txiQfl YkpKzG5UU3whCwYwxvP6bNGvK5NjG96/oE4wLDMc20Z9xA4rAsIdLgPvh/YVk9Ey+l4D ICFEIP6vLzLnMBBLHX1AFbnh29b1KM9hSgdIu/yPFwLWWVFyENhMFbVyN3hTLNk7gE9T 2itQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763567153; x=1764171953; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=Y7Ucs3kp0oXjJAHNPlew8LSoAGCaHnYy/9pb2BVOQfw=; b=GjHHdscFrfr4KFeT2wEks3KmBSqHyy3sUNxmkStNOkDk6rAek3/mTSVkE4b2A+78Mt asjnvk86WCzgpm3PkvNYfuQySqEuoEvscJpqOfKR0ZjKgoeqQ6rnYYoKzVLSMmyrNQqF h9kF6qgwUqVrZ4z7InpyQqlzoN09ln2i+QtHGdMXlKvcB4a2GAuY5anVSOCBwNpD9yMC AB2LGo/NvgTtyd2Zf7mHxY23eaefcXXflU9sG93zznrFJFn2RiACJUwZrdkn+iEZ2sEN ANxkG5f6R6E2JkrfCueP1xMZ5u+jSQCUwvUaymZBkjrLD8PvSxlW0MtooSixEBRcxNFq c53A== X-Forwarded-Encrypted: i=1; AJvYcCVk3GoIMflRtf0XYEy8LQkWKsB31QFiE7dkEyrBz3N9ylH5+444HFL113JIK+WW3TBM7goDWHGEms8xrTY=@vger.kernel.org X-Gm-Message-State: AOJu0Yx4RVCVHFvhfIUCzn7y9msnO8Ul9JwXZNpYX6k/AGCNY6If44yf SRPXv9qOmdykhpfi3W+CNgxauXpg15C7iKdxJ3fWarcS4jJ7nLnj1RVHOGK6M9Q6hnw= X-Gm-Gg: ASbGncvUIEQWeMfSG4LBfYFt9ecVmBgnWm9r33qXENbwXQ13M+YZg24LTnG6YipkuBG F6jJTamv3vR/0AaV4VWvK2wu3s5t/AypS+73VKj5ced9SNqqSF2LfyTjIwvgU7bjKtynPlQQfCz D+E/tnabb58lrRzf7Clzjhi6rbbe4mrS39hkP8ISmMYMFGPCIDep+kqUu1iZf0B2jJpid7C98NT a4zbYRtggCAva8CGUU4hO3IQ3y0bcTx5gwJfjWLbiVF+OWZPCSUGmWYUAMLGAMlEk0+IDnoZXkZ 8n1drN/9Uk5VbNUgzMDq1C7qaeSNZ7Z9Uh5ftkEme64Lt8J4kGmKQPA89FSoIXNbrO7Q/8ZHU1r fX9NKizRnveyzhLRj9xmxKfaET7jLaeQCfihrfsBqC6tU2MnjpRZZ8vQh6ecTazlgtHj+AckEOa BfB2F9kKxRJb2Me9daezekaWL/BzQM0Q== X-Google-Smtp-Source: AGHT+IFMxVwxw3DtlUhFwveVzixkh9p9iHWd+faYE31GhqiINsGSMiGzAK7z2FWSCj0eS8F6/aaKoQ== X-Received: by 2002:a05:6000:2510:b0:42b:3e20:f1b4 with SMTP id ffacd0b85a97d-42cb1f1de66mr3206403f8f.5.1763567153508; Wed, 19 Nov 2025 07:45:53 -0800 (PST) Received: from eugen-station.. ([82.76.24.202]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-42b53dea1c9sm38765632f8f.0.2025.11.19.07.45.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Nov 2025 07:45:53 -0800 (PST) From: Eugen Hristev To: linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, tglx@linutronix.de, andersson@kernel.org, pmladek@suse.com, rdunlap@infradead.org, corbet@lwn.net, david@redhat.com, mhocko@suse.com Cc: tudor.ambarus@linaro.org, mukesh.ojha@oss.qualcomm.com, linux-arm-kernel@lists.infradead.org, linux-hardening@vger.kernel.org, jonechou@google.com, rostedt@goodmis.org, linux-doc@vger.kernel.org, devicetree@vger.kernel.org, linux-remoteproc@vger.kernel.org, linux-arch@vger.kernel.org, tony.luck@intel.com, kees@kernel.org, Eugen Hristev Subject: [PATCH 21/26] printk: Register information into meminspect Date: Wed, 19 Nov 2025 17:44:22 +0200 Message-ID: <20251119154427.1033475-22-eugen.hristev@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251119154427.1033475-1-eugen.hristev@linaro.org> References: <20251119154427.1033475-1-eugen.hristev@linaro.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Annotate vital static information into meminspect: - prb_descs - prb_infos - prb - prb_data - printk_rb_static - printk_rb_dynamic Information on these variables is stored into inspection table. Register dynamic information into meminspect: - new_descs - new_infos - new_log_buf This information is being allocated as a memblock, so call memblock_mark_inspect to mark the block accordingly. Signed-off-by: Eugen Hristev --- kernel/printk/printk.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c index 5aee9ffb16b9..8b5aba2527ac 100644 --- a/kernel/printk/printk.c +++ b/kernel/printk/printk.c @@ -49,6 +49,7 @@ #include #include #include +#include =20 #include #include @@ -513,10 +514,16 @@ static u32 log_buf_len =3D __LOG_BUF_LEN; #endif _DEFINE_PRINTKRB(printk_rb_static, CONFIG_LOG_BUF_SHIFT - PRB_AVGBITS, PRB_AVGBITS, &__log_buf[0]); +MEMINSPECT_NAMED_ENTRY(prb_descs, _printk_rb_static_descs); +MEMINSPECT_NAMED_ENTRY(prb_infos, _printk_rb_static_infos); +MEMINSPECT_NAMED_ENTRY(prb_data, __log_buf); +MEMINSPECT_SIMPLE_ENTRY(printk_rb_static); =20 static struct printk_ringbuffer printk_rb_dynamic; +MEMINSPECT_SIMPLE_ENTRY(printk_rb_dynamic); =20 struct printk_ringbuffer *prb =3D &printk_rb_static; +MEMINSPECT_SIMPLE_ENTRY(prb); =20 /* * We cannot access per-CPU data (e.g. per-CPU flush irq_work) before @@ -1190,6 +1197,7 @@ void __init setup_log_buf(int early) new_log_buf_len); goto out; } + memblock_mark_inspect(virt_to_phys(new_log_buf), new_log_buf_len); =20 new_descs_size =3D new_descs_count * sizeof(struct prb_desc); new_descs =3D memblock_alloc(new_descs_size, LOG_ALIGN); @@ -1198,6 +1206,7 @@ void __init setup_log_buf(int early) new_descs_size); goto err_free_log_buf; } + memblock_mark_inspect(virt_to_phys(new_descs), new_descs_size); =20 new_infos_size =3D new_descs_count * sizeof(struct printk_info); new_infos =3D memblock_alloc(new_infos_size, LOG_ALIGN); @@ -1206,6 +1215,7 @@ void __init setup_log_buf(int early) new_infos_size); goto err_free_descs; } + memblock_mark_inspect(virt_to_phys(new_infos), new_infos_size); =20 prb_rec_init_rd(&r, &info, &setup_text_buf[0], sizeof(setup_text_buf)); =20 @@ -1258,8 +1268,10 @@ void __init setup_log_buf(int early) =20 err_free_descs: memblock_free(new_descs, new_descs_size); + memblock_clear_inspect(virt_to_phys(new_descs), new_descs_size); err_free_log_buf: memblock_free(new_log_buf, new_log_buf_len); + memblock_clear_inspect(virt_to_phys(new_log_buf), new_log_buf_len); out: print_log_buf_usage_stats(); } --=20 2.43.0 From nobody Tue Dec 2 02:19:51 2025 Received: from mail-wr1-f53.google.com (mail-wr1-f53.google.com [209.85.221.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 88DF13A1D12 for ; Wed, 19 Nov 2025 15:45:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.53 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763567163; cv=none; b=aH33O9u+b8Xl6hoLfSUVhHm+91z+xKgPELbHpTqSeK4/lwIm4hxFtT3UTM1w8Wect4XhYnPNedzFNn95wFFxeGRN2uO/LYm6kq8tncwufvCnlStDxmQf1MlcbHtQB2oKeZ5EP0liy2gt5kXccbWTtZUe2oIdC/6xyr+LTv6e6r4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763567163; c=relaxed/simple; bh=oMOJLuZhCOnY0w0cY4R3cwCR+B/zhszgawQsUmZz21o=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=s7nn+2WvRUX55pj039M4cueOpWpSgUwTKQOD1aRTMFZbEfDm0XIBvEUf2Ch08S45WAHtxEmSw2Wt9158uSlh9Hbd+olw0WziLlenYt0RzaexjwNyu6vYxXIU7t1sB9Kqsf1bwdX64WYFyX/fYv/uZusT+fqGi6gFXvuiQR8e/a4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=nbcbpaj9; arc=none smtp.client-ip=209.85.221.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="nbcbpaj9" Received: by mail-wr1-f53.google.com with SMTP id ffacd0b85a97d-42bb288c1bfso3069128f8f.2 for ; Wed, 19 Nov 2025 07:45:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1763567155; x=1764171955; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=CEWvhI86IGkr275YCXI4U9akHZM2f251P0zZm4c5HV0=; b=nbcbpaj9MDGTBG2ZCwZwK3LgPpIz0tMB0ap1DqlvjBXvufiLgu5rtDDVtwkPLgNqfI o4NYkoWEt3FLcXmu6dL9PZGRVuqNh3UNpSsGeY8BCZo63wuPKa5E8f4eGYYhnQyQJZam 08AaKGKIGbZeT5a1zhT1ZcZwHo/C4fK+VV8OHvXI8MH3lFWpdLrebSZ2Z58hKizgokp0 Ai5/abu78NWX1TtrOUL2CREoPN1OgJfR/Sa8iKztlpiTwBs531ZQYTlKrnjuH8q8i7WE +47cckejnY2EfW+rEn1EnfXX32XQjCAWv6+sRahgUTSZsPxPqNllZ5eE+T9BA6gFU6Pr zfQQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763567155; x=1764171955; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=CEWvhI86IGkr275YCXI4U9akHZM2f251P0zZm4c5HV0=; b=WNsAxwsEJ0tsmNJAQgIIL3vgYZTJLb3EDu/PLmh+m/YJwQ77VkesQz5wGc2gX6Et/p HeDKffdjQ07sBxKGnkET04MaVdOOBxRH7B8nTKca0hIy/5CDek+pGCVRUpGFoS4yUdTi yVsy6f4IYaiNqmYRls/xEC7NUDOydcMtdTZNZeo4BTrtpW4kYVYBeN8NTiqv48hsx/KM sjJvHgmw8LkPH5PGwUIWZ4bCidSP1S9aMHlVFeM6kbZ17O2rTIzlYjgpOzlkwiZrjfNt If6f+LVWJu4wqMhZrcb62ojjFpiJgqWloiuvhV5DbTj9appc/GiRgYsSXQE/m8KDNB4k rkSg== X-Forwarded-Encrypted: i=1; AJvYcCUKR+kAmBVphXrvfQ7nsjcn24JAWHXowMrobpALyBcZhFL8YIQpWj21pNJsc5JGdAgrtIK/z/OYP1liwQ4=@vger.kernel.org X-Gm-Message-State: AOJu0Yz3QDCJzH52cuUAdR2Qe+WASZWdzIqwujQDiH/PLWdIx1CQEBNS 5Pken22MEZt32slH4It5UaZmjUZqSzVkoHGGFZED9G37KSE+7Nf3jHgoWTHoTploXnM= X-Gm-Gg: ASbGncu91lhlwyVujRTD/0Vr1wrlb9wLWnJ/6W87KCxnWu+6CyaLu1gULKAuq4tLILo Ts/VCImnkaVvybrZ/N5gHynEg9xPaZBja8kqUFb6BLN81hH53rL2UEELxhMxHQQ5APDxSqCMwjh KEmo81CcRRVpm14OtUnd/Vek5UP/lfnCCMqJ2j8XbjDw0irKSguyhGFDKTKVQfBXYuawVbxbdq6 kK9bjBsukkv7KFtjLDU9rUx25fVniS2LBtG1Jn9DQjOdIgTlHhOU5+DQvnowt+gMHvb06wDfIwZ jv2Z1GEfQz3nd0uPSJmSG2qSEz9a6uV4oB6iOy13CPTrl+eKo+uPgboNnMkxB1eAoHDfq82wUII 1D8XTUlBPgVVHr3Ohu6d+/cFQSWVhrKCj+J7u9Svy8FRK5JgVrWvFHvIaKYo4yyFrYCU2vszGFH Ra8R18DRIC/HClr2v1xO734bxst8FIlGyeaLE+ThYL X-Google-Smtp-Source: AGHT+IGkk7cUbQZnXjGag8yPABXUYogSDTvlv9CsdaEjFL1fCOMxhsVRR8P5cnyld7ERa3Ar7rkUkQ== X-Received: by 2002:a05:6000:22c1:b0:42b:3ab7:b8a4 with SMTP id ffacd0b85a97d-42b5938b4b1mr19940877f8f.33.1763567155275; Wed, 19 Nov 2025 07:45:55 -0800 (PST) Received: from eugen-station.. ([82.76.24.202]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-42b53dea1c9sm38765632f8f.0.2025.11.19.07.45.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Nov 2025 07:45:54 -0800 (PST) From: Eugen Hristev To: linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, tglx@linutronix.de, andersson@kernel.org, pmladek@suse.com, rdunlap@infradead.org, corbet@lwn.net, david@redhat.com, mhocko@suse.com Cc: tudor.ambarus@linaro.org, mukesh.ojha@oss.qualcomm.com, linux-arm-kernel@lists.infradead.org, linux-hardening@vger.kernel.org, jonechou@google.com, rostedt@goodmis.org, linux-doc@vger.kernel.org, devicetree@vger.kernel.org, linux-remoteproc@vger.kernel.org, linux-arch@vger.kernel.org, tony.luck@intel.com, kees@kernel.org, Eugen Hristev Subject: [PATCH 22/26] remoteproc: qcom: Extract minidump definitions into a header Date: Wed, 19 Nov 2025 17:44:23 +0200 Message-ID: <20251119154427.1033475-23-eugen.hristev@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251119154427.1033475-1-eugen.hristev@linaro.org> References: <20251119154427.1033475-1-eugen.hristev@linaro.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Extract the minidump definitions into a header such that the definitions can be reused by other drivers. No other change, purely moving the definitions. Signed-off-by: Eugen Hristev --- drivers/remoteproc/qcom_common.c | 56 +------------------------ include/linux/soc/qcom/minidump.h | 68 +++++++++++++++++++++++++++++++ 2 files changed, 69 insertions(+), 55 deletions(-) create mode 100644 include/linux/soc/qcom/minidump.h diff --git a/drivers/remoteproc/qcom_common.c b/drivers/remoteproc/qcom_com= mon.c index 8c8688f99f0a..4f1c8d005c97 100644 --- a/drivers/remoteproc/qcom_common.c +++ b/drivers/remoteproc/qcom_common.c @@ -18,6 +18,7 @@ #include #include #include +#include #include =20 #include "remoteproc_internal.h" @@ -28,61 +29,6 @@ #define to_ssr_subdev(d) container_of(d, struct qcom_rproc_ssr, subdev) #define to_pdm_subdev(d) container_of(d, struct qcom_rproc_pdm, subdev) =20 -#define MAX_NUM_OF_SS 10 -#define MAX_REGION_NAME_LENGTH 16 -#define SBL_MINIDUMP_SMEM_ID 602 -#define MINIDUMP_REGION_VALID ('V' << 24 | 'A' << 16 | 'L' << 8 | 'I' << = 0) -#define MINIDUMP_SS_ENCR_DONE ('D' << 24 | 'O' << 16 | 'N' << 8 | 'E' << = 0) -#define MINIDUMP_SS_ENABLED ('E' << 24 | 'N' << 16 | 'B' << 8 | 'L' << 0) - -/** - * struct minidump_region - Minidump region - * @name : Name of the region to be dumped - * @seq_num: : Use to differentiate regions with same name. - * @valid : This entry to be dumped (if set to 1) - * @address : Physical address of region to be dumped - * @size : Size of the region - */ -struct minidump_region { - char name[MAX_REGION_NAME_LENGTH]; - __le32 seq_num; - __le32 valid; - __le64 address; - __le64 size; -}; - -/** - * struct minidump_subsystem - Subsystem's SMEM Table of content - * @status : Subsystem toc init status - * @enabled : if set to 1, this region would be copied during coredump - * @encryption_status: Encryption status for this subsystem - * @encryption_required : Decides to encrypt the subsystem regions or not - * @region_count : Number of regions added in this subsystem toc - * @regions_baseptr : regions base pointer of the subsystem - */ -struct minidump_subsystem { - __le32 status; - __le32 enabled; - __le32 encryption_status; - __le32 encryption_required; - __le32 region_count; - __le64 regions_baseptr; -}; - -/** - * struct minidump_global_toc - Global Table of Content - * @status : Global Minidump init status - * @md_revision : Minidump revision - * @enabled : Minidump enable status - * @subsystems : Array of subsystems toc - */ -struct minidump_global_toc { - __le32 status; - __le32 md_revision; - __le32 enabled; - struct minidump_subsystem subsystems[MAX_NUM_OF_SS]; -}; - struct qcom_ssr_subsystem { const char *name; struct srcu_notifier_head notifier_list; diff --git a/include/linux/soc/qcom/minidump.h b/include/linux/soc/qcom/min= idump.h new file mode 100644 index 000000000000..25247a6216e2 --- /dev/null +++ b/include/linux/soc/qcom/minidump.h @@ -0,0 +1,68 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Qualcomm Minidump definitions + * + * Copyright (C) 2016 Linaro Ltd + * Copyright (C) 2015 Sony Mobile Communications Inc + * Copyright (c) 2012-2013, The Linux Foundation. All rights reserved. + */ + +#ifndef __QCOM_MINIDUMP_H__ +#define __QCOM_MINIDUMP_H__ + +#define MAX_NUM_OF_SS 10 +#define MAX_REGION_NAME_LENGTH 16 +#define SBL_MINIDUMP_SMEM_ID 602 +#define MINIDUMP_REGION_VALID ('V' << 24 | 'A' << 16 | 'L' << 8 | 'I' << = 0) +#define MINIDUMP_SS_ENCR_DONE ('D' << 24 | 'O' << 16 | 'N' << 8 | 'E' << = 0) +#define MINIDUMP_SS_ENABLED ('E' << 24 | 'N' << 16 | 'B' << 8 | 'L' << 0) + +/** + * struct minidump_region - Minidump region + * @name : Name of the region to be dumped + * @seq_num: : Use to differentiate regions with same name. + * @valid : This entry to be dumped (if set to 1) + * @address : Physical address of region to be dumped + * @size : Size of the region + */ +struct minidump_region { + char name[MAX_REGION_NAME_LENGTH]; + __le32 seq_num; + __le32 valid; + __le64 address; + __le64 size; +}; + +/** + * struct minidump_subsystem - Subsystem's SMEM Table of content + * @status : Subsystem toc init status + * @enabled : if set to 1, this region would be copied during coredump + * @encryption_status: Encryption status for this subsystem + * @encryption_required : Decides to encrypt the subsystem regions or not + * @region_count : Number of regions added in this subsystem toc + * @regions_baseptr : regions base pointer of the subsystem + */ +struct minidump_subsystem { + __le32 status; + __le32 enabled; + __le32 encryption_status; + __le32 encryption_required; + __le32 region_count; + __le64 regions_baseptr; +}; + +/** + * struct minidump_global_toc - Global Table of Content + * @status : Global Minidump init status + * @md_revision : Minidump revision + * @enabled : Minidump enable status + * @subsystems : Array of subsystems toc + */ +struct minidump_global_toc { + __le32 status; + __le32 md_revision; + __le32 enabled; + struct minidump_subsystem subsystems[MAX_NUM_OF_SS]; +}; + +#endif --=20 2.43.0 From nobody Tue Dec 2 02:19:51 2025 Received: from mail-wr1-f46.google.com (mail-wr1-f46.google.com [209.85.221.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 46DBC3A5E7E for ; Wed, 19 Nov 2025 15:45:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.46 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763567164; cv=none; b=JTP/41bPSPnyW8tBvugsDgLpzBjkQlQs8SyXoRCi4QRvPX2wEj1o80IBsM989fFQ/RUJwgdTBhVNRFCWhWYrmNb9YifPe3kCpDhS59kMRZCM1VeTyGQs2hjiSRsc0brRLRvSyHhRhFFUqm+Icr8vkWnxoLSIur3O+YGn9+wZGBo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763567164; c=relaxed/simple; bh=f3ivw/X7k9GlCbiVs54CUIA/jWBXKlGJ8Yjl1U+AcTM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=kMYJXRKj6g8icopzEey2QpgAdwc5rkKJ9Ugk46Xvk40en7pdr83M0+FXn4dl1X5Oq+/rbGIPCm7f+k8rY/2GTuKMtroMFsn7+FA+X63OKKGq+fO6BlEkhz5KgjIGUILVwpNWHszYLGfkxxKG00lzVhCe/PO9je8uLmoowTb0Gzc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=dCa/4hQ4; arc=none smtp.client-ip=209.85.221.46 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="dCa/4hQ4" Received: by mail-wr1-f46.google.com with SMTP id ffacd0b85a97d-42b39d51dcfso3930916f8f.2 for ; Wed, 19 Nov 2025 07:45:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1763567157; x=1764171957; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=aBNrwlYX8KQq53Dd2Ff7QORfdDzZbYxDqKu/vrV5PaM=; b=dCa/4hQ48Hjq7BSjuCS1fi++8OazBBBghVqyAKOA5S5UMJACUxUIjGgU8rkqnEf+PH PFmT4YhqkBIvw5DJz9t8mqnZ3+kVC14CitO6OaX2Uiesoqo0TgCl56HZZw0Rph7tBLZR CTMulBFZnRvRXrGF0Z5RrStTF1d9wvCxDh5dW/ZUKeIrB12IOJizdkASRhEjp0UufNco IjMN5Ym+14JJnsWmxeZNGjK3SQBufkLkYZXBIc+SRB3JEnN7cvnKrHOLhIZPSccN7BF1 WfueqgGUlNLk3kVSjyuw7CdifKIZJ/YvVnpG0CNhC9QLKcsEb8wsC1hhDZqPKUbDbQ55 dN0g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763567157; x=1764171957; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=aBNrwlYX8KQq53Dd2Ff7QORfdDzZbYxDqKu/vrV5PaM=; b=J17wcHaBHp4BvC5g/pHws0q3S6WkgNdleZ4+ZvARbfSZj0VWXsO+iN0BXlVBhcHHA1 3b2XabN5ESYP8ResC2uiJXAg4WzfgdiEfaRUbvugawWLGn6MYxIJMkoTSVI32VaPz2eX cxGeJcN2rnV7rxVDeZnNvMtok9Z6//ZUy7cWVIVxR2ca5oaOCjv+xiuKtQbMIKhnwd3J bxR62ILYQIgKXzLLsCT7814ajnIvUUrHAxPsSZ/4x8YOf+XM40tEa3NGrL7QAgXoJhP2 9AWm4bN8gA3uaFllQ8BGprr3BJo2wn/m4xRTFdiWYTfMJVh5HzjoT46OEWoPc7LLMksl kwqw== X-Forwarded-Encrypted: i=1; AJvYcCV0a59FRD7D5vvkHH5N99h4hnCXvI1TO/GlVISfJe7zMKVGWKhaVHxtOy1ZKmGUjzMQP3NQIjETdkscZ2k=@vger.kernel.org X-Gm-Message-State: AOJu0YxU7HComaVRqIWc5tCKSxFk0E8xN0Sg5gxTTDhqi6lyOy6izSnV FhAum9cTr9jSZ93e7JSMaLXKT185qRuwC4LX1dfPUB1H2Nh+2emolIE/dseRGglb8o4= X-Gm-Gg: ASbGncsVyfIqZYkL8ZwMlSP4C+JPy6OBeoZH0b/oWkEC09eoId24gogjNFaWJs7O8BK 4oiZQpCuLFQx9/10G5zhpA3/RAuMaob7QErSNDwCHQHBm9RbJU6n8/HUVuBRHJKANFjctPFwGjN G6LBqzAVqUcwYAvWDvY+L231E6/Q7FFIeXfNj2mdDHKZpMQcJr9mbYJnfkpgMXYKoV/K2sE4ZzM KY9UP+cIAr7HBsK1FazJLOkmzJXkOGTJo4Rm0TEAr+s/IGcYUPPKalKnEWB8ip0mtA1/sOmeL/b Wrb/zaHd/HjJNRhL2EjCV1ZhSEFH+rLW6YLp2S/arK7BeTvGAqMKQiCWknS2u/kuK1OgEMnpssb gC6sx4M95TtXEs4kSoErLluKnQ7+r1YBeFxxBBMysSfe4PUZasSoUS/AuB8WG12AMqaNc9PDpWH gYrWXHCT0g6R6CrOUUzmM= X-Google-Smtp-Source: AGHT+IHMsSbrwKXE/iT+c2iGpRnN+BNbOo3hGgZttZwiDhEyh5x/2x4kZMct8HS2b5hiT6bCYQDvdQ== X-Received: by 2002:a05:6000:2083:b0:42b:3867:b39c with SMTP id ffacd0b85a97d-42b593745c4mr20164142f8f.34.1763567157017; Wed, 19 Nov 2025 07:45:57 -0800 (PST) Received: from eugen-station.. ([82.76.24.202]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-42b53dea1c9sm38765632f8f.0.2025.11.19.07.45.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Nov 2025 07:45:56 -0800 (PST) From: Eugen Hristev To: linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, tglx@linutronix.de, andersson@kernel.org, pmladek@suse.com, rdunlap@infradead.org, corbet@lwn.net, david@redhat.com, mhocko@suse.com Cc: tudor.ambarus@linaro.org, mukesh.ojha@oss.qualcomm.com, linux-arm-kernel@lists.infradead.org, linux-hardening@vger.kernel.org, jonechou@google.com, rostedt@goodmis.org, linux-doc@vger.kernel.org, devicetree@vger.kernel.org, linux-remoteproc@vger.kernel.org, linux-arch@vger.kernel.org, tony.luck@intel.com, kees@kernel.org, Eugen Hristev Subject: [PATCH 23/26] soc: qcom: Add minidump driver Date: Wed, 19 Nov 2025 17:44:24 +0200 Message-ID: <20251119154427.1033475-24-eugen.hristev@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251119154427.1033475-1-eugen.hristev@linaro.org> References: <20251119154427.1033475-1-eugen.hristev@linaro.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Qualcomm Minidump is a driver that manages the minidump shared memory table on Qualcomm platforms. It uses the meminspect table that it parses , in order to obtain inspection entries from the kernel, and convert them into regions. Regions are afterwards being registered into the shared memory and into the table of contents. Further, the firmware can read the table of contents and dump the memory accordingly, as per the firmware requirements. Signed-off-by: Eugen Hristev --- drivers/soc/qcom/Kconfig | 13 ++ drivers/soc/qcom/Makefile | 1 + drivers/soc/qcom/minidump.c | 272 ++++++++++++++++++++++++++++++ include/linux/soc/qcom/minidump.h | 4 + 4 files changed, 290 insertions(+) create mode 100644 drivers/soc/qcom/minidump.c diff --git a/drivers/soc/qcom/Kconfig b/drivers/soc/qcom/Kconfig index 2caadbbcf830..be768537528e 100644 --- a/drivers/soc/qcom/Kconfig +++ b/drivers/soc/qcom/Kconfig @@ -180,6 +180,19 @@ config QCOM_SMEM The driver provides an interface to items in a heap shared among all processors in a Qualcomm platform. =20 +config QCOM_MINIDUMP + tristate "Qualcomm Minidump memory inspection driver" + depends on ARCH_QCOM || COMPILE_TEST + depends on QCOM_SMEM + help + Say y here to enable the Qualcomm Minidump memory inspection driver. + This driver uses memory inspection mechanism to register minidump + regions with the Qualcomm firmware, into the shared memory. + The registered regions are being linked into the minidump table + of contents. + Further on, the firmware will be able to read the table of contents + and extract the memory regions on case-by-case basis. + config QCOM_SMD_RPM tristate "Qualcomm Resource Power Manager (RPM) over SMD" depends on ARCH_QCOM || COMPILE_TEST diff --git a/drivers/soc/qcom/Makefile b/drivers/soc/qcom/Makefile index b7f1d2a57367..3e5a2cacccd4 100644 --- a/drivers/soc/qcom/Makefile +++ b/drivers/soc/qcom/Makefile @@ -25,6 +25,7 @@ qcom_rpmh-y +=3D rpmh.o obj-$(CONFIG_QCOM_SMD_RPM) +=3D rpm-proc.o smd-rpm.o obj-$(CONFIG_QCOM_SMEM) +=3D smem.o obj-$(CONFIG_QCOM_SMEM_STATE) +=3D smem_state.o +obj-$(CONFIG_QCOM_MINIDUMP) +=3D minidump.o CFLAGS_smp2p.o :=3D -I$(src) obj-$(CONFIG_QCOM_SMP2P) +=3D smp2p.o obj-$(CONFIG_QCOM_SMSM) +=3D smsm.o diff --git a/drivers/soc/qcom/minidump.c b/drivers/soc/qcom/minidump.c new file mode 100644 index 000000000000..67ebbf09c171 --- /dev/null +++ b/drivers/soc/qcom/minidump.c @@ -0,0 +1,272 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * Qualcomm Minidump kernel inspect driver + * Copyright (C) 2016,2024-2025 Linaro Ltd + * Copyright (C) 2015 Sony Mobile Communications Inc + * Copyright (c) 2012-2013, The Linux Foundation. All rights reserved. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/** + * struct minidump - Minidump driver data information + * + * @dev: Minidump device struct. + * @toc: Minidump table of contents subsystem. + * @regions: Minidump regions array. + * @nb: Notifier block to register to meminspect. + */ +struct minidump { + struct device *dev; + struct minidump_subsystem *toc; + struct minidump_region *regions; + struct notifier_block nb; +}; + +static const char * const meminspect_id_to_md_string[] =3D { + "", + "ELF", + "vmcoreinfo", + "config", + "totalram", + "cpu_possible", + "cpu_present", + "cpu_online", + "cpu_active", + "mem_section", + "jiffies", + "linux_banner", + "nr_threads", + "nr_irqs", + "tainted_mask", + "taint_flags", + "node_states", + "__per_cpu_offset", + "nr_swapfiles", + "init_uts_ns", + "printk_rb_static", + "printk_rb_dynamic", + "prb", + "prb_descs", + "prb_infos", + "prb_data", + "high_memory", + "init_mm", + "init_mm_pgd", +}; + +/** + * qcom_md_table_init() - Initialize the minidump table + * @md: minidump data + * @mdss_toc: minidump subsystem table of contents + * + * Return: On success, it returns 0 and negative error value on failure. + */ +static int qcom_md_table_init(struct minidump *md, + struct minidump_subsystem *mdss_toc) +{ + md->toc =3D mdss_toc; + md->regions =3D devm_kcalloc(md->dev, MAX_NUM_REGIONS, + sizeof(*md->regions), GFP_KERNEL); + if (!md->regions) + return -ENOMEM; + + md->toc->regions_baseptr =3D cpu_to_le64(virt_to_phys(md->regions)); + md->toc->enabled =3D cpu_to_le32(MINIDUMP_SS_ENABLED); + md->toc->status =3D cpu_to_le32(1); + md->toc->region_count =3D cpu_to_le32(0); + + /* Tell bootloader not to encrypt the regions of this subsystem */ + md->toc->encryption_status =3D cpu_to_le32(MINIDUMP_SS_ENCR_DONE); + md->toc->encryption_required =3D cpu_to_le32(MINIDUMP_SS_ENCR_NOTREQ); + + return 0; +} + +/** + * qcom_md_get_region_index() - Lookup minidump region by id + * @md: minidump data + * @id: minidump region id + * + * Return: On success, it returns the internal region index, on failure, + * returns negative error value + */ +static int qcom_md_get_region_index(struct minidump *md, int id) +{ + unsigned int count =3D le32_to_cpu(md->toc->region_count); + unsigned int i; + + for (i =3D 0; i < count; i++) + if (md->regions[i].seq_num =3D=3D id) + return i; + + return -ENOENT; +} + +/** + * register_md_region() - Register a new minidump region + * @priv: private data + * @e: pointer to inspect entry + * + * Return: None + */ +static void __maybe_unused register_md_region(void *priv, + const struct inspect_entry *e) +{ + unsigned int num_region, region_cnt; + const char *name =3D "unknown"; + struct minidump_region *mdr; + struct minidump *md =3D priv; + + if (!(e->va || e->pa) || !e->size) { + dev_dbg(md->dev, "invalid region requested\n"); + return; + } + + if (e->id < ARRAY_SIZE(meminspect_id_to_md_string)) + name =3D meminspect_id_to_md_string[e->id]; + + if (qcom_md_get_region_index(md, e->id) >=3D 0) { + dev_dbg(md->dev, "%s:%d region is already registered\n", + name, e->id); + return; + } + + /* Check if there is a room for a new entry */ + num_region =3D le32_to_cpu(md->toc->region_count); + if (num_region >=3D MAX_NUM_REGIONS) { + dev_dbg(md->dev, "maximum region limit %u reached\n", + num_region); + return; + } + + region_cnt =3D le32_to_cpu(md->toc->region_count); + mdr =3D &md->regions[region_cnt]; + scnprintf(mdr->name, MAX_REGION_NAME_LENGTH, "K%.8s", name); + mdr->seq_num =3D e->id; + if (e->pa) + mdr->address =3D cpu_to_le64(e->pa); + else if (e->va) + mdr->address =3D cpu_to_le64(__pa(e->va)); + mdr->size =3D cpu_to_le64(ALIGN(e->size, 4)); + mdr->valid =3D cpu_to_le32(MINIDUMP_REGION_VALID); + region_cnt++; + md->toc->region_count =3D cpu_to_le32(region_cnt); + + dev_dbg(md->dev, "%s:%d region registered %llx:%llx\n", + mdr->name, mdr->seq_num, mdr->address, mdr->size); +} + +/** + * unregister_md_region() - Unregister a previously registered minidump re= gion + * @priv: private data + * @e: pointer to inspect entry + * + * Return: None + */ +static void __maybe_unused unregister_md_region(void *priv, + const struct inspect_entry *e) +{ + struct minidump_region *mdr; + struct minidump *md =3D priv; + unsigned int region_cnt; + unsigned int idx; + + idx =3D qcom_md_get_region_index(md, e->id); + if (idx < 0) { + dev_dbg(md->dev, "%d region is not present\n", e->id); + return; + } + + mdr =3D &md->regions[0]; + region_cnt =3D le32_to_cpu(md->toc->region_count); + + /* + * Left shift one position all the regions located after the + * region being removed, in order to fill the gap. + * Then, zero out the last region at the end. + */ + memmove(&mdr[idx], &mdr[idx + 1], (region_cnt - idx - 1) * sizeof(*mdr)); + memset(&mdr[region_cnt - 1], 0, sizeof(*mdr)); + region_cnt--; + md->toc->region_count =3D cpu_to_le32(region_cnt); +} + +static int qcom_md_notifier_cb(struct notifier_block *nb, + unsigned long code, void *entry) +{ + struct minidump *md =3D container_of(nb, struct minidump, nb); + + if (code =3D=3D MEMINSPECT_NOTIFIER_ADD) + register_md_region(md, entry); + else if (code =3D=3D MEMINSPECT_NOTIFIER_REMOVE) + unregister_md_region(md, entry); + + return 0; +} + +static int qcom_md_probe(struct platform_device *pdev) +{ + struct minidump_global_toc *mdgtoc; + struct device *dev =3D &pdev->dev; + struct minidump *md; + size_t size; + int ret; + + md =3D devm_kzalloc(dev, sizeof(*md), GFP_KERNEL); + if (!md) + return -ENOMEM; + platform_set_drvdata(pdev, md); + + md->dev =3D dev; + md->nb.notifier_call =3D qcom_md_notifier_cb; + + mdgtoc =3D qcom_smem_get(QCOM_SMEM_HOST_ANY, SBL_MINIDUMP_SMEM_ID, &size); + if (IS_ERR(mdgtoc)) { + ret =3D PTR_ERR(mdgtoc); + dev_err_probe(dev, ret, "Couldn't find minidump smem item\n"); + } + + if (size < sizeof(*mdgtoc) || !mdgtoc->status) + dev_err_probe(dev, -EINVAL, "minidump table not ready\n"); + + ret =3D qcom_md_table_init(md, &mdgtoc->subsystems[MINIDUMP_SUBSYSTEM_APS= S]); + if (ret) + dev_err_probe(dev, ret, "Could not initialize table\n"); + + meminspect_notifier_register(&md->nb); + + meminspect_lock_traverse(md, register_md_region); + return 0; +} + +static void qcom_md_remove(struct platform_device *pdev) +{ + struct minidump *md =3D platform_get_drvdata(pdev); + + meminspect_notifier_unregister(&md->nb); + meminspect_lock_traverse(md, unregister_md_region); +} + +static struct platform_driver qcom_md_driver =3D { + .probe =3D qcom_md_probe, + .remove =3D qcom_md_remove, + .driver =3D { + .name =3D "qcom-minidump", + }, +}; + +module_platform_driver(qcom_md_driver); + +MODULE_AUTHOR("Eugen Hristev "); +MODULE_AUTHOR("Mukesh Ojha "); +MODULE_DESCRIPTION("Qualcomm minidump inspect driver"); +MODULE_LICENSE("GPL"); diff --git a/include/linux/soc/qcom/minidump.h b/include/linux/soc/qcom/min= idump.h index 25247a6216e2..f90b61feb550 100644 --- a/include/linux/soc/qcom/minidump.h +++ b/include/linux/soc/qcom/minidump.h @@ -10,12 +10,16 @@ #ifndef __QCOM_MINIDUMP_H__ #define __QCOM_MINIDUMP_H__ =20 +#define MINIDUMP_SUBSYSTEM_APSS 0 #define MAX_NUM_OF_SS 10 #define MAX_REGION_NAME_LENGTH 16 #define SBL_MINIDUMP_SMEM_ID 602 #define MINIDUMP_REGION_VALID ('V' << 24 | 'A' << 16 | 'L' << 8 | 'I' << = 0) #define MINIDUMP_SS_ENCR_DONE ('D' << 24 | 'O' << 16 | 'N' << 8 | 'E' << = 0) +#define MINIDUMP_SS_ENCR_NOTREQ (0 << 24 | 0 << 16 | 'N' << 8 | 'R' << 0) #define MINIDUMP_SS_ENABLED ('E' << 24 | 'N' << 16 | 'B' << 8 | 'L' << 0) +#define MAX_NUM_REGIONS 201 + =20 /** * struct minidump_region - Minidump region --=20 2.43.0 From nobody Tue Dec 2 02:19:51 2025 Received: from mail-wm1-f48.google.com (mail-wm1-f48.google.com [209.85.128.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8A2733A79B0 for ; Wed, 19 Nov 2025 15:46:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.48 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763567166; cv=none; b=NllPmQRRADvQr7uhU0/Xqz5gcGyQ4HCWDFTnyG2r+QslaSEXGb+uQhDiwPdZ0euCEozjZggxveH+Qr7vXa0PadLtqjmRQ4JplmgKZ6FVEZ4ftc5Si1sMvm2jvX67nXP7j1//AVaDEFG1TPNShrYmUbk9qbW7P2+mSxmnf5La1DQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763567166; c=relaxed/simple; bh=BG5tLoxomZq6QyZmtX+DmOmp49QzG4CslaIEh2rN2og=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=dpUmSlyttry1n394VO4BYrkI6wyg3+l0hAPev4gobqFVJimoM3Hlgb6IemTB/ejVcsE2tbdD20WE7VGX0O8MgGMXqnAJwjv6I2d/ufOOz38NRb96ZbRzyI+6QfHUSlV6dDdZ3l0cAG1N9v141DwLW7r8C95frsH02oAQV6ZMyzw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=h67n1qs9; arc=none smtp.client-ip=209.85.128.48 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="h67n1qs9" Received: by mail-wm1-f48.google.com with SMTP id 5b1f17b1804b1-4779ce2a624so36866735e9.2 for ; Wed, 19 Nov 2025 07:46:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1763567159; x=1764171959; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=rqVd/I23ujzds6aG+1Lfyj/OLmPD/Ehk8Zy8jv9bGeE=; b=h67n1qs9Ihf0s3aPMinZSRCAczRQpw45ihMWMfjlNIvhknSfGnG+w+mMTwEi2c4pVy DL0+rKrt3+DReC07qFokF5Zkip6Gxvmbs6ndgMAcyZWTrgMwyDTjzLCMzlMYA9iEa8Sp Qtv3Ml8J57ag90nIHGke7OMoWVl6pkSuHd+H9mOYHRulvjzQRwMtGgelh1C/+3AXs0Vp mPSyP3aEBR4pq7oTf94IHwIeM5TfZSJDalWq7B2Kt327N8QvEp4zkM/wHSsLopjX5SEg 6CImGXk5cI/2l+iH0yRuOdj8QppJoe8lro4QThyAmtoqPuVU4Oz9R0Ce1/nthGUifyJ5 gWzA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763567159; x=1764171959; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=rqVd/I23ujzds6aG+1Lfyj/OLmPD/Ehk8Zy8jv9bGeE=; b=AT8ZxRQK6RyNbmwIjiPVKHf1VesOhTpzlMZN/3SCW0eJaB1JoFbQrYt4NZBJApHYg5 +oObdFxVAn9Q+IAJ7k2yClCenUHApiMckYaOo9TgwAU17VHlY6WdY2dL8VzfWXmJMocQ L5UlCLveXOCWhik+x8RgsA0xCjH9H8KnMMaaTKxRBdktOY/NVpc7YqC1QEJyfJAKGe9T 3p9sTXKrovD2Qo0X+bXiCQ9iRaxoIFbH5yaye630QDblj/M3QZM84ftlkUy1K7VFSJiu JOIAwrAhwIkH9DRidOu6Q6eiWC3L0vFTU8s/dSSkMbssqBPkbPe4ns2uk32SkW3JHv1r PfgA== X-Forwarded-Encrypted: i=1; AJvYcCWT61LUq+e8seO0UwsnBMuhWYlojr3eOyguyGOhxD/AwKZYHh+ylZwkgqvny1mJeOlCFLqNMacrwcLAUgM=@vger.kernel.org X-Gm-Message-State: AOJu0Yz+b8teHrZuBmnZwmRkTqfgvpC2ZBAb+Vjnx7Q4YWkJS8wvAFmJ FMebjkEtQln3VH2nZ8n321Uibz0Wq6bEo8OddV4PsLmBdRVLt9UGb/lw75yjTW0Tkx8= X-Gm-Gg: ASbGncvzPYRrRKdyMqa/2KK4zCZBz9WVi79cWjLdzsd5QuxKOltEXWeB+96/C4mm5hl Wq5itHyCGIbZttL/XqXwSM/c+kMf3+B7f53JlHL6Vdvn2SteS0BZGKxp6mueB94Di/8I0CAsv48 /u+x2QXoD60/lXAOfjyNFs9+GcVLZvthL4c1uzdYKNQE4COcY33NpfYdcfRt5SmDsxxZVZF2vMg us1s4VCIAxoFtlCvENVMGB+8y/dxWTSQ2jdbz34/D4/y4KRMqewmBJxIzgBAjvTGPjpfavvYk1I 4KYjLjYbptWFx7XLgIJ9rQSp9ogeD7Ev1XHl05xPPb/oSOGuutojdAAA3Dr6Ko9UF04KvFqzJ5p NhXlx81odhS6xFgiNSHS0yp0C+lfU3mKgB+z3OS/VX4FvDv4OAvEKP89FjuR5QhdYwOvkpAkqe9 E9+5JNfA/wCtaxfSftoeUFIbQ7X4DJ5g== X-Google-Smtp-Source: AGHT+IETZCFytuhcxmwyAYMbvVQ+k0LcHrDBKuExYdhaEVzislepliPqczS5k/WGmFJtVck24Vggmg== X-Received: by 2002:a05:6000:2405:b0:42b:3a84:1ec3 with SMTP id ffacd0b85a97d-42b5937ff2emr21375859f8f.29.1763567158737; Wed, 19 Nov 2025 07:45:58 -0800 (PST) Received: from eugen-station.. ([82.76.24.202]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-42b53dea1c9sm38765632f8f.0.2025.11.19.07.45.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Nov 2025 07:45:58 -0800 (PST) From: Eugen Hristev To: linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, tglx@linutronix.de, andersson@kernel.org, pmladek@suse.com, rdunlap@infradead.org, corbet@lwn.net, david@redhat.com, mhocko@suse.com Cc: tudor.ambarus@linaro.org, mukesh.ojha@oss.qualcomm.com, linux-arm-kernel@lists.infradead.org, linux-hardening@vger.kernel.org, jonechou@google.com, rostedt@goodmis.org, linux-doc@vger.kernel.org, devicetree@vger.kernel.org, linux-remoteproc@vger.kernel.org, linux-arch@vger.kernel.org, tony.luck@intel.com, kees@kernel.org, Eugen Hristev Subject: [PATCH 24/26] soc: qcom: smem: Add minidump device Date: Wed, 19 Nov 2025 17:44:25 +0200 Message-ID: <20251119154427.1033475-25-eugen.hristev@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251119154427.1033475-1-eugen.hristev@linaro.org> References: <20251119154427.1033475-1-eugen.hristev@linaro.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Add a minidump platform device. Minidump can collect various memory snippets using dedicated firmware. To know which snippets to collect, each snippet must be registered by the kernel into a specific shared memory table which is controlled by the qcom smem driver. To instantiate the minidump platform driver, register its data using platform_device_register_data. Later on, the minidump driver will probe and obtain the required memory snippets from the memory inspection table (meminspect) Signed-off-by: Eugen Hristev --- drivers/soc/qcom/smem.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/soc/qcom/smem.c b/drivers/soc/qcom/smem.c index c4c45f15dca4..03315722d71a 100644 --- a/drivers/soc/qcom/smem.c +++ b/drivers/soc/qcom/smem.c @@ -270,6 +270,7 @@ struct smem_region { * @partitions: list of partitions of current processor/host * @item_count: max accepted item number * @socinfo: platform device pointer + * @mdinfo: minidump device pointer * @num_regions: number of @regions * @regions: list of the memory regions defining the shared memory */ @@ -280,6 +281,7 @@ struct qcom_smem { =20 u32 item_count; struct platform_device *socinfo; + struct platform_device *mdinfo; struct smem_ptable *ptable; struct smem_partition global_partition; struct smem_partition partitions[SMEM_HOST_COUNT]; @@ -1236,12 +1238,20 @@ static int qcom_smem_probe(struct platform_device *= pdev) if (IS_ERR(smem->socinfo)) dev_dbg(&pdev->dev, "failed to register socinfo device\n"); =20 + smem->mdinfo =3D platform_device_register_data(&pdev->dev, "qcom-minidump= ", + PLATFORM_DEVID_AUTO, NULL, + 0); + if (IS_ERR(smem->mdinfo)) + dev_err(&pdev->dev, "failed to register platform md device\n"); + return 0; } =20 static void qcom_smem_remove(struct platform_device *pdev) { platform_device_unregister(__smem->socinfo); + if (!IS_ERR(__smem->mdinfo)) + platform_device_unregister(__smem->mdinfo); =20 hwspin_lock_free(__smem->hwlock); __smem =3D NULL; --=20 2.43.0 From nobody Tue Dec 2 02:19:51 2025 Received: from mail-wr1-f43.google.com (mail-wr1-f43.google.com [209.85.221.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 19BE23A8D6D for ; Wed, 19 Nov 2025 15:46:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.43 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763567173; cv=none; b=PJLeC/N3r6/slUm59VXNwDwGK4Ym6GvbHwRRKNKdUA+qXzvMVTbDbdQad23DpBr5zNYjw7ra9v2IU/n6lzi0JXLsdCKGF3TSm6yjeZvxCVrmSFGFfiHxV7ZAOoOLoCLA7VuNhOsDHHtE7jwVOclGGir4c9DaVZ9dhTgwuURNQWc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763567173; c=relaxed/simple; bh=Vs8lQW7BawUxmkOmLvkVao/jUHVbMrAhKW0MzITmHHs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=JKUSdolgPBoiO0TxY9G8ijMTPaFGY/efcNLnYdT8f0A8i9xxkYua4taCbOpigPmuhuoU8b1FVVLN5l5l0fqUDwZ2Cv/sQRK3TcX65Cw5Ax2fY4+Qr9YdWvvm1VBppgVBpcBRjzTMIdCnCpGGwpfdlVHABJNLBvgSXnmlD0lTsMc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=VfIjGAC4; arc=none smtp.client-ip=209.85.221.43 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="VfIjGAC4" Received: by mail-wr1-f43.google.com with SMTP id ffacd0b85a97d-42b3669ca3dso3464431f8f.0 for ; Wed, 19 Nov 2025 07:46:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1763567160; x=1764171960; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=plmpXAswm1LBomkuKtBG6pEMvq3kPgWo3F0t41OaVKo=; b=VfIjGAC47JzRKkMa6bVYCqO69oysdxBN88557iqFf92bxN3WiVd6FyYj8K0g2sC07G vI8GNT+76A9OUSubGiTyGEypEh5nx6gCAZ7EPXzr2A1bBKSPrJZFnPk2O7jOUTFw2eZ8 z2LZ9/VjmjcwrtXkLtfPmjLDu5YlbRIx7565kfmtv9lRsY7i3R9ZJc6GHcaqu50mIKXx qbZFEioU6S57LBO9n8HMrzljuZSuz6Vtpfy+9JNhQEgzFUMQKqgmJrNd6TcvgdptzoJO NbznlK/jLH8awNhwiVhRZuKO2+a3VUBPVyhxlLkSsLxN+vtglOrH0NKI4lnIqYfWJPRV WUmw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763567160; x=1764171960; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=plmpXAswm1LBomkuKtBG6pEMvq3kPgWo3F0t41OaVKo=; b=ea3+zLbPN0LYDzF/8jfR7JqcfNwJk6MBzxOhHza1i5uAZv2u/5BGdi/L43Nkaz1IHm L0/UUneqekBYKSrfC+zgkpf8mPJXm3Wdyhudl75MT78m6PcBNR185NolRpvFN2ieS0aO 4BxmVmn7+oBBBVLO/TfykObFi03RSvWK8ZfYsXalSQFf51bsfjW+W0O7GcanQtEhfKln U60gxS9gNS/hw8Evv/Z47UoGvLngnueD2o3nhGabECD94svl4ObWG/F8vT0IGnDxSps5 I9ElH3q+M8ad/167qxf/j8KjT7ZC2wW6oNCSBoJO+XhfEoWYs7HI9QAWwYVPRkFlBd+G o9eg== X-Forwarded-Encrypted: i=1; AJvYcCU1iLT9pwv09V+UMCiJtHnWx54hPOuvW+DmbDg5S3OucMYEQeFEF5te2lx6DiBxTMSGTPCiwb1Zyl9pcQ8=@vger.kernel.org X-Gm-Message-State: AOJu0YzhdTlvaicB3jCDmIc6DBs5bDMgAt92+vfjamJVQLUAup0rDr27 JsWtlVQdnaxkfASFiqxiJxmi7Rbxdz9vA2MG//2RjKoL8tbjIC49sKYKqwx4TawwEZA= X-Gm-Gg: ASbGnctS0Qdwvq8vJAK47WiM3BArF2ojALK5KIuqb0zHLwmH33v1EGiguKJU8DTlh1v UMKe8knDWHPBo1ttsuATN/kstg9Qz+1lcv74aa67zXOJuS30JEeNco/1nUwhZV7+kqVdquY6ltp CV6Aqnnw+p5H6h9HBYO11xcchMR7DYaRlQ+LgzLhKb/GOncOv6phqEqpwWwgmKa2Ez5XhoSxfjW gVwrhIiUd4u6tk008MQKQ4BpoMKkc0e3TuxR3CIl18HWK0AM80Lrx+AAwHx9c3rJpdBf1J7036N oTh/ARRrvLmubZE0HjdRPk5Yx6Li1TPmwmG9gdpFqoshbeoZiJrhDh4OfQMDJWK1zhUl2euqqKu sMdECzdmHSqL9/mQ2Zg6CYx85ZQmfuA8DTzHjech7WNLncvVXZ4Gb864NMEWtoE9t7Bc5Leg245 Dtwxipx8lUoOzl1KUq+ufQWzpTjLzdQok22a9ZYNnL X-Google-Smtp-Source: AGHT+IE/UWqNyS6htQwPVCsFX9f3Bqg52uzu0v0K2d2YIVRMOF1vqDQaElTCpee5ClbOZybd51PSbw== X-Received: by 2002:a5d:5d0e:0:b0:428:5673:11e0 with SMTP id ffacd0b85a97d-42b595a4ffbmr19851079f8f.40.1763567160526; Wed, 19 Nov 2025 07:46:00 -0800 (PST) Received: from eugen-station.. ([82.76.24.202]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-42b53dea1c9sm38765632f8f.0.2025.11.19.07.45.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Nov 2025 07:46:00 -0800 (PST) From: Eugen Hristev To: linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, tglx@linutronix.de, andersson@kernel.org, pmladek@suse.com, rdunlap@infradead.org, corbet@lwn.net, david@redhat.com, mhocko@suse.com Cc: tudor.ambarus@linaro.org, mukesh.ojha@oss.qualcomm.com, linux-arm-kernel@lists.infradead.org, linux-hardening@vger.kernel.org, jonechou@google.com, rostedt@goodmis.org, linux-doc@vger.kernel.org, devicetree@vger.kernel.org, linux-remoteproc@vger.kernel.org, linux-arch@vger.kernel.org, tony.luck@intel.com, kees@kernel.org, Eugen Hristev Subject: [PATCH 25/26] dt-bindings: reserved-memory: Add Google Kinfo Pixel reserved memory Date: Wed, 19 Nov 2025 17:44:26 +0200 Message-ID: <20251119154427.1033475-26-eugen.hristev@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251119154427.1033475-1-eugen.hristev@linaro.org> References: <20251119154427.1033475-1-eugen.hristev@linaro.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Add documentation for Google Kinfo Pixel reserved memory area. Signed-off-by: Eugen Hristev --- .../reserved-memory/google,kinfo.yaml | 49 +++++++++++++++++++ MAINTAINERS | 5 ++ 2 files changed, 54 insertions(+) create mode 100644 Documentation/devicetree/bindings/reserved-memory/googl= e,kinfo.yaml diff --git a/Documentation/devicetree/bindings/reserved-memory/google,kinfo= .yaml b/Documentation/devicetree/bindings/reserved-memory/google,kinfo.yaml new file mode 100644 index 000000000000..12d0b2815c02 --- /dev/null +++ b/Documentation/devicetree/bindings/reserved-memory/google,kinfo.yaml @@ -0,0 +1,49 @@ +# SPDX-License-Identifier: GPL-2.0 OR BSD-2-Clause +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/reserved-memory/google,kinfo.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Google Pixel Kinfo reserved memory + +maintainers: + - Eugen Hristev + +description: + This binding describes the Google Pixel Kinfo reserved memory, a region + of reserved-memory used to store data for firmware/bootloader on the Pix= el + platform. The data stored is debugging information on the running kernel. + +properties: + compatible: + items: + - const: google,kinfo + + memory-region: + maxItems: 1 + description: Reference to the reserved-memory for the data + +required: + - compatible + - memory-region + +additionalProperties: true + +examples: + - | + reserved-memory { + #address-cells =3D <1>; + #size-cells =3D <1>; + ranges; + + kinfo_region: smem@fa00000 { + reg =3D <0xfa00000 0x1000>; + no-map; + }; + }; + + debug-kinfo { + compatible =3D "google,debug-kinfo"; + + memory-region =3D <&kinfo_region>; + }; diff --git a/MAINTAINERS b/MAINTAINERS index 2cb2cc427c90..8034940d0b1e 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -16164,6 +16164,11 @@ F: Documentation/dev-tools/meminspect.rst F: include/linux/meminspect.h F: kernel/meminspect/* =20 +MEMINSPECT KINFO DRIVER +M: Eugen Hristev +S: Maintained +F: Documentation/devicetree/bindings/misc/google,kinfo.yaml + MEMBLOCK AND MEMORY MANAGEMENT INITIALIZATION M: Mike Rapoport L: linux-mm@kvack.org --=20 2.43.0 From nobody Tue Dec 2 02:19:51 2025 Received: from mail-wr1-f46.google.com (mail-wr1-f46.google.com [209.85.221.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D7B802EBB8F for ; Wed, 19 Nov 2025 15:46:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.46 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763567171; cv=none; b=N/k1T731gQl44sU/Lz2oTPrYx6SiUPEKaDoVHssHsJeIBzicNApWAoCb4bhMSSM0j932Ulx+Bf0ZZdUTFe1vdjslrRuv9okO0E0G+4FKUdHclT470XcKma2Oo80vuqTJbDxZHBmDK3fG+z2lcut1YqxzyMSCDzYVpIHWusHOctY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763567171; c=relaxed/simple; bh=wT8jmHzcNzOn5Qz+3QDhit2hy9V6GOAqUfnO1Z91iT4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Yul5Fhv+R4SJeP0fGl2khc95af1YNzPYoCHaJDyCiRAqz345eEqYlHdUmQKJrNSaJugFoG/RohoB3Jz0qlGlabkJunADBdeEncYkp7zktEGoIZ8+uGcbd2Q5g7QW2jSmV0yGa66yJNQgS61FSjuUlgwUHc9FdmHHJqX38Bz2IBw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=iKEE9S1x; arc=none smtp.client-ip=209.85.221.46 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="iKEE9S1x" Received: by mail-wr1-f46.google.com with SMTP id ffacd0b85a97d-42b2dc17965so5618676f8f.3 for ; Wed, 19 Nov 2025 07:46:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1763567162; x=1764171962; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=vjdG1/a5AFb8CurP464/OyK+i/niRA2OFjF7IXQ6EqU=; b=iKEE9S1x9QWbGHB/ePXFxV+MOYG1FQjEFKLupkcUbkIDj1MwKSWWC80B5kbXz527Uu +XrrAonfGs9qGc3eyA1TzIeotXf7kj+BVjN4suIrHDlzwVkBEz6MTYOwS0pnaQ4TwDjW np02CTwRAZTGAX4P5BJIGbgELcQkvyKUPNtmsnrychGRuzXzPfutsHnE2bDaRz7Qw3UL Hy2sn1q6aGUhuFRRo7QjslJ0yDKLJsUbaYSNAuGxCiVYaCgg6reHJpLV9v33MftCVQ8R R79z8CbM+8gYja96FcgAPvOTrPUBeYykCrc9acmjDKxn15o9cVyWZ6ZV7q64VV9jB6St nW2g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763567162; x=1764171962; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=vjdG1/a5AFb8CurP464/OyK+i/niRA2OFjF7IXQ6EqU=; b=X8J2cfCbRSFPHG5hGejHLg47hl004Mfg/EebmO1FJZqxETk770uLP7otllDjn7B7oT Nt9HZkzasMmVRCIgX6jJuq774zIm5Cuo6BPoqctUwgSzE0pag34duF9wPBUJRX0qEtby xT2f6WaHJr7HlYyUjs9V7Jot7VbFujg7pe4oGpObT2iQ/Txa6TIJU7jzR59g4B/3HR2X DM7Ko1yYNcPSR5o3HXvokjoJYZCNvkLCORMe+lU/U8TrkR72p0uS3UXnYE5K/yOVIXk0 j68dRYPKP80tl+onlxpbSpN0Lk9x5+KMG3jYUXrtHEPmk9lf9cz7ma9EBlHz7nheE9t0 Y3+Q== X-Forwarded-Encrypted: i=1; AJvYcCUA5E9wtbrEx1GPH212j4SS6zIze0H4OzOyUr6ww9zcv1W1CL7T9UYBU3jJLDZwHAdfbHSseNwINt/R9Lk=@vger.kernel.org X-Gm-Message-State: AOJu0YydS0S2NUYODuo8iA/+7oLzmGGq4mRKLSpgPuFjx0kbJfE3cxOq Y62c2yKhNcCZCYPYM51g4IyFipd8nHmmAgD8O01vRQ1lnWXqSUKW24d2y7OQjGz1lSs= X-Gm-Gg: ASbGnctyRX48L7wIuNMBOkObKtkYGXeSbkk4pF5FhVjJZ+QidiLgmVmmhprnprVYxN7 cDEKuPuXKgeciuGJBLb2U3hqaH1qEm0e9WIlyDeth3sjEPtRLpsyO1EvQvroybmeVyLd2/IHVTC nrp1Y24kNvJDhOTtiWvPOTqdOwdVaMavSbb4elRwMLvAEAf2sYPiJ2jOMqeVwbhFDWIos7/ZplM wcvhqarM4tlW21WIIUdIC3CQEDb5VzDozOiXRswr6g4kn+OLZO+amiy/HNBNcYRjQbG6ULysb74 nGjA/LliQJgOxFETvZL+SIPyTMSGkGx7LbrW85DJQRPPL35yzcyeUowEhwJG5wkyFBMuRpSP0R6 Bes9aEc/nbFAvh1O22UeVxc2PfoQWfNF6jSl/nLtFkbfj+V5Xr4CfdZwpp8BhrYf2Wr8817QhxW k9xOx3jnoUEWdEkktt+ycp4OinIvt3dA== X-Google-Smtp-Source: AGHT+IEYehjZzwQP4QY9mT+/5fGr+NBXUC5zHCL5MMz466EKwRwnbbkUf34pwbvo8KJX34cdlYI+Ug== X-Received: by 2002:a05:6000:657:b0:400:7e60:7ee0 with SMTP id ffacd0b85a97d-42b592d8549mr20248098f8f.0.1763567162304; Wed, 19 Nov 2025 07:46:02 -0800 (PST) Received: from eugen-station.. ([82.76.24.202]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-42b53dea1c9sm38765632f8f.0.2025.11.19.07.46.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Nov 2025 07:46:01 -0800 (PST) From: Eugen Hristev To: linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, tglx@linutronix.de, andersson@kernel.org, pmladek@suse.com, rdunlap@infradead.org, corbet@lwn.net, david@redhat.com, mhocko@suse.com Cc: tudor.ambarus@linaro.org, mukesh.ojha@oss.qualcomm.com, linux-arm-kernel@lists.infradead.org, linux-hardening@vger.kernel.org, jonechou@google.com, rostedt@goodmis.org, linux-doc@vger.kernel.org, devicetree@vger.kernel.org, linux-remoteproc@vger.kernel.org, linux-arch@vger.kernel.org, tony.luck@intel.com, kees@kernel.org, Eugen Hristev Subject: [PATCH 26/26] meminspect: Add Kinfo compatible driver Date: Wed, 19 Nov 2025 17:44:27 +0200 Message-ID: <20251119154427.1033475-27-eugen.hristev@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251119154427.1033475-1-eugen.hristev@linaro.org> References: <20251119154427.1033475-1-eugen.hristev@linaro.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" With this driver, the registered regions are copied to a shared memory zone at register time. The shared memory zone is supplied via OF. This driver will select only regions that are of interest, and keep only addresses. The format of the list is Kinfo compatible, with devices like Google Pixel phone. The firmware is only interested in some symbols' addresses. Signed-off-by: Eugen Hristev --- MAINTAINERS | 1 + kernel/meminspect/Kconfig | 10 ++ kernel/meminspect/Makefile | 1 + kernel/meminspect/kinfo.c | 289 +++++++++++++++++++++++++++++++++++++ 4 files changed, 301 insertions(+) create mode 100644 kernel/meminspect/kinfo.c diff --git a/MAINTAINERS b/MAINTAINERS index 8034940d0b1e..9cba0e472e01 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -16168,6 +16168,7 @@ MEMINSPECT KINFO DRIVER M: Eugen Hristev S: Maintained F: Documentation/devicetree/bindings/misc/google,kinfo.yaml +F: kernel/meminspect/kinfo.c =20 MEMBLOCK AND MEMORY MANAGEMENT INITIALIZATION M: Mike Rapoport diff --git a/kernel/meminspect/Kconfig b/kernel/meminspect/Kconfig index 8680fbf0e285..396510908e47 100644 --- a/kernel/meminspect/Kconfig +++ b/kernel/meminspect/Kconfig @@ -18,3 +18,13 @@ config MEMINSPECT Note that modules using this feature must be rebuilt if option changes. =20 +config MEMINSPECT_KINFO + tristate "Shared memory KInfo compatible driver" + depends on MEMINSPECT + help + Say y here to enable the Shared memory KInfo compatible driver + With this driver, the registered regions are copied to a shared + memory zone at register time. + The shared memory zone is supplied via OF. + This driver will select only regions that are of interest, + and keep only addresses. The format of the list is Kinfo compatible. diff --git a/kernel/meminspect/Makefile b/kernel/meminspect/Makefile index 09fd55e6d9cf..283604d892e5 100644 --- a/kernel/meminspect/Makefile +++ b/kernel/meminspect/Makefile @@ -1,3 +1,4 @@ # SPDX-License-Identifier: GPL-2.0 =20 obj-$(CONFIG_MEMINSPECT) +=3D meminspect.o +obj-$(CONFIG_MEMINSPECT_KINFO) +=3D kinfo.o diff --git a/kernel/meminspect/kinfo.c b/kernel/meminspect/kinfo.c new file mode 100644 index 000000000000..62f8ee7a66a9 --- /dev/null +++ b/kernel/meminspect/kinfo.c @@ -0,0 +1,289 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * + * Copyright 2002 Rusty Russell IBM Corporation + * Copyright 2021 Google LLC + * Copyright 2025 Linaro Ltd. Eugen Hristev + */ +#include +#include +#include +#include +#include +#include +#include +#include + +#define BUILD_INFO_LEN 256 +#define DEBUG_KINFO_MAGIC 0xcceeddff + +/* + * Header structure must be byte-packed, since the table is provided to + * bootloader. + */ +struct kernel_info { + /* For kallsyms */ + u8 enabled_all; + u8 enabled_base_relative; + u8 enabled_absolute_percpu; + u8 enabled_cfi_clang; + u32 num_syms; + u16 name_len; + u16 bit_per_long; + u16 module_name_len; + u16 symbol_len; + u64 _relative_pa; + u64 _text_pa; + u64 _stext_pa; + u64 _etext_pa; + u64 _sinittext_pa; + u64 _einittext_pa; + u64 _end_pa; + u64 _offsets_pa; + u64 _names_pa; + u64 _token_table_pa; + u64 _token_index_pa; + u64 _markers_pa; + u64 _seqs_of_names_pa; + + /* For frame pointer */ + u32 thread_size; + + /* For virt_to_phys */ + u64 swapper_pg_dir_pa; + + /* For linux banner */ + u8 last_uts_release[__NEW_UTS_LEN]; + + /* Info of running build */ + u8 build_info[BUILD_INFO_LEN]; + + /* For module kallsyms */ + u32 enabled_modules_tree_lookup; + u32 mod_mem_offset; + u32 mod_kallsyms_offset; +} __packed; + +struct kernel_all_info { + u32 magic_number; + u32 combined_checksum; + struct kernel_info info; +} __packed; + +struct debug_kinfo { + struct device *dev; + void *all_info_addr; + size_t all_info_size; + struct notifier_block nb; +}; + +static void update_kernel_all_info(struct kernel_all_info *all_info) +{ + struct kernel_info *info; + u32 *checksum_info; + int index; + + all_info->magic_number =3D DEBUG_KINFO_MAGIC; + all_info->combined_checksum =3D 0; + + info =3D &all_info->info; + checksum_info =3D (u32 *)info; + for (index =3D 0; index < sizeof(*info) / sizeof(u32); index++) + all_info->combined_checksum ^=3D checksum_info[index]; +} + +static u8 global_build_info[BUILD_INFO_LEN]; + +static int build_info_set(const char *str, const struct kernel_param *kp) +{ + size_t build_info_size =3D sizeof(global_build_info); + + if (strlen(str) > build_info_size) + return -ENOMEM; + memcpy(global_build_info, str, min(build_info_size - 1, strlen(str))); + return 0; +} + +static const struct kernel_param_ops build_info_op =3D { + .set =3D build_info_set, +}; + +module_param_cb(build_info, &build_info_op, NULL, 0200); +MODULE_PARM_DESC(build_info, "Write build info to field 'build_info' of de= bug kinfo."); + +static void __maybe_unused register_kinfo_region(void *priv, + const struct inspect_entry *e) +{ + struct debug_kinfo *kinfo =3D priv; + struct kernel_all_info *all_info =3D kinfo->all_info_addr; + struct kernel_info *info =3D &all_info->info; + struct uts_namespace *uts; + u64 paddr; + + if (e->pa) + paddr =3D e->pa; + else + paddr =3D __pa(e->va); + + switch (e->id) { + case MEMINSPECT_ID__sinittext: + info->_sinittext_pa =3D paddr; + break; + case MEMINSPECT_ID__einittext: + info->_einittext_pa =3D paddr; + break; + case MEMINSPECT_ID__end: + info->_end_pa =3D paddr; + break; + case MEMINSPECT_ID__text: + info->_text_pa =3D paddr; + break; + case MEMINSPECT_ID__stext: + info->_stext_pa =3D paddr; + break; + case MEMINSPECT_ID__etext: + info->_etext_pa =3D paddr; + break; + case MEMINSPECT_ID_kallsyms_num_syms: + info->num_syms =3D *(__u32 *)e->va; + break; + case MEMINSPECT_ID_kallsyms_relative_base: + info->_relative_pa =3D (u64)__pa(*(u64 *)e->va); + break; + case MEMINSPECT_ID_kallsyms_offsets: + info->_offsets_pa =3D paddr; + break; + case MEMINSPECT_ID_kallsyms_names: + info->_names_pa =3D paddr; + break; + case MEMINSPECT_ID_kallsyms_token_table: + info->_token_table_pa =3D paddr; + break; + case MEMINSPECT_ID_kallsyms_token_index: + info->_token_index_pa =3D paddr; + break; + case MEMINSPECT_ID_kallsyms_markers: + info->_markers_pa =3D paddr; + break; + case MEMINSPECT_ID_kallsyms_seqs_of_names: + info->_seqs_of_names_pa =3D paddr; + break; + case MEMINSPECT_ID_swapper_pg_dir: + info->swapper_pg_dir_pa =3D paddr; + break; + case MEMINSPECT_ID_init_uts_ns: + if (!e->va) + return; + uts =3D e->va; + strscpy(info->last_uts_release, uts->name.release, __NEW_UTS_LEN); + break; + default: + break; + }; + + update_kernel_all_info(all_info); +} + +static int kinfo_notifier_cb(struct notifier_block *nb, + unsigned long code, void *entry) +{ + struct debug_kinfo *kinfo =3D container_of(nb, struct debug_kinfo, nb); + + if (code =3D=3D MEMINSPECT_NOTIFIER_ADD) + register_kinfo_region(kinfo, entry); + + return NOTIFY_DONE; +} + +static int debug_kinfo_probe(struct platform_device *pdev) +{ + struct kernel_all_info *all_info; + struct device *dev =3D &pdev->dev; + struct device_node *mem_region; + struct reserved_mem *rmem; + struct debug_kinfo *kinfo; + struct kernel_info *info; + + mem_region =3D of_parse_phandle(dev->of_node, "memory-region", 0); + if (!mem_region) + return dev_err_probe(dev, -ENODEV, "no such memory-region\n"); + + rmem =3D of_reserved_mem_lookup(mem_region); + if (!rmem) + return dev_err_probe(dev, -ENODEV, "no such reserved mem of node name %s= \n", + dev->of_node->name); + + /* Need to wait for reserved memory to be mapped */ + if (!rmem->priv) + return -EPROBE_DEFER; + + if (!rmem->base || !rmem->size) + dev_err_probe(dev, -EINVAL, "unexpected reserved memory\n"); + + if (rmem->size < sizeof(struct kernel_all_info)) + dev_err_probe(dev, -EINVAL, "reserved memory size too small\n"); + + kinfo =3D devm_kzalloc(dev, sizeof(*kinfo), GFP_KERNEL); + if (!kinfo) + return -ENOMEM; + platform_set_drvdata(pdev, kinfo); + + kinfo->dev =3D dev; + + kinfo->all_info_addr =3D rmem->priv; + kinfo->all_info_size =3D rmem->size; + + all_info =3D kinfo->all_info_addr; + + memset(all_info, 0, sizeof(struct kernel_all_info)); + info =3D &all_info->info; + info->enabled_all =3D IS_ENABLED(CONFIG_KALLSYMS_ALL); + info->enabled_absolute_percpu =3D IS_ENABLED(CONFIG_KALLSYMS_ABSOLUTE_PER= CPU); + info->enabled_base_relative =3D IS_ENABLED(CONFIG_KALLSYMS_BASE_RELATIVE); + info->enabled_cfi_clang =3D IS_ENABLED(CONFIG_CFI_CLANG); + info->name_len =3D KSYM_NAME_LEN; + info->bit_per_long =3D BITS_PER_LONG; + info->module_name_len =3D MODULE_NAME_LEN; + info->symbol_len =3D KSYM_SYMBOL_LEN; + info->thread_size =3D THREAD_SIZE; + info->enabled_modules_tree_lookup =3D IS_ENABLED(CONFIG_MODULES_TREE_LOOK= UP); + info->mod_mem_offset =3D offsetof(struct module, mem); + info->mod_kallsyms_offset =3D offsetof(struct module, kallsyms); + + memcpy(info->build_info, global_build_info, strlen(global_build_info)); + + kinfo->nb.notifier_call =3D kinfo_notifier_cb; + + meminspect_notifier_register(&kinfo->nb); + meminspect_lock_traverse(kinfo, register_kinfo_region); + + return 0; +} + +static void debug_kinfo_remove(struct platform_device *pdev) +{ + struct debug_kinfo *kinfo =3D platform_get_drvdata(pdev); + + meminspect_notifier_unregister(&kinfo->nb); +} + +static const struct of_device_id debug_kinfo_of_match[] =3D { + { .compatible =3D "google,debug-kinfo" }, + {}, +}; +MODULE_DEVICE_TABLE(of, debug_kinfo_of_match); + +static struct platform_driver debug_kinfo_driver =3D { + .probe =3D debug_kinfo_probe, + .remove =3D debug_kinfo_remove, + .driver =3D { + .name =3D "debug-kinfo", + .of_match_table =3D of_match_ptr(debug_kinfo_of_match), + }, +}; +module_platform_driver(debug_kinfo_driver); + +MODULE_AUTHOR("Eugen Hristev "); +MODULE_AUTHOR("Jone Chou "); +MODULE_DESCRIPTION("meminspect Kinfo Driver"); +MODULE_LICENSE("GPL"); --=20 2.43.0