Re: [PATCH v1 6/9] x86/resctrl: Create soft RMID version of __mon_event_count()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Peter,

On 4/21/2023 7:17 AM, Peter Newman wrote:
> When RMIDs are soft, __mon_event_count() only needs to report the
> current byte count in memory and should not touch the hardware RMIDs.
> 
> Create a parallel version for the soft RMID configuration and update
> __mon_event_count() to choose between it and the original depending on
> whether the soft RMID static key is enabled.

Please note that the changelog refers to "whether the soft RMID static
key is enabled" but the patch uses a bool instead of a static key.

> 
> Signed-off-by: Peter Newman <peternewman@xxxxxxxxxx>
> ---
>  arch/x86/kernel/cpu/resctrl/monitor.c | 33 ++++++++++++++++++++++++++-
>  1 file changed, 32 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/x86/kernel/cpu/resctrl/monitor.c b/arch/x86/kernel/cpu/resctrl/monitor.c
> index bb857eefa3b0..3d54a634471a 100644
> --- a/arch/x86/kernel/cpu/resctrl/monitor.c
> +++ b/arch/x86/kernel/cpu/resctrl/monitor.c
> @@ -487,7 +487,30 @@ void resctrl_mbm_flush_cpu(void)
>  		__mbm_flush(QOS_L3_MBM_TOTAL_EVENT_ID, r, d);
>  }
>  
> -static int __mon_event_count(u32 rmid, struct rmid_read *rr)
> +static int __mon_event_count_soft_rmid(u32 rmid, struct rmid_read *rr)
> +{
> +	struct mbm_state *m;
> +
> +	WARN_ON(!is_mbm_event(rr->evtid));
> +	m = get_mbm_state(rr->d, rmid, rr->evtid);
> +	if (!m)
> +		/* implies !is_mbm_event(...) */
> +		return -1;
> +
> +	rr->val += atomic64_read(&m->soft_rmid_bytes);
> +
> +	if (rr->first) {
> +		/*
> +		 * Discard any bandwidth resulting from the initial HW counter
> +		 * reads.
> +		 */
> +		atomic64_set(&m->soft_rmid_bytes, 0);
> +	}

The above is not clear to me. If rr->first is true then it would read
soft_rmid_bytes and then immediately reset it? 


Reinette



[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux