From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B8CAE33CCA; Fri, 24 Nov 2023 19:26:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="Pp9YQ1OK" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 45B24C433C7; Fri, 24 Nov 2023 19:26:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1700854014; bh=rA9JBAQKHTkRLsqXb60EVn8k4qdTIytWsk4kJCPLvfY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Pp9YQ1OKtuRBlQuXHLALH/EZvuQUhuDYU3bC+jy50qtXsa1NgATaBsJbCxo+JP7oh YpxkBABDounRwvBUGmtOiezXDqrPVeJFHPURGyZNb6Lj57XNfxsvZW3eKfTXPoUlxg c/FdlN/G7+yg19c341H/vP4bPmmE4jKy6bqC5OpI= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Claudio Imbrenda , Heiko Carstens , Vasily Gorbik Subject: [PATCH 5.4 097/159] s390/cmma: fix handling of swapper_pg_dir and invalid_pg_dir Date: Fri, 24 Nov 2023 17:55:14 +0000 Message-ID: <20231124171945.932094043@linuxfoundation.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231124171941.909624388@linuxfoundation.org> References: <20231124171941.909624388@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 5.4-stable review patch. If anyone has any objections, please let me know. ------------------ From: Heiko Carstens commit 84bb41d5df48868055d159d9247b80927f1f70f9 upstream. If the cmma no-dat feature is available the kernel page tables are walked to identify and mark all pages which are used for address translation (all region, segment, and page tables). In a subsequent loop all other pages are marked as "no-dat" pages with the ESSA instruction. This information is visible to the hypervisor, so that the hypervisor can optimize purging of guest TLB entries. All pages used for swapper_pg_dir and invalid_pg_dir are incorrectly marked as no-dat, which in turn can result in incorrect guest TLB flushes. Fix this by marking those pages correctly as being used for DAT. Cc: Reviewed-by: Claudio Imbrenda Signed-off-by: Heiko Carstens Signed-off-by: Vasily Gorbik Signed-off-by: Greg Kroah-Hartman --- arch/s390/mm/page-states.c | 6 ++++++ 1 file changed, 6 insertions(+) --- a/arch/s390/mm/page-states.c +++ b/arch/s390/mm/page-states.c @@ -198,6 +198,12 @@ void __init cmma_init_nodat(void) return; /* Mark pages used in kernel page tables */ mark_kernel_pgd(); + page = virt_to_page(&swapper_pg_dir); + for (i = 0; i < 4; i++) + set_bit(PG_arch_1, &page[i].flags); + page = virt_to_page(&invalid_pg_dir); + for (i = 0; i < 4; i++) + set_bit(PG_arch_1, &page[i].flags); /* Set all kernel pages not used for page tables to stable/no-dat */ for_each_memblock(memory, reg) {