[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <877dsagy1k.fsf@nanos.tec.linutronix.de>
Date: Thu, 01 Oct 2020 10:17:43 +0200
From: Thomas Gleixner <tglx@...utronix.de>
To: "Singh\, Balbir" <sblbir@...zon.com>,
Peter Zijlstra <peterz@...radead.org>
Cc: Lukas Bulwahn <lukas.bulwahn@...il.com>,
Dave Hansen <dave.hansen@...ux.intel.com>,
Andy Lutomirski <luto@...nel.org>,
Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
"x86\@kernel.org" <x86@...nel.org>,
"H. Peter Anvin" <hpa@...or.com>,
Nathan Chancellor <natechancellor@...il.com>,
Nick Desaulniers <ndesaulniers@...gle.com>,
"linux-kernel\@vger.kernel.org" <linux-kernel@...r.kernel.org>,
"clang-built-linux\@googlegroups.com"
<clang-built-linux@...glegroups.com>,
"kernel-janitors\@vger.kernel.org" <kernel-janitors@...r.kernel.org>,
"linux-safety\@lists.elisa.tech" <linux-safety@...ts.elisa.tech>
Subject: Re: [PATCH -next for tip:x86/pti] x86/tlb: drop unneeded local vars in enable_l1d_flush_for_task()
On Thu, Oct 01 2020 at 10:48, Balbir Singh wrote:
> On 1/10/20 9:49 am, Singh, Balbir wrote:
>>
>> +static void l1d_flush_kill(struct callback_head *ch)
>> +{
>> + clear_ti_thread_flag(¤t->thread_info, TIF_SPEC_L1D_FLUSH);
>> + force_signal(SIGBUS);
>> +}
>> +
>> void switch_mm(struct mm_struct *prev, struct mm_struct *next,
>> struct task_struct *tsk)
>> {
>> @@ -443,12 +438,14 @@ static void cond_mitigation(struct task_struct *next)
>> }
>>
>> /*
>> - * Flush only if SMT is disabled as per the contract, which is checked
>> - * when the feature is enabled.
>> + * Flush only if SMT is disabled, if flushing is enabled
>> + * and we are on an SMT enabled core, kill the task
>> */
>> - if (sched_smt_active() && !this_cpu_read(cpu_info.smt_active) &&
>> - (prev_mm & LAST_USER_MM_L1D_FLUSH))
>> - l1d_flush_hw();
>> + if (unlikely(prev_mm & LAST_USER_MM_L1D_FLUSH)) {
>> + if (!this_cpu_read(cpu_info.smt_active))
>> + l1d_flush_hw();
>> + else
>> + task_work_add(prev, l1d_flush_kill, true);
>
> We have no access the to the previous task and mm->owner depends on MEMCG :)
> We can do the magic in mm_mangle_tif_spec_bits(), I suppose
No, because we don't have access to prev task there either. Interesting
problem to solve.
Thanks,
tglx
Powered by blists - more mailing lists