Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp1718785imm; Tue, 2 Oct 2018 12:48:07 -0700 (PDT) X-Google-Smtp-Source: ACcGV636YhgQVftCnbUDydd8Yb0ETPJR7EQIT09DQYXmw94Y0fx1co/U+S2Z/GJ04/xU1bFcjdT+ X-Received: by 2002:a62:5a83:: with SMTP id o125-v6mr17741339pfb.117.1538509687121; Tue, 02 Oct 2018 12:48:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538509687; cv=none; d=google.com; s=arc-20160816; b=Hn0AzRC9S2ZNV1MKCIs1GXr6phU691IZx7vnCFB1TnANB6zzOAQ8SJl2mC9mIYjjvh J2D60JWV0G1RcLxzC3NfHxLhSJsyJfk1fKkoL9aorfu7nKSHRW330H6Y7kpLvbyV8jtp Q96wvqURuyKpP1eF3iaJZfqgNO+lryfFH+Uh4zd6m5/sZ8EQQhD67ZgfYL6X34Xw9Fhf XaukDwA8nl53BR2pJbh0ekkHAVVP5wAL3z/2aDTK0zgpgsjsLCTctnbpwYp4cKMqF1tQ WQB6PuyWkmsW0+T9/5+WP5SGrAmy1Wjw8pOJzOkyc6GeZ/FsNMYX2LJP8QvnwXXZSiHU upkw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date:from :references:cc:to:subject; bh=fpHojZZLpU5vFmrc3uGQMn3fYf4eXCDJHxr6/O2BcRM=; b=lUyhuuucMYXnl8Q6PHwdTFqw6sgM25ebZGzeZ4/XPZi2aRKE07BQ/NiFFSzdPaFC9r zU3czoSOYzImrOIJYmWnZ0FkRcE7YuL21gMztfhmsuu6uSV33r48eQVt3eBow8eHnZ1+ jT4b8CI0TyTyqLbhVZ+XV4iKfEISf64E1nNfbcUOw1As56ol9nx4BqdRi81rdPzWCAI7 2sqzcjTCgkOv8YHT8uiymdj6zAgTeLOeSWTFouFZR6ljYKGyc1AIV+k3+zVt8EZ28/Q+ AtGyw9oTY66+Tyam3WjP1T0yegtFVgCZroTkVxIy8wydrFym6y9vJJdJWPxDOAqltidv ZrXg== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c2-v6si16428952pfn.212.2018.10.02.12.47.51; Tue, 02 Oct 2018 12:48:07 -0700 (PDT) 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727372AbeJCCa7 (ORCPT + 99 others); Tue, 2 Oct 2018 22:30:59 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:58286 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726194AbeJCCa7 (ORCPT ); Tue, 2 Oct 2018 22:30:59 -0400 Received: from pps.filterd (m0098396.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w92JhmAG029514 for ; Tue, 2 Oct 2018 15:46:00 -0400 Received: from e32.co.us.ibm.com (e32.co.us.ibm.com [32.97.110.150]) by mx0a-001b2d01.pphosted.com with ESMTP id 2mvbxvquv9-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 02 Oct 2018 15:45:59 -0400 Received: from localhost by e32.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 2 Oct 2018 13:45:59 -0600 Received: from b03cxnp08025.gho.boulder.ibm.com (9.17.130.17) by e32.co.us.ibm.com (192.168.1.132) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Tue, 2 Oct 2018 13:45:55 -0600 Received: from b03ledav005.gho.boulder.ibm.com (b03ledav005.gho.boulder.ibm.com [9.17.130.236]) by b03cxnp08025.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w92JjsUa24903798 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 2 Oct 2018 12:45:54 -0700 Received: from b03ledav005.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id C200CBE04F; Tue, 2 Oct 2018 13:45:54 -0600 (MDT) Received: from b03ledav005.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 59244BE054; Tue, 2 Oct 2018 13:45:51 -0600 (MDT) Received: from oc6857751186.ibm.com (unknown [9.85.193.168]) by b03ledav005.gho.boulder.ibm.com (Postfix) with ESMTP; Tue, 2 Oct 2018 13:45:51 -0600 (MDT) Subject: Re: [PATCH] migration/mm: Add WARN_ON to try_offline_node To: Michael Bringmann , Michal Hocko Cc: Thomas Falcon , Kees Cook , Mathieu Malaterre , linux-kernel@vger.kernel.org, Nicholas Piggin , Pavel Tatashin , linux-mm@kvack.org, Mauricio Faria de Oliveira , Juliet Kim , Thiago Jung Bauermann , Nathan Fontenot , Andrew Morton , YASUAKI ISHIMATSU , linuxppc-dev@lists.ozlabs.org, Dan Williams , Oscar Salvador References: <20181001185616.11427.35521.stgit@ltcalpine2-lp9.aus.stglabs.ibm.com> <20181001202724.GL18290@dhcp22.suse.cz> <20181002145922.GZ18290@dhcp22.suse.cz> <20181002160446.GA18290@dhcp22.suse.cz> From: Tyrel Datwyler Date: Tue, 2 Oct 2018 12:45:50 -0700 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: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 x-cbid: 18100219-0004-0000-0000-00001495F4DB X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00009810; HX=3.00000242; KW=3.00000007; PH=3.00000004; SC=3.00000267; SDB=6.01096924; UDB=6.00567240; IPR=6.00876967; MB=3.00023593; MTD=3.00000008; XFM=3.00000015; UTC=2018-10-02 19:45:58 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18100219-0005-0000-0000-000089041A07 Message-Id: X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-10-02_09:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1807170000 definitions=main-1810020187 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 10/02/2018 11:13 AM, Michael Bringmann wrote: > > > On 10/02/2018 11:04 AM, Michal Hocko wrote: >> On Tue 02-10-18 10:14:49, Michael Bringmann wrote: >>> On 10/02/2018 09:59 AM, Michal Hocko wrote: >>>> On Tue 02-10-18 09:51:40, Michael Bringmann wrote: >>>> [...] >>>>> When the device-tree affinity attributes have changed for memory, >>>>> the 'nid' affinity calculated points to a different node for the >>>>> memory block than the one used to install it, previously on the >>>>> source system. The newly calculated 'nid' affinity may not yet >>>>> be initialized on the target system. The current memory tracking >>>>> mechanisms do not record the node to which a memory block was >>>>> associated when it was added. Nathan is looking at adding this >>>>> feature to the new implementation of LMBs, but it is not there >>>>> yet, and won't be present in earlier kernels without backporting a >>>>> significant number of changes. >>>> >>>> Then the patch you have proposed here just papers over a real issue, no? >>>> IIUC then you simply do not remove the memory if you lose the race. >>> >>> The problem occurs when removing memory after an affinity change >>> references a node that was previously unreferenced. Other code >>> in 'kernel/mm/memory_hotplug.c' deals with initializing an empty >>> node when adding memory to a system. The 'removing memory' case is >>> specific to systems that perform LPM and allow device-tree changes. >>> The powerpc kernel does not have the option of accepting some PRRN >>> requests and accepting others. It must perform them all. >> >> I am sorry, but you are still too cryptic for me. Either there is a >> correctness issue and the the patch doesn't really fix anything or the >> final race doesn't make any difference and then the ppc code should be >> explicit about that. Checking the node inside the hotplug core code just >> looks as a wrong layer to mitigate an arch specific problem. I am not >> saying the patch is a no-go but if anything we want a big fat comment >> explaining how this is possible because right now it just points to an >> incorrect API usage. >> >> That being said, this sounds pretty much ppc specific problem and I >> would _prefer_ it to be handled there (along with a big fat comment of >> course). > > Let me try again. Regardless of the path to which we get to this condition, > we currently crash the kernel. This patch changes that to a WARN_ON notice > and continues executing the kernel without shutting down the system. I saw > the problem during powerpc testing, because that is the focus of my work. > There are other paths to this function besides powerpc. I feel that the > kernel should keep running instead of halting. This is still basically a hack to get around a known race. In itself this patch is still worth while in that we shouldn't crash the kernel on a null pointer dereference. However, I think the actual problem still needs to be addressed. We shouldn't run any PRRN events for the source system on the target after a migration. The device tree update should have taken care of telling us about new affinities and what not. Can we just throw out any queued PRRN events when we wake up on the target? -Tyrel > > Regards, >