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=-4.0 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_PASS autolearn=ham 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 23AF9C43381 for ; Thu, 14 Mar 2019 14:12:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id ECF292085A for ; Thu, 14 Mar 2019 14:12:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727569AbfCNOMu (ORCPT ); Thu, 14 Mar 2019 10:12:50 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:45256 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726875AbfCNOMt (ORCPT ); Thu, 14 Mar 2019 10:12:49 -0400 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 4017E80D; Thu, 14 Mar 2019 07:12:49 -0700 (PDT) Received: from [10.37.12.84] (unknown [10.37.12.84]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id CAC713F59C; Thu, 14 Mar 2019 07:12:45 -0700 (PDT) Subject: Re: [Xen-devel] xen: Can't insert balloon page into VM userspace (WAS Re: [linux-linus bisection] complete test-arm64-arm64-xl-xsm) To: Juergen Gross , David Hildenbrand , Boris Ostrovsky , Andrew Cooper , Matthew Wilcox Cc: k.khlebnikov@samsung.com, Stefano Stabellini , Kees Cook , Konrad Rzeszutek Wilk , "VMware, Inc." , osstest service owner , "linux-kernel@vger.kernel.org" , linux-mm@kvack.org, Julien Freche , Nadav Amit , xen-devel@lists.xenproject.org References: <80211e70-5f54-9421-8e8f-2a4fc758ce39@arm.com> <46118631-61d4-adb6-6ffc-4e7c62ea3da9@arm.com> <20190312171421.GJ19508@bombadil.infradead.org> <45323ea0-2a50-8891-830e-e1f8a8ed23ea@citrix.com> <9a40e1ff-7605-e822-a1d2-502a12d0fba7@redhat.com> <6f8aca6c-355b-7862-75aa-68fe566f76fb@redhat.com> From: Julien Grall Message-ID: Date: Thu, 14 Mar 2019 14:12:43 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.5.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed 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 Hi, On 3/14/19 8:37 AM, Juergen Gross wrote: > On 12/03/2019 20:46, David Hildenbrand wrote: >> On 12.03.19 19:23, David Hildenbrand wrote: >> >> I guess something like this could do the trick if I understood it correctly: >> >> diff --git a/drivers/xen/balloon.c b/drivers/xen/balloon.c >> index 39b229f9e256..d37dd5bb7a8f 100644 >> --- a/drivers/xen/balloon.c >> +++ b/drivers/xen/balloon.c >> @@ -604,6 +604,7 @@ int alloc_xenballooned_pages(int nr_pages, struct >> page **pages) >> while (pgno < nr_pages) { >> page = balloon_retrieve(true); >> if (page) { >> + __ClearPageOffline(page); >> pages[pgno++] = page; >> #ifdef CONFIG_XEN_HAVE_PVMMU >> /* >> @@ -645,8 +646,10 @@ void free_xenballooned_pages(int nr_pages, struct >> page **pages) >> mutex_lock(&balloon_mutex); >> >> for (i = 0; i < nr_pages; i++) { >> - if (pages[i]) >> + if (pages[i]) { >> + __SetPageOffline(pages[i]); >> balloon_append(pages[i]); >> + } >> } >> >> balloon_stats.target_unpopulated -= nr_pages; >> >> >> At least this way, the pages allocated (and thus eventually mapped to >> user space) would not be marked, but the other ones would remain marked >> and could be excluded by makedumptool. >> > > I think this patch should do the trick. Julien, could you give it a > try? On x86 I can't reproduce your problem easily as dom0 is PV with > plenty of unpopulated pages for grant memory not suffering from > missing "offline" bit. Sure. I managed to get the console working with the patch suggested by David. Feel free to add my tested-by if when you resend it as is. Cheers, -- Julien Grall