From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by mx.groups.io with SMTP id smtpd.web11.15245.1601363544435694618 for ; Tue, 29 Sep 2020 00:12:24 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@infradead.org header.s=merlin.20170209 header.b=IZFvJYew; spf=none, err=permanent DNS error (domain: infradead.org, ip: 205.233.59.134, mailfrom: peterz@infradead.org) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=6jDtI8jm64OSzhK1U2cD9uXM9ed5eaoeJqgAM+6j+ok=; b=IZFvJYewvYu9tXSIXook/MNVRr E20O80xrcA6KyqhK6v95UgPb+goPdMkjq3tzXvrfB41A1xihxK+5HeToHu1v9S6pEMMY8mh/fc2rZ vZa+MMs86F+ZZk/spf9h3hM9xJjVMWBRZ+k2DbtDqIxAKzR3P2noaY09veQxV8QIvx+hUzMJnQyt2 y+aUf310JFZ7WG1XV72pxalOWQ3HLQ+p2ENbq5254v/pIJUHOvUKvmb8AK/vroa6jFx5AXknu+9dR s9Yj+I1V9/TVC4cu+9e1r6SDqGWEFu1IRqyL42zrqz0GQcFzqv08Hz2hTCg9dA3lOr8/bhvNHyp72 gRVFZTfQ==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by merlin.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1kN9o5-0008V6-GZ; Tue, 29 Sep 2020 07:12:13 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 3148E300F7A; Tue, 29 Sep 2020 09:12:11 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 1B46A200D4C43; Tue, 29 Sep 2020 09:12:11 +0200 (CEST) Date: Tue, 29 Sep 2020 09:12:11 +0200 From: Peter Zijlstra To: Lukas Bulwahn Cc: Balbir Singh , Thomas Gleixner , Dave Hansen , Andy Lutomirski , Ingo Molnar , Borislav Petkov , x86@kernel.org, "H. Peter Anvin" , Nathan Chancellor , Nick Desaulniers , linux-kernel@vger.kernel.org, clang-built-linux@googlegroups.com, kernel-janitors@vger.kernel.org, linux-safety@lists.elisa.tech Subject: Re: [PATCH -next for tip:x86/pti] x86/tlb: drop unneeded local vars in enable_l1d_flush_for_task() Message-ID: <20200929071211.GJ2628@hirez.programming.kicks-ass.net> References: <20200928124457.27289-1-lukas.bulwahn@gmail.com> MIME-Version: 1.0 In-Reply-To: <20200928124457.27289-1-lukas.bulwahn@gmail.com> Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Mon, Sep 28, 2020 at 02:44:57PM +0200, Lukas Bulwahn wrote: > diff --git a/arch/x86/mm/tlb.c b/arch/x86/mm/tlb.c > index 6b0f4c88b07c..90515c04d90a 100644 > --- a/arch/x86/mm/tlb.c > +++ b/arch/x86/mm/tlb.c > @@ -316,7 +316,7 @@ EXPORT_SYMBOL_GPL(leave_mm); > > int enable_l1d_flush_for_task(struct task_struct *tsk) > { > - int cpu, ret = 0, i; > + int i; > > /* > * Do not enable L1D_FLUSH_OUT if > @@ -329,7 +329,7 @@ int enable_l1d_flush_for_task(struct task_struct *tsk) > !static_cpu_has(X86_FEATURE_FLUSH_L1D)) > return -EINVAL; > > - cpu = get_cpu(); > + get_cpu(); > > for_each_cpu(i, &tsk->cpus_mask) { > if (cpu_data(i).smt_active == true) { > @@ -340,7 +340,7 @@ int enable_l1d_flush_for_task(struct task_struct *tsk) > > set_ti_thread_flag(&tsk->thread_info, TIF_SPEC_L1D_FLUSH); > put_cpu(); > - return ret; > + return 0; > } If you don't use the return value of get_cpu(), then change it over to preempt_{dis,en}able(), but this got me looking at the function, wtf is that garbage supposed to do in the first place What do we need to disable preemption for? Please explain the desired semantics against sched_setaffinity().