Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp392799img; Thu, 21 Mar 2019 23:51:26 -0700 (PDT) X-Google-Smtp-Source: APXvYqxUerofmhgTniE84aql6+DaGzHcS1nxTNBbgXqU+FYoqU3cfUOddCrPNT4JmRy1wkFhkGzJ X-Received: by 2002:a17:902:380c:: with SMTP id l12mr7926058plc.238.1553237486153; Thu, 21 Mar 2019 23:51:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553237486; cv=none; d=google.com; s=arc-20160816; b=fM7+L1hl8I+njRbyUW0k10WerL1Mkul3Dep+/v5v20JzrFHPmxvf5c6b7UeCN6RxLD PoSYxNbb/LMDUjoEXxcrMbI8yawYMkwe+w8y2EAYL2oy0ktMm/OfKjs0g6IenzN7pW3S U6V1u6+iSqBiHLa/sZOSEdWAnOCRt/7TBZVJnHcNNbkRh+uRhBUtRrm7yrR1qtBzvhsA xOqLG6U0/Tro08LNb1ePDjfwsT6taxnwAm2siUJzP9UTpocqaDJyxiVkSgsIt7/uwObd w41vceqF1XFNTrH0n11MCKTSfIsMTFfyMB98YbmN9JKi96txcAS+tDRVnKRAGq3LQuA1 8bgA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=Og2qwT9BdQ4rmx69WidXs09mKQ/R1nn/AForRblNkDM=; b=n/im7T8HPS8y7aC6c7/TflYcNSeTewKf5Of814IT8X/6rTa83gqZ4GmBlnIZOt3v2h jJ5fIEO2nTNfqChIwOv4Gzk77uXIeUgMcymAiVW4/UmhhHsE1jFzZ5HAVhbKrFbgtkFB WZSH4grEExa4s9Z4Fgh+Xm8XYpCl2NBz1mCZ8JjkZJdhTOc32TtMMrnSoDZV6ojDXcjI YHF0k5FLD/lLCSpBbdBFb6EypwsDZj+GAPCqZo6lFh6+6gXgVEggwG48Uz5jegHihDa1 Wqy63MTvUgmyirqv7xQNY09HHyGluPkhwWhUCjW9/+w2yJRzWmB/EWeau97TlszfkEU8 TzNw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=qzPRMVf+; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f21si6219224plr.297.2019.03.21.23.51.08; Thu, 21 Mar 2019 23:51:26 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=qzPRMVf+; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727654AbfCVGu1 (ORCPT + 99 others); Fri, 22 Mar 2019 02:50:27 -0400 Received: from mail-lj1-f194.google.com ([209.85.208.194]:35875 "EHLO mail-lj1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726014AbfCVGu1 (ORCPT ); Fri, 22 Mar 2019 02:50:27 -0400 Received: by mail-lj1-f194.google.com with SMTP id r24so41575ljg.3; Thu, 21 Mar 2019 23:50:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=Og2qwT9BdQ4rmx69WidXs09mKQ/R1nn/AForRblNkDM=; b=qzPRMVf+ro/3nnUBrHuqbXLmFTDoq1/KpLRO5ATXRZk4HORnW2q5IS4GfnU0Vle3KJ 5UkQHKKzQxJRqvlVCMov0u/xqijZNnL/MpnO47WcGMPOluATn59uUmEiVR0aWBLCbLEJ hJFDyyqPVG9Q4F/ZcGYfPnaFFScI3rslX2ZK5rhel9Q/nW6snWENKYxZFuZXv9u0d+++ 5IELeJOQ2gwKvwSt+Ho2LmBX8o11fUN/Ejqn7Fa+1FT7gfJbSB1dtnrgRdDZz9tNUA1I owrfRIIhgpGVqWB6wbmab18zagQCn7sp61+V7NBOC/yrU3XpDAP6dKw0QT3vTFL9zg0u fbVw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=Og2qwT9BdQ4rmx69WidXs09mKQ/R1nn/AForRblNkDM=; b=E8OXEbHviP9PyKMC4aF7QUk/8uK618K7nEZBk5RLObESPApSBe1qrhn9RCp1Q5+CX3 hRTf78bI5brZFJsMyoy2zyMAQVDgsy78wgAfjY4QlJTxeQk8LZw+b9lGDDLLYAhIvYRn ofh9ZiP/mvpYUKqjxD5ZDwXNUPIhUVYJIQNd6G/Vp6y/8s01FNHLr9CntUrZ8MToA72C Zp9BZklqhF8zX+vHcHfX+W0Pbi4e0hRa7BEZN2MPa77esYWr1ncngNToVREd8YHw1doY HlW4sp9uMF1Kj03OycE/7uy4keaYVKwelst+YnyNt/7u34Py59D1W4a3059MpIrEXvvH 2a8Q== X-Gm-Message-State: APjAAAUmIASiwLohlyzzTA3oec5KY9ufIlzzaDPo/acn3EoJMCzEFN69 QF3P/cpQbEG+zqOOwaqFhhIhgo+IuE291ohLYsg= X-Received: by 2002:a2e:9c10:: with SMTP id s16mr4385917lji.20.1553237424545; Thu, 21 Mar 2019 23:50:24 -0700 (PDT) MIME-Version: 1.0 References: <20190320204255.53571-1-cai@lca.pw> In-Reply-To: <20190320204255.53571-1-cai@lca.pw> From: Souptick Joarder Date: Fri, 22 Mar 2019 12:20:12 +0530 Message-ID: Subject: Re: [RESEND PATCH] mm/hotplug: fix notification in offline error path To: Qian Cai Cc: Andrew Morton , Michal Hocko , osalvador@suse.de, anshuman.khandual@arm.com, Linux-MM , linux-kernel@vger.kernel.org, stable@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Mar 21, 2019 at 2:13 AM Qian Cai wrote: > > When start_isolate_page_range() returned -EBUSY in __offline_pages(), it > calls memory_notify(MEM_CANCEL_OFFLINE, &arg) with an uninitialized > "arg". As the result, it triggers warnings below. Also, it is only > necessary to notify MEM_CANCEL_OFFLINE after MEM_GOING_OFFLINE. For my clarification, if test_pages_in_a_zone() failed in __offline_pages(), we have the similar scenario as well. If yes, do we need to capture it in change log ? > > page:ffffea0001200000 count:1 mapcount:0 mapping:0000000000000000 > index:0x0 > flags: 0x3fffe000001000(reserved) > raw: 003fffe000001000 ffffea0001200008 ffffea0001200008 0000000000000000 > raw: 0000000000000000 0000000000000000 00000001ffffffff 0000000000000000 > page dumped because: unmovable page > WARNING: CPU: 25 PID: 1665 at mm/kasan/common.c:665 > kasan_mem_notifier+0x34/0x23b > CPU: 25 PID: 1665 Comm: bash Tainted: G W 5.0.0+ #94 > Hardware name: HP ProLiant DL180 Gen9/ProLiant DL180 Gen9, BIOS U20 > 10/25/2017 > RIP: 0010:kasan_mem_notifier+0x34/0x23b > RSP: 0018:ffff8883ec737890 EFLAGS: 00010206 > RAX: 0000000000000246 RBX: ff10f0f4435f1000 RCX: f887a7a21af88000 > RDX: dffffc0000000000 RSI: 0000000000000020 RDI: ffff8881f221af88 > RBP: ffff8883ec737898 R08: ffff888000000000 R09: ffffffffb0bddcd0 > R10: ffffed103e857088 R11: ffff8881f42b8443 R12: dffffc0000000000 > R13: 00000000fffffff9 R14: dffffc0000000000 R15: 0000000000000000 > CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 > CR2: 0000560fbd31d730 CR3: 00000004049c6003 CR4: 00000000001606a0 > Call Trace: > notifier_call_chain+0xbf/0x130 > __blocking_notifier_call_chain+0x76/0xc0 > blocking_notifier_call_chain+0x16/0x20 > memory_notify+0x1b/0x20 > __offline_pages+0x3e2/0x1210 > offline_pages+0x11/0x20 > memory_block_action+0x144/0x300 > memory_subsys_offline+0xe5/0x170 > device_offline+0x13f/0x1e0 > state_store+0xeb/0x110 > dev_attr_store+0x3f/0x70 > sysfs_kf_write+0x104/0x150 > kernfs_fop_write+0x25c/0x410 > __vfs_write+0x66/0x120 > vfs_write+0x15a/0x4f0 > ksys_write+0xd2/0x1b0 > __x64_sys_write+0x73/0xb0 > do_syscall_64+0xeb/0xb78 > entry_SYSCALL_64_after_hwframe+0x44/0xa9 > RIP: 0033:0x7f14f75cc3b8 > RSP: 002b:00007ffe84d01d68 EFLAGS: 00000246 ORIG_RAX: 0000000000000001 > RAX: ffffffffffffffda RBX: 0000000000000008 RCX: 00007f14f75cc3b8 > RDX: 0000000000000008 RSI: 0000563f8e433d70 RDI: 0000000000000001 > RBP: 0000563f8e433d70 R08: 000000000000000a R09: 00007ffe84d018f0 > R10: 000000000000000a R11: 0000000000000246 R12: 00007f14f789e780 > R13: 0000000000000008 R14: 00007f14f7899740 R15: 0000000000000008 > > Fixes: 7960509329c2 ("mm, memory_hotplug: print reason for the offlining failure") > CC: stable@vger.kernel.org # 5.0.x > Reviewed-by: Oscar Salvador > Acked-by: Michal Hocko > Signed-off-by: Qian Cai > --- > mm/memory_hotplug.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c > index 0e0a16021fd5..0082d699be94 100644 > --- a/mm/memory_hotplug.c > +++ b/mm/memory_hotplug.c > @@ -1699,12 +1699,12 @@ static int __ref __offline_pages(unsigned long start_pfn, > > failed_removal_isolated: > undo_isolate_page_range(start_pfn, end_pfn, MIGRATE_MOVABLE); > + memory_notify(MEM_CANCEL_OFFLINE, &arg); > failed_removal: > pr_debug("memory offlining [mem %#010llx-%#010llx] failed due to %s\n", > (unsigned long long) start_pfn << PAGE_SHIFT, > ((unsigned long long) end_pfn << PAGE_SHIFT) - 1, > reason); > - memory_notify(MEM_CANCEL_OFFLINE, &arg); > /* pushback to free area */ > mem_hotplug_done(); > return ret; > -- > 2.17.2 (Apple Git-113) >