From patchwork Wed Sep 13 15:32:42 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Rzeszutek Wilk X-Patchwork-Id: 9951757 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 904D460245 for ; Wed, 13 Sep 2017 17:40:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7AAF528113 for ; Wed, 13 Sep 2017 17:40:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6F6DD286EE; Wed, 13 Sep 2017 17:40:14 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id E4A9F28113 for ; Wed, 13 Sep 2017 17:40:13 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dsBby-0005EV-IO; Wed, 13 Sep 2017 17:38:06 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dsBbx-0005E6-Sx for xen-devel@lists.xenproject.org; Wed, 13 Sep 2017 17:38:06 +0000 Received: from [85.158.137.68] by server-6.bemta-3.messagelabs.com id 26/91-02225-DFC69B95; Wed, 13 Sep 2017 17:38:05 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrPIsWRWlGSWpSXmKPExsUyZ7p8oO6fnJ2 RBsv+ylp83zKZyYHR4/CHKywBjFGsmXlJ+RUJrBlzHn5lLHgmUPHxxQ+mBsZe3i5GLg4hgclM EvvWrmCDcP4ySuy4spqpi5ETyNnAKHFpnSBEoptR4uLLKYwQiSKJ3tbtzCA2i4CqxO2Jnexdj BwcbAImEm9WOYKERQQMJN5fnwQ2lFlgGaPE1mvTwOqFBUIkvnWfArN5BcwlZn5uYIdYcJ5R4k zTS1aIhKDEyZlPWEBsZgEtiRv/XjKBLGAWkJZY/o8DJMwpYCexf/UasBJRAWWJeftWsYHYEgL GEu1vL7JNYBSahWTSLCSTZiFMWsDIvIpRozi1qCy1SNfIVC+pKDM9oyQ3MTNH19DAWC83tbg4 MT01JzGpWC85P3cTIzCg6xkYGHcwtp7wO8QoycGkJMq7V3dnpBBfUn5KZUZicUZ8UWlOavEhR hkODiUJXgVghAgJFqWmp1akZeYAYwsmLcHBoyTC+zMbKM1bXJCYW5yZDpE6xagoJc77FyQhAJ LIKM2Da4PF8yVGWSlhXkYGBgYhnoLUotzMElT5V4ziHIxKwrzWINt5MvNK4Ka/AlrMBLT4zOk dIItLEhFSUg2MZa6XP25Ye7eujffxqWX5PtWzTDTUAivYr77Qrl+pfnh1hy9j5VT9mSVStmK3 2c37XA5xv9mfvePRaieNuSK9jNcr2DRLnxtMm6/rNivrnqgS/94jj9tbXCantx0MZkp83in/9 O+HxTqX9kRUGM9f6Ts/YLfSkmu1jyMsenRsAqSvJ3YqC/xQYinOSDTUYi4qTgQAnWZDIeICAA A= X-Env-Sender: konrad.wilk@oracle.com X-Msg-Ref: server-13.tower-31.messagelabs.com!1505324282!110082101!1 X-Originating-IP: [156.151.31.81] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogMTU2LjE1MS4zMS44MSA9PiAyODgzMzk=\n X-StarScan-Received: X-StarScan-Version: 9.4.45; banners=-,-,- X-VirusChecked: Checked Received: (qmail 60619 invoked from network); 13 Sep 2017 17:38:04 -0000 Received: from userp1040.oracle.com (HELO userp1040.oracle.com) (156.151.31.81) by server-13.tower-31.messagelabs.com with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 13 Sep 2017 17:38:04 -0000 Received: from aserv0022.oracle.com (aserv0022.oracle.com [141.146.126.234]) by userp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id v8DHbs5w029075 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 13 Sep 2017 17:37:55 GMT Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by aserv0022.oracle.com (8.14.4/8.14.4) with ESMTP id v8DHbsEd022725 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 13 Sep 2017 17:37:54 GMT Received: from ubhmp0006.oracle.com (ubhmp0006.oracle.com [156.151.24.59]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id v8DHbrA0017491; Wed, 13 Sep 2017 17:37:53 GMT Received: from char.us.oracle.com (/10.137.176.158) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 13 Sep 2017 17:37:52 +0000 Received: by char.us.oracle.com (Postfix, from userid 1000) id 81FF66A0A50; Wed, 13 Sep 2017 11:32:42 -0400 (EDT) Date: Wed, 13 Sep 2017 11:32:42 -0400 From: Konrad Rzeszutek Wilk To: Boris Ostrovsky Message-ID: <20170913153242.GA11299@char.us.oracle.com> References: <20170911235520.GA30969@localhost.localdomain> <7b76a7a2-90fd-f016-53b0-a36ef68ba1a4@oracle.com> <20170913000147.GA6632@localhost.localdomain> <3d92481c-bdfb-f46a-cc52-c8d3e820d9b2@oracle.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <3d92481c-bdfb-f46a-cc52-c8d3e820d9b2@oracle.com> User-Agent: Mutt/1.8.3 (2017-05-23) X-Source-IP: aserv0022.oracle.com [141.146.126.234] Cc: dario.faggioli@citrix.com, sstabellini@kernel.org, julien.grall@arm.com, xen-devel@lists.xenproject.org Subject: Re: [Xen-devel] CONFIG_SCRUB_DEBUG=y + arm64 + livepatch = Xen BUG at page_alloc.c:738 X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP On Tue, Sep 12, 2017 at 09:19:23PM -0400, Boris Ostrovsky wrote: > > > On 09/12/2017 08:01 PM, Konrad Rzeszutek Wilk wrote: > > On Mon, Sep 11, 2017 at 08:45:02PM -0400, Boris Ostrovsky wrote: > > > > > > > > > On 09/11/2017 07:55 PM, Konrad Rzeszutek Wilk wrote: > > > > Hey, > > > > > > > > I've only been able to reproduce this on ARM64 (trying right now ARM32 > > > > as well), and not on x86. > > > > > > > > If I compile Xen without CONFIG_SCRUB_DEBUG it works great. But if > > > > enable it and try to load a livepatch it blows up in page_alloc.c:738 > > > > > > > > This is with origin/staging (d0291f3391) > > > > > > Can you still reproduce this if you revert 307c3be? > > > > Sadly yes - it still crashes. I didn't capture the serial output. > > > > I honestly think the issue is that on ARM64 the "sleep" loop does not > > wake up as often as on x86 (CC-ing Dariof who I believe observed this > > with Credit2 and the wakeup.. something) - maybe he remembers the > > details. Anyhow my theory is that the pages are not scrubbed at all > > when they go in the idle loop as once it goes to sleep - it stays there. > > > There is no (well, should not be) any timing dependencies in how/whether > pages are scrubbed. If a page doesn't get scrubbed because someone didn't > wake up then it should be scrubbed in alloc_heap_pages(). So in this case > the page is thought to be clean (_PGC_need_scrub is not set), but it is not. > > Have you tried running a guest (or two), rebooting in a loop? No. I just cold-booted it and tried to livepatch. > > Another thing to try is to set need_scrub to true in free_heap_pages(). Magic! Fixes it ! :-) > > -boris > > > > > > Ah, see commit 05c52278a7c92bc753d9fe32017e4961012b9f23 > > > > Maybe this is related? > > > > > > > > > -boris diff --git a/xen/common/page_alloc.c b/xen/common/page_alloc.c index dbad1e1ca0..9303eb4517 100644 --- a/xen/common/page_alloc.c +++ b/xen/common/page_alloc.c @@ -1308,6 +1308,7 @@ static void free_heap_pages( ASSERT(node >= 0); spin_lock(&heap_lock); + need_scrub = true; for ( i = 0; i < (1 << order); i++ ) {