mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Davis <afd@ti.com>
To: Peng Fan <peng.fan@nxp.com>,
	Bjorn Andersson <andersson@kernel.org>,
	Mathieu Poirier <mathieu.poirier@linaro.org>,
	Arnaud Pouliquen <arnaud.pouliquen@foss.st.com>,
	Daniel Baluta <daniel.baluta@nxp.com>
Cc: <linux-remoteproc@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 6/6] remoteproc: core: Consolidate bool flags into 1-bit bitfields
Date: Fri, 10 Oct 2025 08:01:10 -0500	[thread overview]
Message-ID: <9c8d708f-bf20-4dda-abf8-7896c820c611@ti.com> (raw)
In-Reply-To: <20251005-remoteproc-cleanup-v1-6-09a9fdea0063@nxp.com>

On 10/5/25 9:14 AM, Peng Fan wrote:
> Per Documentation/process/coding-style.rst rule 17 regarding the use of
> bool types:
> If a structure has many true/false values, consider consolidating them into
> a bitfield with 1-bit members, or using an appropriate fixed-width type
> such as u8.
> 
> This commit replaces multiple bool members in struct rproc with 1-bit
> bitfields and groups them together. This change reduces the overall size of
> struct rproc from 0x4d8 to 0x4c8 on ARM64.
> 

Most of the series looks good, but this patch I'm not a fan. This isn't
a huge savings and bitfields come with many of their own challenges.

> No functional changes.

If the structure's size changed then that is a functional change. There
also is probably a performance change from extracting the value out of the
bitfield, where before they might have each been an aligned width variable
that could be tested in a single cycle.

Andrew

> 
> Signed-off-by: Peng Fan <peng.fan@nxp.com>
> ---
>   include/linux/remoteproc.h | 18 +++++++++---------
>   1 file changed, 9 insertions(+), 9 deletions(-)
> 
> diff --git a/include/linux/remoteproc.h b/include/linux/remoteproc.h
> index b4795698d8c2a4e80ccafbe632436c4dfb636a1e..d8468a96edfbd82f4011881c10f59bf7c12e9c1a 100644
> --- a/include/linux/remoteproc.h
> +++ b/include/linux/remoteproc.h
> @@ -528,21 +528,21 @@ enum rproc_features {
>    * @index: index of this rproc device
>    * @crash_handler: workqueue for handling a crash
>    * @crash_cnt: crash counter
> - * @recovery_disabled: flag that state if recovery was disabled
>    * @max_notifyid: largest allocated notify id.
>    * @table_ptr: pointer to the resource table in effect
>    * @clean_table: copy of the resource table without modifications.  Used
>    *		 when a remote processor is attached or detached from the core
>    * @cached_table: copy of the resource table
>    * @table_sz: size of @cached_table
> - * @has_iommu: flag to indicate if remote processor is behind an MMU
> - * @auto_boot: flag to indicate if remote processor should be auto-started
> - * @sysfs_read_only: flag to make remoteproc sysfs files read only
>    * @dump_segments: list of segments in the firmware
>    * @nb_vdev: number of vdev currently handled by rproc
>    * @elf_class: firmware ELF class
>    * @elf_machine: firmware ELF machine
>    * @cdev: character device of the rproc
> + * @recovery_disabled: flag that state if recovery was disabled
> + * @has_iommu: flag to indicate if remote processor is behind an MMU
> + * @auto_boot: flag to indicate if remote processor should be auto-started
> + * @sysfs_read_only: flag to make remoteproc sysfs files read only
>    * @cdev_put_on_release: flag to indicate if remoteproc should be shutdown on @char_dev release
>    * @features: indicate remoteproc features
>    */
> @@ -570,21 +570,21 @@ struct rproc {
>   	int index;
>   	struct work_struct crash_handler;
>   	unsigned int crash_cnt;
> -	bool recovery_disabled;
>   	int max_notifyid;
>   	struct resource_table *table_ptr;
>   	struct resource_table *clean_table;
>   	struct resource_table *cached_table;
>   	size_t table_sz;
> -	bool has_iommu;
> -	bool auto_boot;
> -	bool sysfs_read_only;
>   	struct list_head dump_segments;
>   	int nb_vdev;
>   	u8 elf_class;
>   	u16 elf_machine;
>   	struct cdev cdev;
> -	bool cdev_put_on_release;
> +	bool recovery_disabled :1;
> +	bool has_iommu :1;
> +	bool auto_boot :1;
> +	bool sysfs_read_only :1;
> +	bool cdev_put_on_release :1;
>   	DECLARE_BITMAP(features, RPROC_MAX_FEATURES);
>   };
>   
> 


  parent reply	other threads:[~2025-10-10 13:01 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-05 14:14 [PATCH 0/6] remoteproc: core: misc update Peng Fan
2025-10-05 14:14 ` [PATCH 1/6] remoteproc: core: Drop redundant initialization of 'ret' in rproc_shutdown() Peng Fan
2025-10-05 14:14 ` [PATCH 2/6] remoteproc: core: Sort header includes Peng Fan
2025-10-05 14:14 ` [PATCH 3/6] remoteproc: core: Removed unused headers Peng Fan
2025-10-05 14:14 ` [PATCH 4/6] remoteproc: core: Use cleanup.h macros to simplify lock handling Peng Fan
2025-10-05 14:14 ` [PATCH 5/6] remoteproc: core: Remove unused export of rproc_va_to_pa Peng Fan
2025-10-05 14:14 ` [PATCH 6/6] remoteproc: core: Consolidate bool flags into 1-bit bitfields Peng Fan
2025-10-10  8:44   ` kernel test robot
2025-10-10 13:01   ` Andrew Davis [this message]
2025-10-10 14:21     ` Peng Fan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9c8d708f-bf20-4dda-abf8-7896c820c611@ti.com \
    --to=afd@ti.com \
    --cc=andersson@kernel.org \
    --cc=arnaud.pouliquen@foss.st.com \
    --cc=daniel.baluta@nxp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-remoteproc@vger.kernel.org \
    --cc=mathieu.poirier@linaro.org \
    --cc=peng.fan@nxp.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®