[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200402221109.GJ9352@zn.tnic>
Date: Fri, 3 Apr 2020 00:11:09 +0200
From: Borislav Petkov <bp@...en8.de>
To: Balbir Singh <sblbir@...zon.com>
Cc: linux-kernel@...r.kernel.org, tglx@...utronix.de,
tony.luck@...el.com, keescook@...omium.org, x86@...nel.org,
benh@...nel.crashing.org, dave.hansen@...el.com
Subject: Re: [PATCH 3/3] arch/x86: Optionally flush L1D on context switch
On Thu, Apr 02, 2020 at 05:24:01PM +1100, Balbir Singh wrote:
> +int enable_l1d_flush_for_task(struct task_struct *tsk)
> +{
> + struct page *page;
> + int ret = 0;
> +
> + if (static_cpu_has(X86_FEATURE_FLUSH_L1D))
> + goto done;
> +
> + page = READ_ONCE(l1d_flush_pages);
> + if (unlikely(!page)) {
> + mutex_lock(&l1d_flush_mutex);
> + if (!l1d_flush_pages) {
> + l1d_flush_pages = alloc_l1d_flush_pages();
> + if (!l1d_flush_pages)
> + return -ENOMEM;
Do I see it correctly that you'll return here with l1d_flush_mutex still
held?
> + }
> + mutex_unlock(&l1d_flush_mutex);
> + }
> + /* I don't think we need to worry about KSM */
Pls use passive voice: no "we" or "I", etc.
--
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquette
Powered by blists - more mailing lists