Received: by 2002:a05:6a10:a852:0:0:0:0 with SMTP id d18csp1703802pxy; Sat, 1 May 2021 23:37:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJygvTC8Ib6kASiU9x5JOABEESclbxL27kQ0Mp/36ZhovUF+o2kIrDf4V2g04aXiKzlMuRx+ X-Received: by 2002:a17:906:144d:: with SMTP id q13mr12179026ejc.458.1619937444667; Sat, 01 May 2021 23:37:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619937444; cv=none; d=google.com; s=arc-20160816; b=H9eScwVxv6BWKar510Wa3fXsxObjDLQ1WzFNe11XP9UJU//U2m5PBF/sMEH/H47hw0 Hup1nPeIBYywk8WpK2et+oty1VhJ+u3eePBWiqdMKkNg2aUesPx3KHmatpsci0L6tCdk m4VXQ/rGgMqbnZxS0KIWIPZymM0jG3e6fu3SR2hsy2lamNuruP5JjArZCe2BU392LSiY hDeTOdgJhEMnAYKUq3MHBh5GzKdyAj18XpIdBimM4znOUZtDtsvwBqAGj5OWZx0wez0c qqIPMc578LOoJeQvcRWgihLq+xHt5gi8nuYf7Lku9Ghpg54E1Un9i98MyFn+jZBRe62K 5SDA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=M+zFS3XTfwETldlugYKfj6g0s9RQnS8xcYsFYCFIXIo=; b=B9uidBSFs2Z4Eo0qD+4F1l3tzgl9dNwWZPCBo/4gApEXCgKiQnSOt5EgoMXv2Q9QlT l4sXvny/lGYUvsofEAVsV5kRCeCPCH/Blo8rj5/m+KBCwAt7BqW5qweNh8JHGt7l9hOX KpfM1hx68n+OcLbKcbFY/p1j3K4YD2xGV4lQ0SAwVlabJTwPGXjNa3mjMNp4Okb/s4J1 7ZScduB/ZXS42c8+d1MrSPB6qNH42n0dhDOOXDXzNmAuiJeLJ2FCAk+2zWVNZgApaltB nt4hmRqAs19qc/pAa0cElT7Or7fW4DEay+3qWwY0FVHvzelC9I93SJ+vM4RQ+0zuifRu ZviA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Odz+FaFl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id cq3si6030468edb.257.2021.05.01.23.37.02; Sat, 01 May 2021 23:37:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Odz+FaFl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230322AbhEBGex (ORCPT + 99 others); Sun, 2 May 2021 02:34:53 -0400 Received: from mail.kernel.org ([198.145.29.99]:60816 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229526AbhEBGex (ORCPT ); Sun, 2 May 2021 02:34:53 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 3CC7261466; Sun, 2 May 2021 06:33:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1619937242; bh=sp3LzQWqlyVK4KqVpRuyYmKMW2WBVY2bQhDsFYs/JIU=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Odz+FaFlS7Sa3nPJIMJtdmYFisF2DcMTFwlRGMlogH6i4gHeAtklI1v2fhZIXTmyc VuFnMOOPLD0PaTc3cOr5bXpQNtPH/ZQNyUb4rcYRMsxlM5/W2AF+Lr3lixJnqxOjEr gyiSKc8Aa08xobgVpGpW+kh4o5BiUaPrz0nMUFCWJs13RkCGKFcE8LyYt9435lHrDS DSzMzzzjH8RcT0hk5E85ykiiri3zuPSy/c9m+xw7Eb039FWlr5GLmwcfDhdU5D/uFv 1SoDcEE1lUM3Uf/+yRjzrpDZEmHbwWJlB6CCX7LZXOpMIm2v61B9HuchJWShkYQl55 L8kISYHyIFR7g== Date: Sun, 2 May 2021 09:33:49 +0300 From: Mike Rapoport To: David Hildenbrand Cc: linux-kernel@vger.kernel.org, Andrew Morton , "Michael S. Tsirkin" , Jason Wang , Alexey Dobriyan , "Matthew Wilcox (Oracle)" , Oscar Salvador , Michal Hocko , Roman Gushchin , Alex Shi , Steven Price , Mike Kravetz , Aili Yao , Jiri Bohac , "K. Y. Srinivasan" , Haiyang Zhang , Stephen Hemminger , Wei Liu , Naoya Horiguchi , linux-hyperv@vger.kernel.org, virtualization@lists.linux-foundation.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org Subject: Re: [PATCH v1 6/7] virtio-mem: use page_offline_(start|end) when setting PageOffline() Message-ID: References: <20210429122519.15183-1-david@redhat.com> <20210429122519.15183-7-david@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210429122519.15183-7-david@redhat.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Apr 29, 2021 at 02:25:18PM +0200, David Hildenbrand wrote: > Let's properly use page_offline_(start|end) to synchronize setting > PageOffline(), so we won't have valid page access to unplugged memory > regions from /proc/kcore. > > Signed-off-by: David Hildenbrand > --- > drivers/virtio/virtio_mem.c | 2 ++ > mm/util.c | 2 ++ > 2 files changed, 4 insertions(+) > > diff --git a/drivers/virtio/virtio_mem.c b/drivers/virtio/virtio_mem.c > index 10ec60d81e84..dc2a2e2b2ff8 100644 > --- a/drivers/virtio/virtio_mem.c > +++ b/drivers/virtio/virtio_mem.c > @@ -1065,6 +1065,7 @@ static int virtio_mem_memory_notifier_cb(struct notifier_block *nb, > static void virtio_mem_set_fake_offline(unsigned long pfn, > unsigned long nr_pages, bool onlined) > { > + page_offline_begin(); > for (; nr_pages--; pfn++) { > struct page *page = pfn_to_page(pfn); > > @@ -1075,6 +1076,7 @@ static void virtio_mem_set_fake_offline(unsigned long pfn, > ClearPageReserved(page); > } > } > + page_offline_end(); I'm not really familiar with ballooning and memory hotplug, but is it the only place that needs page_offline_{begin,end} ? > } > > /* > diff --git a/mm/util.c b/mm/util.c > index 95395d4e4209..d0e357bd65e6 100644 > --- a/mm/util.c > +++ b/mm/util.c > @@ -1046,8 +1046,10 @@ void page_offline_begin(void) > { > down_write(&page_offline_rwsem); > } > +EXPORT_SYMBOL(page_offline_begin); Should have been a part of the previous patch. > void page_offline_end(void) > { > up_write(&page_offline_rwsem); > } > +EXPORT_SYMBOL(page_offline_end); Ditto > -- > 2.30.2 > -- Sincerely yours, Mike.