From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6DE8DC433DB for ; Fri, 26 Mar 2021 15:43:52 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id BC4C26192B for ; Fri, 26 Mar 2021 15:43:51 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BC4C26192B Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=suse.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 3A2426B006C; Fri, 26 Mar 2021 11:43:51 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 376476B006E; Fri, 26 Mar 2021 11:43:51 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 23EE06B0070; Fri, 26 Mar 2021 11:43:51 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0031.hostedemail.com [216.40.44.31]) by kanga.kvack.org (Postfix) with ESMTP id 09C096B006C for ; Fri, 26 Mar 2021 11:43:51 -0400 (EDT) Received: from smtpin05.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id B2D1FB7B0 for ; Fri, 26 Mar 2021 15:43:50 +0000 (UTC) X-FDA: 77962445820.05.764C683 Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by imf19.hostedemail.com (Postfix) with ESMTP id B2D0E9001151 for ; Fri, 26 Mar 2021 15:43:38 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1616772666; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=l85zI45pbuMWoAzo0p6ErM5hujVeJN58V0g4dKqDYX0=; b=qYtYmd+SLUuGER2fN/XkEBE/ShbUtbsYenhkTWB0XfZVa7WFtv0e6ydialAj50NSX4ji84 7CYO8J0TfRMqDrCKDXylc7YQlESNTYnMl+i+sluxnohZunFpPfJPT9i+CjV4L3JzYWBG6i O1Hv9sNg5pfblfgZFqMJHbw5aKHraOA= Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 3EF78AD8D; Fri, 26 Mar 2021 15:31:06 +0000 (UTC) Date: Fri, 26 Mar 2021 16:31:05 +0100 From: Michal Hocko To: David Hildenbrand Cc: Oscar Salvador , Andrew Morton , Anshuman Khandual , Vlastimil Babka , Pavel Tatashin , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v5 1/5] mm,memory_hotplug: Allocate memmap from the added memory range Message-ID: References: <92fe19d0-56ac-e929-a9c1-d6a4e0da39d1@redhat.com> <5be95091-b4ac-8e05-4694-ac5c65f790a4@redhat.com> <0e735ea7-b3d9-615e-6bba-fa3a16883226@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <0e735ea7-b3d9-615e-6bba-fa3a16883226@redhat.com> X-Stat-Signature: rjw8kzbtb7gecqxsre81toigqa54iqbg X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: B2D0E9001151 Received-SPF: none (suse.com>: No applicable sender policy available) receiver=imf19; identity=mailfrom; envelope-from=""; helo=mx2.suse.de; client-ip=195.135.220.15 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1616773418-978052 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Fri 26-03-21 15:53:41, David Hildenbrand wrote: > On 26.03.21 15:38, Michal Hocko wrote: > > On Fri 26-03-21 09:52:58, David Hildenbrand wrote: [...] > > > 2. We won't allocate kasan shadow memory. We most probably have to do it > > > explicitly via kasan_add_zero_shadow()/kasan_remove_zero_shadow(), see > > > mm/memremap.c:pagemap_range() > > > > I think this is similar to the above. Does kasan has to know about > > memory which will never be used for anything? > > IIRC, kasan will track read/writes to the vmemmap as well. So it could > theoretically detect if we read from the vmemmap before writing > (initializing) it IIUC. > This is also why mm/memremap.c does a kasan_add_zero_shadow() before the > move_pfn_range_to_zone()->memmap_init_range() for the whole region, > including altmap space. > > Now, I am no expert on KASAN, what would happen in case we have access to > non-tracked memory. > > commit 0207df4fa1a869281ddbf72db6203dbf036b3e1a > Author: Andrey Ryabinin > Date: Fri Aug 17 15:47:04 2018 -0700 > > kernel/memremap, kasan: make ZONE_DEVICE with work with KASAN > > indicates that kasan will crash the system on "non-existent shadow memory" Interesting. Thanks for the pointer. > > > Further a locking rework might be necessary. We hold the device hotplug > > > lock, but not the memory hotplug lock. E.g., for get_online_mems(). Might > > > have to move that out online_pages. > > > > Could you be more explicit why this locking is needed? What it would > > protect from for vmemmap pages? > > > > One example is in mm/kmemleak.c:kmemleak_scan(), where we scan the vmemmap > for pointers. We don't want the vmemmap to get unmapped while we are working > on it (-> fault). Hmm, but they are not going away during offline. They just have a less defined state. Or what exactly do you mean by unmapped? -- Michal Hocko SUSE Labs