lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 11 May 2023 14:38:45 -0700
From:   Reinette Chatre <reinette.chatre@...el.com>
To:     Peter Newman <peternewman@...gle.com>,
        Fenghua Yu <fenghua.yu@...el.com>
CC:     Babu Moger <babu.moger@....com>,
        Thomas Gleixner <tglx@...utronix.de>,
        Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
        Dave Hansen <dave.hansen@...ux.intel.com>, <x86@...nel.org>,
        "H. Peter Anvin" <hpa@...or.com>,
        Stephane Eranian <eranian@...gle.com>,
        James Morse <james.morse@....com>,
        <linux-kernel@...r.kernel.org>, <linux-kselftest@...r.kernel.org>
Subject: Re: [PATCH v1 6/9] x86/resctrl: Create soft RMID version of
 __mon_event_count()

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@...gle.com>
> ---
>  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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ