Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp1174450pxb; Fri, 20 Nov 2020 03:09:31 -0800 (PST) X-Google-Smtp-Source: ABdhPJxrhmS5Oynp7xkpN1qiu0Nt0jiepBJW1ASXUoNWzj1zUrG+zZ7dGYP9IHPA9KlTKwygVWuU X-Received: by 2002:a50:9ee8:: with SMTP id a95mr6259874edf.351.1605870571674; Fri, 20 Nov 2020 03:09:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605870571; cv=none; d=google.com; s=arc-20160816; b=dYNL7Tj6kLKM3sR2XbyE7AvImSsiyMccDyvrXOgggKeGqnVZ7BkemtLrBEtbk7NEYZ Q336qFwKH5kLdkiKiLKRCkcAi8neWALfyRZiX9FVG9cB6dM/h7OshHsgkq9YwQX2p8CJ mCbM6PGCvXFYbbjve+LgspaUX2gw+tlg2PJ9O1SupDI9JMlySMNGwwELhUoLBC7NUFii /EiY+8EbzoBoJFL8agiMZGFUD5fr+h5kiFUoJU14ti6BC+REsrgWSDqJ/LWwXKToOCWa PH/GQrRjGTDOxV50YY9P6lWNnUqd5shD/rKGljHZUhLHqXt3eir9ABJvVysMrsFbrKWl QVbw== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=s3IKI7xhDOpBBXfEsIvXCl92l43r37Y9g/5E7BQk9FA=; b=NVcPE/11nmwIaHnVAv+2bslfrG1Y6qU6yjwIr8BVwQuE09k6i9RnSCxYK/U8OhWc3Z QpYYFUI4CsogLBqzqXrhPFcroNCsNNcZJt59SqoPVX0ZrRBg10bxhtlbzh/OngMqg018 i2sRxflmHDh2oAPFqWY2n4Z1YiUFmRJFhV98PVPMHC0LeOB10SLKKopFIv/TK1Y1UOWz eEMyZsPNgXbzTQxz5yG4DvGoBNBaDPQf8odd+c+4EYQW3dUoT/Yfg44xYZg3/PmTZRl6 tJiXMnChKotJQGAXA9+vIvvOii64nNFyaYWQMJ1JIbz0BMLBLhxfXlC967S0sbfrJxVA B8ZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=vd5f3r2Q; 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=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k22si1996474edj.571.2020.11.20.03.09.07; Fri, 20 Nov 2020 03:09:31 -0800 (PST) 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=@linuxfoundation.org header.s=korg header.b=vd5f3r2Q; 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=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728362AbgKTLGR (ORCPT + 99 others); Fri, 20 Nov 2020 06:06:17 -0500 Received: from mail.kernel.org ([198.145.29.99]:54022 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728341AbgKTLGO (ORCPT ); Fri, 20 Nov 2020 06:06:14 -0500 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 4380D22255; Fri, 20 Nov 2020 11:06:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1605870373; bh=KPQWNfEGf3USttRB5uIhSXOb90JsMj2//VH6TQ9uH7k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vd5f3r2Qs+GqR/D0aheXwJfJVzOyq7Jd3Memjex2DPQ0Dj1CMeqy65b4bRDEsp0BQ 2pMeqRJETFWxFUZpynwTwGK99UwDg0T7QI6J9WgA8m0AtMT3vSTyMi1pwuIRWjFibk BvpRThMfjd0dCi0bMypNJtctsHAm+6hEItaF2Vdw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christophe Leroy , Michael Ellerman Subject: [PATCH 4.19 09/14] powerpc/8xx: Always fault when _PAGE_ACCESSED is not set Date: Fri, 20 Nov 2020 12:03:30 +0100 Message-Id: <20201120104540.267432978@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201120104539.806156260@linuxfoundation.org> References: <20201120104539.806156260@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Christophe Leroy commit 29daf869cbab69088fe1755d9dd224e99ba78b56 upstream. The kernel expects pte_young() to work regardless of CONFIG_SWAP. Make sure a minor fault is taken to set _PAGE_ACCESSED when it is not already set, regardless of the selection of CONFIG_SWAP. This adds at least 3 instructions to the TLB miss exception handlers fast path. Following patch will reduce this overhead. Also update the rotation instruction to the correct number of bits to reflect all changes done to _PAGE_ACCESSED over time. Fixes: d069cb4373fe ("powerpc/8xx: Don't touch ACCESSED when no SWAP.") Fixes: 5f356497c384 ("powerpc/8xx: remove unused _PAGE_WRITETHRU") Fixes: e0a8e0d90a9f ("powerpc/8xx: Handle PAGE_USER via APG bits") Fixes: 5b2753fc3e8a ("powerpc/8xx: Implementation of PAGE_EXEC") Fixes: a891c43b97d3 ("powerpc/8xx: Prepare handlers for _PAGE_HUGE for 512k pages.") Cc: stable@vger.kernel.org Signed-off-by: Christophe Leroy Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/af834e8a0f1fa97bfae65664950f0984a70c4750.1602492856.git.christophe.leroy@csgroup.eu Signed-off-by: Greg Kroah-Hartman --- arch/powerpc/kernel/head_8xx.S | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) --- a/arch/powerpc/kernel/head_8xx.S +++ b/arch/powerpc/kernel/head_8xx.S @@ -356,11 +356,9 @@ _ENTRY(ITLBMiss_cmp) /* Load the MI_TWC with the attributes for this "segment." */ mtspr SPRN_MI_TWC, r11 /* Set segment attributes */ -#ifdef CONFIG_SWAP - rlwinm r11, r10, 32-5, _PAGE_PRESENT + rlwinm r11, r10, 32-7, _PAGE_PRESENT and r11, r11, r10 rlwimi r10, r11, 0, _PAGE_PRESENT -#endif li r11, RPN_PATTERN | 0x200 /* The Linux PTE won't go exactly into the MMU TLB. * Software indicator bits 20 and 23 must be clear. @@ -482,11 +480,9 @@ _ENTRY(DTLBMiss_jmp) * r11 = ((r10 & PRESENT) & ((r10 & ACCESSED) >> 5)); * r10 = (r10 & ~PRESENT) | r11; */ -#ifdef CONFIG_SWAP - rlwinm r11, r10, 32-5, _PAGE_PRESENT + rlwinm r11, r10, 32-7, _PAGE_PRESENT and r11, r11, r10 rlwimi r10, r11, 0, _PAGE_PRESENT -#endif /* The Linux PTE won't go exactly into the MMU TLB. * Software indicator bits 24, 25, 26, and 27 must be * set. All other Linux PTE bits control the behavior