Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp4763949pxk; Wed, 30 Sep 2020 11:02:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwORI72NBI9Q6j2M4iXJqzu0KQm3Spuj+GSKaOBQ94gyIRhXwBgSLm0n86bZmJ3sOZu0naN X-Received: by 2002:a17:907:20e5:: with SMTP id rh5mr4044662ejb.267.1601488965962; Wed, 30 Sep 2020 11:02:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601488965; cv=none; d=google.com; s=arc-20160816; b=LWh616wLKzgSeaNVes/Yd+cV+8fAEtQkPVN1jyMJq3cZ73JCY87s4iUpDqu1CkKODZ /3L7IRIB35IocTYdy2Sv57wLzHbAtv03qhVIjihTcxEvcXsJ5YczXIsqzOYCgK8Y/Z84 Btv69lbXXw7p0h3cJ0rgr6d9Ofd4ecOmjvhNKvgzuE8WHGGRsy5/BklAdG+p5FHEIOCG sbea86A7pXAhaipRUaOgDDnkKkEgB1pnBwHS/sBks562lOsAVDc7oHo1cipSOoravlzR lZRQhEL7L3Cdx09Bk5HtSGc4K9Tl9WN2rIQu2KB1cfEc6QN3rOGKlfGVfkQ+izZycGBV pGRg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:references :in-reply-to:subject:cc:to:dkim-signature:dkim-signature:from; bh=KADJNPeYkWLc4rv8X/2/vXEWW8tE11yqvvL4qWKRvO8=; b=v6MjFKXJo/HL3nJ+Lq8Z1v+txHLeXWurq2kSimk/Ogh7P5/abhTtdCJWKekEeZAj8l EsQXeW9XW7yZ4nmUbF/OKwPZ4rnwu5OF/XfNgzlKu8VCdwF/eh3D4zckWIySPfcsNzlt +FIoIihRHF/Ppc0M4HrMMc11SOhSdK5jCPqmrxxRGzVH8PEPti9HVFKFV3iXcLZkxkgc F4FemNgdTac6YSi89YvDLJK0ek2WE9OveLljisbpB+DZL0hv9F8Yikc/4IAKcV3bNWUB muah7EkpceRuJIPMtHD+DjNqqThcRpSJ5lDcX+W27l80fXN0VXIU73TDaegYrL3JFeUR 289w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=BSjiTsAg; dkim=neutral (no key) header.i=@linutronix.de header.b=HhBebLGR; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n10si1575430ejy.588.2020.09.30.11.02.23; Wed, 30 Sep 2020 11:02:45 -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=@linutronix.de header.s=2020 header.b=BSjiTsAg; dkim=neutral (no key) header.i=@linutronix.de header.b=HhBebLGR; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729813AbgI3SBD (ORCPT + 99 others); Wed, 30 Sep 2020 14:01:03 -0400 Received: from Galois.linutronix.de ([193.142.43.55]:58406 "EHLO galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725355AbgI3SBC (ORCPT ); Wed, 30 Sep 2020 14:01:02 -0400 From: Thomas Gleixner DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1601488860; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=KADJNPeYkWLc4rv8X/2/vXEWW8tE11yqvvL4qWKRvO8=; b=BSjiTsAgr+uTzss3nQXMZ+WzxJYsoCjd6YJEo8+xvOIl7XdjUXzTvmGbjOLvYZcT+6arAR bJOzE2yj9g3n097eYG1TmM8NB2j1y4n1sp/xXHnJAw+TESsWNjKpAh9NZSnQxwkVBjHjOB wmS4f9pn0v5sBloT4w3uo9Ms0udYEkzdqOtQSdz0y2MjLy0OztbnGMrJdb2MLnuWMpKErO 3l7hlmT+MGU7JnMF0jysY9qApxFFxEW3GaKP5jltOZQrgFAYAZSgXqEB+rQ39nxHFMYTgY VXFzpCi5FrhidMchzrPCW1WA7+FMwgqdnk60cla9EOCVQPkFdf4h1TcUU8aPjw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1601488860; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=KADJNPeYkWLc4rv8X/2/vXEWW8tE11yqvvL4qWKRvO8=; b=HhBebLGR2jX8C8/UN9xgaqH89dGt3AM7CL3hc1jCQ41H/WBZb4VQQITKHcDUSb/mr4hq9r nEB3HQNeHsUSrPBg== To: Peter Zijlstra Cc: Lukas Bulwahn , Balbir Singh , 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() In-Reply-To: <20200930170316.GB2628@hirez.programming.kicks-ass.net> References: <20200928124457.27289-1-lukas.bulwahn@gmail.com> <20200929071211.GJ2628@hirez.programming.kicks-ass.net> <20200929083709.GC2651@hirez.programming.kicks-ass.net> <87eemji887.fsf@nanos.tec.linutronix.de> <20200930170316.GB2628@hirez.programming.kicks-ass.net> Date: Wed, 30 Sep 2020 20:00:59 +0200 Message-ID: <87blhni1pg.fsf@nanos.tec.linutronix.de> MIME-Version: 1.0 Content-Type: text/plain Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Sep 30 2020 at 19:03, Peter Zijlstra wrote: > On Wed, Sep 30, 2020 at 05:40:08PM +0200, Thomas Gleixner wrote: > Also, that preempt_disable() in there doesn't actually do anything. > Worse, preempt_disable(); for_each_cpu(); is an anti-pattern. It mixes > static_cpu_has() and boot_cpu_has() in the same bloody condition and has > a pointless ret variable. I absolutely agree and I really missed it when looking at it before merging. cpus_read_lock()/unlock() is the right thing to do if at all. > It's shoddy code, that only works if you align the planets right. We > really shouldn't provide interfaces that are this bad. > > It's correct operation is only by accident. True :( I understand Balbirs problem and it makes some sense to provide a solution. We can: 1) reject set_affinity() if the task has that flush muck enabled and user space tries to move it to a SMT enabled core 2) disable the muck if if detects that it is runs on a SMT enabled core suddenly (hotplug says hello) This one is nasty because there is no feedback to user space about the wreckage. Thanks, tglx