Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp3583426pxk; Tue, 29 Sep 2020 00:15:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxqWh9ePlpAgr/b4AgJ1eZbLPUkGvh+E6XmJfkI3DmTOno7vX8NP+Hae8Sq9ywphEuiw6bh X-Received: by 2002:a17:906:bc98:: with SMTP id lv24mr2545871ejb.411.1601363752129; Tue, 29 Sep 2020 00:15:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601363752; cv=none; d=google.com; s=arc-20160816; b=uMeUJkMG3U22Ynzwx57Ba5yz+LtfuHL7VYf/8dgpxQFN5SbzaztSHBQxV08D0r4KcS GWxbULQDVh0ZV+WW/91aQZrp5LTQX21AUt05v5lwcoBTlGl6asT07xyfhr/63NKUFCgL W3QqcCk9uK4WVgMdR0qrPYulIBgj7xpH8VtlwZY55E5RgK62YhDc3CEtfAtXCd0i2YkA sW4RvsOozSYGShH8ximTlKUY+GgMfDKGZsb/QbEUGDrAweKZMa9HSdDf0hsDOe8iGU6a 3tn5RBKNMPRw+ImMTYQabqbdeZt2CC71E2bToF/n1OaSlvf5joIrML/GoMBXUtFicg/i kLww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=6jDtI8jm64OSzhK1U2cD9uXM9ed5eaoeJqgAM+6j+ok=; b=wO0sLe3HpUBhhqra8FJAVI8DZmK8sRe1RIzQfj2Nq8XW3GRIKlSX6bEPCV2Sxs9nY6 QsD3saElxV35d3KhQ4291tnmzWdzDjJkMcs11JKSwabDL/Ck+1xwuxgpIIaoRCbTebht FWbLc88i2z83Xs6Jp5YLhF/HVrP9L9GyRV2ZU1oxFb+4J/dwHsx7NPP1zMN3XTXII/NP pNWx3kbxqUcMTXZMnjtK0OPX8/wtoBSEUGLwZWA5pyk34EIi3D/do4HsKPzMzZi4u1jF SkZbmc6H+qYzJ369BhJF7HQsb2TCpFSLXae1XQbFVCD4vZ2wvOrnh+HC+/LGwUfBRBad A6Rg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=merlin.20170209 header.b=IZFvJYew; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id mb24si2113721ejb.583.2020.09.29.00.15.28; Tue, 29 Sep 2020 00:15:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=merlin.20170209 header.b=IZFvJYew; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725774AbgI2HM2 (ORCPT + 99 others); Tue, 29 Sep 2020 03:12:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53450 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725372AbgI2HM2 (ORCPT ); Tue, 29 Sep 2020 03:12:28 -0400 Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:8b0:10b:1231::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F303FC061755; Tue, 29 Sep 2020 00:12:27 -0700 (PDT) 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 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200928124457.27289-1-lukas.bulwahn@gmail.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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().