Received: by 2002:ac0:a679:0:0:0:0:0 with SMTP id p54csp688506imp; Thu, 21 Feb 2019 09:11:34 -0800 (PST) X-Google-Smtp-Source: AHgI3Iath4ZCzTcQVCTXffbG/vbbOGXReDeNvD6EC6hgfSX84IU6Doe+iZpvHZE/nL1L7S7RbsQ6 X-Received: by 2002:a63:c745:: with SMTP id v5mr35836399pgg.261.1550769094664; Thu, 21 Feb 2019 09:11:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550769094; cv=none; d=google.com; s=arc-20160816; b=w0BJc4GU3jewQavNFGKPu/NiZRZnomb2HcJPrILg0iDaIn05afs9t+76z4fGBGQyDh qOt/td97rs0rccfUaB7ys1o6E8f2Yn7N+jys6+Bnq5dAQoG744/HGks2oyCYf53zoSln hGqIxOuXG4/WdtoKH9GzwS1JgxrhurjfOIZ8vodsvNGGWel05v3xgQ/1obFDl2swJgWq R88QbrpDAqlPXB2cB+XCXRhVqEJdR/tNch+RyzCqXDpG+zbySpQ8xO8PUeurSNJJWVFp LkG6ebbaA+Vh4TE1QNLjYbroXTcxQDs9PC6ucyhrLAId4OsO0XHhzVFyQuVmyUNZXS7d DF+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=Z4Jd82puYiI0Wpk2FE+DsqB8z4biSf3t5IYfnkCnYBc=; b=e/QryVvD/DIEZ6C6aHv3QQLE7R/UeXAIreEJm1ZxDidvKoU/Q5dA6qhg6tlyAS9OVC JDE389hL53JtS3vbrvmdu8XmZn1guDH3NMV+dGK5EKLLkNBLM6NCdKQH+nNu9pnCXzY2 Xs801CWoRXhQgPe84J7jh50zi8wvwRTk+W1jKGdmUaWLJiTRTAEfmpes89ctJYwCogKc qKdrF7SE1GTUo/MmG25iiDaT25U3KkVBov2sbMDtcLPSNTJKni6c4H/X38UlAUo+QrEJ v0AmvFRlHn6Ya2jC0K17yKxNHb9JaFOlibnnrFxq0pk1bPIMg271ztBF5pUGMvzRICC/ 8RWQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z1si10973469pln.21.2019.02.21.09.11.19; Thu, 21 Feb 2019 09:11:34 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728313AbfBURK0 (ORCPT + 99 others); Thu, 21 Feb 2019 12:10:26 -0500 Received: from outbound-smtp11.blacknight.com ([46.22.139.106]:41059 "EHLO outbound-smtp11.blacknight.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726075AbfBURKZ (ORCPT ); Thu, 21 Feb 2019 12:10:25 -0500 Received: from mail.blacknight.com (pemlinmail04.blacknight.ie [81.17.254.17]) by outbound-smtp11.blacknight.com (Postfix) with ESMTPS id 1AD7E1C1D6C for ; Thu, 21 Feb 2019 17:10:24 +0000 (GMT) Received: (qmail 18951 invoked from network); 21 Feb 2019 17:10:24 -0000 Received: from unknown (HELO techsingularity.net) (mgorman@techsingularity.net@[37.228.225.79]) by 81.17.254.9 with ESMTPSA (AES256-SHA encrypted, authenticated); 21 Feb 2019 17:10:23 -0000 Date: Thu, 21 Feb 2019 17:10:22 +0000 From: Mel Gorman To: Lars Persson Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, linux-mips@vger.kernel.org, Lars Persson Subject: Re: [PATCH] mm: migrate: add missing flush_dcache_page for non-mapped page migrate Message-ID: <20190221171022.GX9565@techsingularity.net> References: <20190219123212.29838-1-larper@axis.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: inline In-Reply-To: <20190219123212.29838-1-larper@axis.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Feb 19, 2019 at 01:32:12PM +0100, Lars Persson wrote: > Our MIPS 1004Kc SoCs were seeing random userspace crashes with SIGILL > and SIGSEGV that could not be traced back to a userspace code > bug. They had all the magic signs of an I/D cache coherency issue. > > Now recently we noticed that the /proc/sys/vm/compact_memory interface > was quite efficient at provoking this class of userspace crashes. > > Studying the code in mm/migrate.c there is a distinction made between > migrating a page that is mapped at the instant of migration and one > that is not mapped. Our problem turned out to be the non-mapped pages. > > For the non-mapped page the code performs a copy of the page content > and all relevant meta-data of the page without doing the required > D-cache maintenance. This leaves dirty data in the D-cache of the CPU > and on the 1004K cores this data is not visible to the I-cache. A > subsequent page-fault that triggers a mapping of the page will happily > serve the process with potentially stale code. > > What about ARM then, this bug should have seen greater exposure? Well > ARM became immune to this flaw back in 2010, see commit c01778001a4f > ("ARM: 6379/1: Assume new page cache pages have dirty D-cache"). > > My proposed fix moves the D-cache maintenance inside move_to_new_page > to make it common for both cases. > > Signed-off-by: Lars Persson Acked-by: Mel Gorman -- Mel Gorman SUSE Labs