Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp10418iob; Mon, 2 May 2022 10:41:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzksEhR26otzaspsaIYfC/3g/oK7Mp/Q34r4AsISh0iRSuZCVDujQACXHLAYOFBWe95V0id X-Received: by 2002:a17:90b:2241:b0:1d2:54b2:64b2 with SMTP id hk1-20020a17090b224100b001d254b264b2mr248757pjb.225.1651513281442; Mon, 02 May 2022 10:41:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651513281; cv=none; d=google.com; s=arc-20160816; b=Hj8QIJJ/x1d9VsyYYzOvN1xfEdkT+zOH/tb7bC6mbx2ja0NbOvSi7VLcZ1yKP08xIh COWtveOQ83ZqkF9LwOudUf05+luWvQbiqBe3FzJDN+zVBRpC0DuCKX72omogYvnfFRYf zHcc1NeU0GxFH6hjGY2ND50xYYnr5UuWLBYGjsMSEbv/31DAwnrnaM28kmuDbVyPAq1Z tcIvXy86WSz9VniPaSKNkoHef/QdnBKeb/UbxOugIOyS/y2a4JIgEemNYKoq2MdI1cUH QOJSVFHKwNSqY0zJiu9ACvpNeQVUQlB3bDOk8V/eRaq9ncHBLm3I+JQodFUQqWl2fkl6 t2+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=NE2s1fjGG/uAEM/hW9/W7iCfaqTqfWVCzhrV3oZ8vPU=; b=XucRzOwp4rcbkJG5hth/0+P+AFi2RIRRY05YHBMS1a+HwgepSY7W8Dkm/CmGEkDvA5 CsWd0P30ChZv/+zQPRF1Df8xNxtKRG+ZLRPNNkWkzObKskAwecheafKiiBiZspJh0vMU 4QkaQJfGngFtABL6nXwU9+hAUPApZkTmsc2xGoPr+kejpIvP2eUU6WI0rUzAWFlcTa3z I8KA4r0DyXjggIkOvN/v7CjV+/xUZ91NffZbMypRlHbQ6YdT/faDJVSNYezOMKmMI8JQ QE3UZAqOIU1RUCxnNqJEz2XzC6CEbI5k5f2L/iSEIphFPNiAs5F0kLpcsE/SqicVn3l9 zt3A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=St6K+L7v; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s5-20020a632c05000000b003c1afc51222si8267100pgs.101.2022.05.02.10.41.03; Mon, 02 May 2022 10:41:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=St6K+L7v; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244396AbiEBDEI (ORCPT + 99 others); Sun, 1 May 2022 23:04:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38468 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234855AbiEBDEF (ORCPT ); Sun, 1 May 2022 23:04:05 -0400 Received: from mail-pj1-x102a.google.com (mail-pj1-x102a.google.com [IPv6:2607:f8b0:4864:20::102a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D42D2264F for ; Sun, 1 May 2022 20:00:37 -0700 (PDT) Received: by mail-pj1-x102a.google.com with SMTP id a15-20020a17090ad80f00b001dc2e23ad84so3092733pjv.4 for ; Sun, 01 May 2022 20:00:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=NE2s1fjGG/uAEM/hW9/W7iCfaqTqfWVCzhrV3oZ8vPU=; b=St6K+L7v9I6c0BLH91Oc3CgXzE0EzF1oxBORVKA6081EILjF2vYxXHvDy2af27hlwb dXOAqtYu73K5VkdJ4zojDSmnlXltTvWWelkq+7HGPOojN5t5CoHGsRYqjZxINs/x5GDP oHcyPD1KI2Dka4KJyIZR2t1uIrBu5GBwhvDGXMLfDYmV7P8m95TssFPV/4/9turP+FSt 55AmeC/6T1Ec1kMUDsR89e9WT76arYWSFT7EoJvwEyzlTnqzF+doWViIPIBoyngdKgsM CJXvoPI848yQfEcuNrc07JtSN7cvDYfSbbePtWmavrGb/V7azDBff/LynRespfCoWehx AM5g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=NE2s1fjGG/uAEM/hW9/W7iCfaqTqfWVCzhrV3oZ8vPU=; b=UC67I0nspkOMrLNrkEETP2tNG40kkXuCZ1hE0+ziTIflzrwyVWZwoQGkb1H3+61dx4 6BiuSJAWTUz5eXNhHbiAEz+P7jMdZY2F8qL9PUmFl/+0nS9/EBsaidciKAcx96lp8+kB BK/fJOmeANDkYGfs8E2SKWhpI5yo1UdR/LPg8OyrpXMQoXCZTpy1HJbDmm0T72kpresI B3a1SlWAEuY9xhRsc5FzFrtfLeUm5zud1lWibwkcpo1pxhLAt1PKUJbvFRkGjVmzRh6V eK5yl3kgNCvOC5SN5RHpha6NtpqC3QwIFGOUkij7yYzk7qqkZj3yHtvt8n3HwenjIs6H yMDQ== X-Gm-Message-State: AOAM532u5cHDYRjqgtMni8/Z0/jYT8aMt+dy6mAOkwUVe4eN9AHrDAyq kQ0pzGERDTdjnZEQnSoseEPyA6qJzSA= X-Received: by 2002:a17:903:22c7:b0:15d:3359:ca4c with SMTP id y7-20020a17090322c700b0015d3359ca4cmr10055183plg.59.1651460437337; Sun, 01 May 2022 20:00:37 -0700 (PDT) Received: from octofox.hsd1.ca.comcast.net ([2601:641:401:1d20:fa8:c0d6:ea14:bd48]) by smtp.gmail.com with ESMTPSA id y12-20020a17090322cc00b0015e8d4eb1b9sm3500738plg.3.2022.05.01.20.00.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 01 May 2022 20:00:37 -0700 (PDT) From: Max Filippov To: linux-xtensa@linux-xtensa.org Cc: Chris Zankel , linux-kernel@vger.kernel.org, Max Filippov Subject: [PATCH] xtensa: don't leave invalid TLB entry in fast_store_prohibited Date: Sun, 1 May 2022 20:00:29 -0700 Message-Id: <20220502030029.1695897-1-jcmvbkbc@gmail.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=0.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, FROM_LOCAL_NOVOWEL,HK_RANDOM_ENVFROM,HK_RANDOM_FROM,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When fast_store_prohibited needs to go to the C-level exception handler it leaves TLB entry that caused page fault in the TLB. If the faulting task gets switched to a different CPU and completes page table update there the TLB entry will get out of sync with the page table which may cause a livelock on access to that page. Invalidate faulting TLB entry on a slow path exit from the fast_store_prohibited. Signed-off-by: Max Filippov --- arch/xtensa/kernel/entry.S | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/arch/xtensa/kernel/entry.S b/arch/xtensa/kernel/entry.S index d703ed31254a..7852481d779c 100644 --- a/arch/xtensa/kernel/entry.S +++ b/arch/xtensa/kernel/entry.S @@ -1882,7 +1882,11 @@ ENTRY(fast_store_prohibited) j 8b 2: /* If there was a problem, handle fault in C */ - + rsr a1, excvaddr + pdtlb a0, a1 + bbci.l a0, DTLB_HIT_BIT, 1f + idtlb a0 +1: rsr a3, depc # still holds a2 s32i a3, a2, PT_AREG2 mov a1, a2 -- 2.30.2