From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C3614C4361B for ; Mon, 14 Dec 2020 04:16:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 83FCE20725 for ; Mon, 14 Dec 2020 04:16:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2438549AbgLNEP4 (ORCPT ); Sun, 13 Dec 2020 23:15:56 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35436 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725911AbgLNEPz (ORCPT ); Sun, 13 Dec 2020 23:15:55 -0500 Received: from mail-pg1-x543.google.com (mail-pg1-x543.google.com [IPv6:2607:f8b0:4864:20::543]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9F816C0613CF for ; Sun, 13 Dec 2020 20:15:15 -0800 (PST) Received: by mail-pg1-x543.google.com with SMTP id n1so8895133pge.8 for ; Sun, 13 Dec 2020 20:15:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:subject:to:cc:references:in-reply-to:mime-version :message-id:content-transfer-encoding; bh=IzItAb+/ARuy43MHZHytVoSiTjlxsOWc+L7HYoQ10Rk=; b=sKJgfr148BjRYzX/HwC2xkFZ/0a4TrXgBfen9ZN7lMaB7SW+itnsNCLU5d5WxIzZKl kwewH+B/EglrOnw8364mXmCmlESywVsBZn47nEoggNeEIwqyeoIQRpvlItqsgt5BDygy /dXfwAKnD3GaI+f9n+q+YAwYnJJDiXtatldgOufQJnvB8u1gDNb3Gtnav0ozT96zps19 Q4mpXyjS94Mkjp7DcfEUhjkvGqmfg5SdCEpblMmXy+XbEYFPUSbJGuYPI5htzzEK3tS5 1KCdV3Vt7wXNb2B5be0n6lSrozvn+VwrxAqGKSt9wLA+Gfm+fH9Dmb2cDf+Mxzy9CTv4 vbkg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:subject:to:cc:references:in-reply-to :mime-version:message-id:content-transfer-encoding; bh=IzItAb+/ARuy43MHZHytVoSiTjlxsOWc+L7HYoQ10Rk=; b=hw33JL75l3Y2HN4OZoRcA80yQNKbQsS1KMayiZrjK8+4JQPZXiSnX+67Sy2y+NGzI0 dtHQndtcj2vTrq8TGk46Tat3RVFkSAb3XtPtWD1n3g1HjIjhxBro6UPB0AJPuJGzPr8+ YtG2r9cK6Hd+SMqdfW5xQ3iKtn5p5KPaEcwHtHv3/osoReMBjJX+DaOg+/XqTRuP7Zo1 APBdDTB+4jsJcT2+Ktv5NzveURktiKUUFvfQJSp0CXkC6h2gkufXMsAUEwkUdZD9o06h aUcYAdv5L3F2YZkXzhZ0uZk2ppizWTEKseG3l81+b+sOWvgGN/poeXwu8amwv1YBxskO fedA== X-Gm-Message-State: AOAM530JRRlTLQfnVXGeXCvGXTM1E046nGefNfiqxCIBU0Bhydb4IjG1 aQLA4G9Q7SDdQcTVn25ELDo= X-Google-Smtp-Source: ABdhPJwLQFbwEuJx28XaT9yTVmY+be361/iJueWiQXXjL88/5Em8DZdjWZlNmRscq1PPBt2c5dGrKg== X-Received: by 2002:a63:5d5f:: with SMTP id o31mr19870693pgm.295.1607919310176; Sun, 13 Dec 2020 20:15:10 -0800 (PST) Received: from localhost ([220.240.228.148]) by smtp.gmail.com with ESMTPSA id ft19sm7668399pjb.44.2020.12.13.20.15.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 13 Dec 2020 20:15:09 -0800 (PST) Date: Mon, 14 Dec 2020 14:15:04 +1000 From: Nicholas Piggin Subject: Re: [PATCH 2/2] powerpc/64s: Trim offlined CPUs from mm_cpumasks To: Geert Uytterhoeven Cc: "Aneesh Kumar K.V" , Anton Vorontsov , Peter Zijlstra , Linux Kernel Mailing List , linuxppc-dev , Thomas Gleixner References: <20201120025757.325930-1-npiggin@gmail.com> <20201120025757.325930-3-npiggin@gmail.com> In-Reply-To: MIME-Version: 1.0 Message-Id: <1607919238.kj439g85v5.astroid@bobo.none> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Excerpts from Geert Uytterhoeven's message of December 10, 2020 7:06 pm: > Hi Nicholas, >=20 > On Fri, Nov 20, 2020 at 4:01 AM Nicholas Piggin wrote= : >> >> When offlining a CPU, powerpc/64s does not flush TLBs, rather it just >> leaves the CPU set in mm_cpumasks, so it continues to receive TLBIEs >> to manage its TLBs. >> >> However the exit_flush_lazy_tlbs() function expects that after >> returning, all CPUs (except self) have flushed TLBs for that mm, in >> which case TLBIEL can be used for this flush. This breaks for offline >> CPUs because they don't get the IPI to flush their TLB. This can lead >> to stale translations. >> >> Fix this by clearing the CPU from mm_cpumasks, then flushing all TLBs >> before going offline. >> >> These offlined CPU bits stuck in the cpumask also prevents the cpumask >> from being trimmed back to local mode, which means continual broadcast >> IPIs or TLBIEs are needed for TLB flushing. This patch prevents that >> situation too. >> >> Signed-off-by: Nicholas Piggin >=20 > Thanks for your patch! >=20 >> --- a/arch/powerpc/platforms/powermac/smp.c >> +++ b/arch/powerpc/platforms/powermac/smp.c >> @@ -911,6 +911,8 @@ static int smp_core99_cpu_disable(void) >> >> mpic_cpu_set_priority(0xf); >> >> + cleanup_cpu_mmu_context(); >> + >=20 > I guess this change broke pmac32_defconfig+SMP in v5.10-rc7? >=20 > arch/powerpc/platforms/powermac/smp.c: error: implicit > declaration of function 'cleanup_cpu_mmu_context' > [-Werror=3Dimplicit-function-declaration]: =3D> 914:2 >=20 > http://kisskb.ellerman.id.au/kisskb/buildresult/14423174/ Hey, yeah it does thanks for catching it. This patch fixes it for me --- >From a9b5ec92ffac975e81c6d7db6ff2b1486b2723f7 Mon Sep 17 00:00:00 2001 From: Nicholas Piggin Date: Mon, 14 Dec 2020 13:52:39 +1000 Subject: [PATCH] powerpc/32s: Fix cleanup_cpu_mmu_context() compile bug 32s has no tlbiel_all() defined, so just disable the cleanup with a comment. Fixes: 01b0f0eae081 ("powerpc/64s: Trim offlined CPUs from mm_cpumasks") Reported-by: Geert Uytterhoeven Signed-off-by: Nicholas Piggin --- arch/powerpc/platforms/powermac/smp.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/arch/powerpc/platforms/powermac/smp.c b/arch/powerpc/platforms= /powermac/smp.c index adae2a6712e1..66ef5f8f4445 100644 --- a/arch/powerpc/platforms/powermac/smp.c +++ b/arch/powerpc/platforms/powermac/smp.c @@ -911,7 +911,16 @@ static int smp_core99_cpu_disable(void) =20 mpic_cpu_set_priority(0xf); =20 + /* + * Would be nice for consistency if all platforms clear mm_cpumask and + * flush TLBs on unplug, but the TLB invalidation bug described in + * commit 01b0f0eae081 ("powerpc/64s: Trim offlined CPUs from + * mm_cpumasks") only applies to 64s and for now we only have the TLB + * flush code for that platform. + */ +#ifdef CONFIG_PPC64 cleanup_cpu_mmu_context(); +#endif =20 return 0; } --=20 2.23.0 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.5 required=3.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED,DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 462BFC4361B for ; Mon, 14 Dec 2020 04:17:12 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 1CBA620725 for ; Mon, 14 Dec 2020 04:17:10 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1CBA620725 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Received: from bilbo.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 4CvSlR3zq2zDqSB for ; Mon, 14 Dec 2020 15:17:07 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gmail.com (client-ip=2607:f8b0:4864:20::443; helo=mail-pf1-x443.google.com; envelope-from=npiggin@gmail.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=sKJgfr14; dkim-atps=neutral Received: from mail-pf1-x443.google.com (mail-pf1-x443.google.com [IPv6:2607:f8b0:4864:20::443]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4CvSjK26pTzDqB5 for ; Mon, 14 Dec 2020 15:15:13 +1100 (AEDT) Received: by mail-pf1-x443.google.com with SMTP id t22so1854321pfl.3 for ; Sun, 13 Dec 2020 20:15:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:subject:to:cc:references:in-reply-to:mime-version :message-id:content-transfer-encoding; bh=IzItAb+/ARuy43MHZHytVoSiTjlxsOWc+L7HYoQ10Rk=; b=sKJgfr148BjRYzX/HwC2xkFZ/0a4TrXgBfen9ZN7lMaB7SW+itnsNCLU5d5WxIzZKl kwewH+B/EglrOnw8364mXmCmlESywVsBZn47nEoggNeEIwqyeoIQRpvlItqsgt5BDygy /dXfwAKnD3GaI+f9n+q+YAwYnJJDiXtatldgOufQJnvB8u1gDNb3Gtnav0ozT96zps19 Q4mpXyjS94Mkjp7DcfEUhjkvGqmfg5SdCEpblMmXy+XbEYFPUSbJGuYPI5htzzEK3tS5 1KCdV3Vt7wXNb2B5be0n6lSrozvn+VwrxAqGKSt9wLA+Gfm+fH9Dmb2cDf+Mxzy9CTv4 vbkg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:subject:to:cc:references:in-reply-to :mime-version:message-id:content-transfer-encoding; bh=IzItAb+/ARuy43MHZHytVoSiTjlxsOWc+L7HYoQ10Rk=; b=E6VxBQPxp0CSPW1us6qntW9+iYJxax0m0xDNYsavM42ZAVSh3UvIsKo4isUdL3CMwW ba9VM9rPB+FBWM7rKzlPtCGZ8u20wJO4HoiRhtSxQZsnMQNx11MKE3NfL+xtSm2UP91k D5VvS+w6QkopRhxPKw8QkoPq7oqMvQyx9MVd6f1YO/YevH2NEZMDQdOh/HcldZeTj3O1 IqSLPEV/KsbREXfwefKc93YiiYsHoX3XpS1gKJZ2CByV30DV4RmAVTkZKEz3RGViHdIV GTNqyHSNGmZzp6QNxJanW9SFjhiguHDEBKgi5tb/1k86GKpmqC/LbdMOBXMntxrwGV9c s5WQ== X-Gm-Message-State: AOAM5326h+QjhE0y9WtPBhuqtlvBlUKY+suVAmrQEm4iCz/De+Q1zyB0 EKBMw1zDPVj2duuwKiAsNck= X-Google-Smtp-Source: ABdhPJwLQFbwEuJx28XaT9yTVmY+be361/iJueWiQXXjL88/5Em8DZdjWZlNmRscq1PPBt2c5dGrKg== X-Received: by 2002:a63:5d5f:: with SMTP id o31mr19870693pgm.295.1607919310176; Sun, 13 Dec 2020 20:15:10 -0800 (PST) Received: from localhost ([220.240.228.148]) by smtp.gmail.com with ESMTPSA id ft19sm7668399pjb.44.2020.12.13.20.15.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 13 Dec 2020 20:15:09 -0800 (PST) Date: Mon, 14 Dec 2020 14:15:04 +1000 From: Nicholas Piggin Subject: Re: [PATCH 2/2] powerpc/64s: Trim offlined CPUs from mm_cpumasks To: Geert Uytterhoeven References: <20201120025757.325930-1-npiggin@gmail.com> <20201120025757.325930-3-npiggin@gmail.com> In-Reply-To: MIME-Version: 1.0 Message-Id: <1607919238.kj439g85v5.astroid@bobo.none> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Zijlstra , "Aneesh Kumar K.V" , Linux Kernel Mailing List , Anton Vorontsov , Thomas Gleixner , linuxppc-dev Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" Excerpts from Geert Uytterhoeven's message of December 10, 2020 7:06 pm: > Hi Nicholas, >=20 > On Fri, Nov 20, 2020 at 4:01 AM Nicholas Piggin wrote= : >> >> When offlining a CPU, powerpc/64s does not flush TLBs, rather it just >> leaves the CPU set in mm_cpumasks, so it continues to receive TLBIEs >> to manage its TLBs. >> >> However the exit_flush_lazy_tlbs() function expects that after >> returning, all CPUs (except self) have flushed TLBs for that mm, in >> which case TLBIEL can be used for this flush. This breaks for offline >> CPUs because they don't get the IPI to flush their TLB. This can lead >> to stale translations. >> >> Fix this by clearing the CPU from mm_cpumasks, then flushing all TLBs >> before going offline. >> >> These offlined CPU bits stuck in the cpumask also prevents the cpumask >> from being trimmed back to local mode, which means continual broadcast >> IPIs or TLBIEs are needed for TLB flushing. This patch prevents that >> situation too. >> >> Signed-off-by: Nicholas Piggin >=20 > Thanks for your patch! >=20 >> --- a/arch/powerpc/platforms/powermac/smp.c >> +++ b/arch/powerpc/platforms/powermac/smp.c >> @@ -911,6 +911,8 @@ static int smp_core99_cpu_disable(void) >> >> mpic_cpu_set_priority(0xf); >> >> + cleanup_cpu_mmu_context(); >> + >=20 > I guess this change broke pmac32_defconfig+SMP in v5.10-rc7? >=20 > arch/powerpc/platforms/powermac/smp.c: error: implicit > declaration of function 'cleanup_cpu_mmu_context' > [-Werror=3Dimplicit-function-declaration]: =3D> 914:2 >=20 > http://kisskb.ellerman.id.au/kisskb/buildresult/14423174/ Hey, yeah it does thanks for catching it. This patch fixes it for me --- >From a9b5ec92ffac975e81c6d7db6ff2b1486b2723f7 Mon Sep 17 00:00:00 2001 From: Nicholas Piggin Date: Mon, 14 Dec 2020 13:52:39 +1000 Subject: [PATCH] powerpc/32s: Fix cleanup_cpu_mmu_context() compile bug 32s has no tlbiel_all() defined, so just disable the cleanup with a comment. Fixes: 01b0f0eae081 ("powerpc/64s: Trim offlined CPUs from mm_cpumasks") Reported-by: Geert Uytterhoeven Signed-off-by: Nicholas Piggin --- arch/powerpc/platforms/powermac/smp.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/arch/powerpc/platforms/powermac/smp.c b/arch/powerpc/platforms= /powermac/smp.c index adae2a6712e1..66ef5f8f4445 100644 --- a/arch/powerpc/platforms/powermac/smp.c +++ b/arch/powerpc/platforms/powermac/smp.c @@ -911,7 +911,16 @@ static int smp_core99_cpu_disable(void) =20 mpic_cpu_set_priority(0xf); =20 + /* + * Would be nice for consistency if all platforms clear mm_cpumask and + * flush TLBs on unplug, but the TLB invalidation bug described in + * commit 01b0f0eae081 ("powerpc/64s: Trim offlined CPUs from + * mm_cpumasks") only applies to 64s and for now we only have the TLB + * flush code for that platform. + */ +#ifdef CONFIG_PPC64 cleanup_cpu_mmu_context(); +#endif =20 return 0; } --=20 2.23.0