Received: by 2002:ac0:8845:0:0:0:0:0 with SMTP id g63csp373695img; Tue, 26 Feb 2019 01:24:28 -0800 (PST) X-Google-Smtp-Source: AHgI3Ia3ygFmxvamXb38CUL24fYiKuD9r8XyWTYj/8FI1l85cemluB0HPG0nN5cZONaRsj5uzqci X-Received: by 2002:a17:902:29aa:: with SMTP id h39mr24329699plb.6.1551173068591; Tue, 26 Feb 2019 01:24:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551173068; cv=none; d=google.com; s=arc-20160816; b=ttVDEyyF9k+/gmks/sEDfMXlRyZBXbnSVN0OCnH/7C0veZnzbSx+WAEhcNVSen39OQ YYDSHuNghC9T+RdFLBISD70dUKDW1tWWwaH0LvJR9CT2mV59noGSc4zeRZSqXPRoGdR+ fI0OeOJXDVFBoqObdzcUuKhp9D7zDGkLbZjfxB75U6ARp/pvluxW83BjNzPXp0nQ0UqS 0esfxiYO2+80ZUF/eKQUx1wok2nPDIMKj8UYQthc4PCzGclFDmq4u6q65BA2vYbYRzdJ KRZagK4DxYnPTLFh8a0fV3xQ2MvcLJEANheCZYXnFjUJcm0UOx7ccxDtfT7+IE3FvAhL SLHw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=JhebPdqQR1aCPOBdDYkPcx03ShVXWDP/+qvOfy/bcFM=; b=g1bUsFsmRDeglot5auCAjq9aFMYZTNgTOmaj1g3T/NLSW0/iJcU3Sktpxm9hXWYOsB /dj1F3I/O0LaYvbFTElX7hkTeySj+lYrcQqR89+JCuhMdiVsMgycQlQ1kheZZOqh4sMI xkZ9Ehw4ZFbzSM0CNwMIksodBqHIOGq+knH+PtDsN1Qa+HW804QHKGX1I8DKbAULv+u2 5aYksaEXUwuJR4FaEuo97b0hJwLCuzRyLFJBmx52xqND2v17rOFlas2ghQk03T72Vjbk j2W+Zlhe30EJXjO/cOxCDY6PKaeG8fjg/og/YNwVCMqe1huDRrvdXdeyyFa3yc1P7Dbv gB8g== 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 cs19si13458802plb.431.2019.02.26.01.24.13; Tue, 26 Feb 2019 01:24:28 -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 S1727647AbfBZJX3 (ORCPT + 99 others); Tue, 26 Feb 2019 04:23:29 -0500 Received: from foss.arm.com ([217.140.101.70]:43530 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726223AbfBZJX3 (ORCPT ); Tue, 26 Feb 2019 04:23:29 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 3B0BF80D; Tue, 26 Feb 2019 01:23:29 -0800 (PST) Received: from [10.162.40.137] (p8cg001049571a15.blr.arm.com [10.162.40.137]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id A96A13F71D; Tue, 26 Feb 2019 01:23:27 -0800 (PST) Subject: Re: [PATCH] mm: migrate: add missing flush_dcache_page for non-mapped page migrate To: Lars Persson , linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: linux-mips@vger.kernel.org, Lars Persson References: <20190219123212.29838-1-larper@axis.com> From: Anshuman Khandual Message-ID: <6d12d244-85be-52c4-c3bc-75d077a9c0ee@arm.com> Date: Tue, 26 Feb 2019 14:53:34 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <20190219123212.29838-1-larper@axis.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 02/19/2019 06:02 PM, 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. Just curious. Is not the code path which tries to map this page should do the invalidation just before setting it up in the page table via set_pte_at() or other similar variants ? How it maps without doing the necessary flush.