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=-7.3 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,USER_AGENT_SANE_1 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 27019C433FE for ; Wed, 9 Dec 2020 19:09:04 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A44E423B6B for ; Wed, 9 Dec 2020 19:09:03 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A44E423B6B Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=citrix.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from list by lists.xenproject.org with outflank-mailman.48675.86093 (Exim 4.92) (envelope-from ) id 1kn4pW-000719-Cf; Wed, 09 Dec 2020 19:08:50 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 48675.86093; Wed, 09 Dec 2020 19:08:50 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kn4pW-000712-9l; Wed, 09 Dec 2020 19:08:50 +0000 Received: by outflank-mailman (input) for mailman id 48675; Wed, 09 Dec 2020 19:08:48 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kn4pU-00070x-EQ for xen-devel@lists.xenproject.org; Wed, 09 Dec 2020 19:08:48 +0000 Received: from esa3.hc3370-68.iphmx.com (unknown [216.71.145.155]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 64b4a243-ab89-4819-bf98-5e65025b038c; Wed, 09 Dec 2020 19:08:46 +0000 (UTC) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 64b4a243-ab89-4819-bf98-5e65025b038c DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1607540926; h=subject:to:cc:references:from:message-id:date: mime-version:in-reply-to:content-transfer-encoding; bh=pqv5EwtNQMm9dZ0BSNuE7TLRoytgQKnF5xXuDVOERBo=; b=QUyBwkLZrVKBu1MI5t0E24Xc5r+b69mwshLKGnDHNomVed7amv1KJdyz dweKVqNjqMP6QUGG+hFtIwoXv4jABfNqZOzadeBeCLT17sNjE34WIkXjR tbZUH0ScSCLCr3q4ZO/A3ClD+Y4JRTePW72jV0SWjtC+FKWO2SjSucGFe E=; Authentication-Results: esa3.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none IronPort-SDR: X08dhlGsZJzVr+2U3hZEPgxrgbT9Qom8oXWRH+8ryl9HtCOkAvvEKH6bAPOxZzPhl9UGzNuHl5 J/EKh6zQTfSNuwYYUniak5pZx0MjmntKcoQvU4EMgkDKFLGix57rwJxhVvxAAmpnyHDRBIzHbE S2oEMQIiQwzeaHXuOUkcIlwd+8z8x/gS4fc5k+vVRcnPjyqbV/wIwk7zBUt8JZwKsKKl/38kSu KqfCWqaSMns5eVvAO+QrLfFpgNzFlEXKU7hU00QBGhP/uBmnGcA9OZjvHfT2JWbiJw/Kp4DW/A cmU= X-SBRS: 5.2 X-MesageID: 32863393 X-Ironport-Server: esa3.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.78,405,1599537600"; d="scan'208";a="32863393" Subject: Re: dom0 PV looping on search_pre_exception_table() To: Manuel Bouyer CC: References: <20201208175738.GA3390@antioche.eu.org> <20201209101512.GA1299@antioche.eu.org> <3f7e50bb-24ad-1e32-9ea1-ba87007d3796@citrix.com> <20201209135908.GA4269@antioche.eu.org> <20201209154431.GA4913@antioche.eu.org> <52e1b10d-75d4-63ac-f91e-cb8f0dcca493@citrix.com> <20201209163049.GA6158@antioche.eu.org> <30a71c9d-3eff-3727-9c61-e387b5bccc95@citrix.com> <20201209185714.GS1469@antioche.eu.org> From: Andrew Cooper Message-ID: <6c06abf1-7efe-f02c-536a-337a2704e265@citrix.com> Date: Wed, 9 Dec 2020 19:08:41 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <20201209185714.GS1469@antioche.eu.org> Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Content-Language: en-GB X-ClientProxiedBy: AMSPEX02CAS01.citrite.net (10.69.22.112) To FTLPEX02CL04.citrite.net (10.13.108.177) On 09/12/2020 18:57, Manuel Bouyer wrote: > On Wed, Dec 09, 2020 at 06:08:53PM +0000, Andrew Cooper wrote: >> On 09/12/2020 16:30, Manuel Bouyer wrote: >>> On Wed, Dec 09, 2020 at 04:00:02PM +0000, Andrew Cooper wrote: >>>> [...] >>>>>> I wonder if the LDT is set up correctly. >>>>> I guess it is, otherwise it wouldn't boot with a Xen 4.13 kernel, isn't it ? >>>> Well - you said you always saw it once on 4.13, which clearly shows that >>>> something was wonky, but it managed to unblock itself. >>>> >>>>>> How about this incremental delta? >>>>> Here's the output >>>>> (XEN) IRET fault: #PF[0000] >>>>> (XEN) %cr2 ffff820000010040, LDT base ffffc4800000a000, limit 0057 >>>>> (XEN) *** pv_map_ldt_shadow_page(0x40) failed >>>>> (XEN) IRET fault: #PF[0000] >>>>> (XEN) %cr2 ffff820000010040, LDT base ffffc4800000a000, limit 0057 >>>>> (XEN) *** pv_map_ldt_shadow_page(0x40) failed >>>>> (XEN) IRET fault: #PF[0000] >>>> Ok, so the promotion definitely fails, but we don't get as far as >>>> inspecting the content of the LDT frame.  This probably means it failed >>>> to change the page type, which probably means there are still >>>> outstanding writeable references. >>>> >>>> I'm expecting the final printk to be the one which triggers. >>> It's not. >>> Here's the output: >>> (XEN) IRET fault: #PF[0000] >>> (XEN) %cr2 ffff820000010040, LDT base ffffbd000000a000, limit 0057 >>> (XEN) *** LDT: gl1e 0000000000000000 not present >>> (XEN) *** pv_map_ldt_shadow_page(0x40) failed >>> (XEN) IRET fault: #PF[0000] >>> (XEN) %cr2 ffff820000010040, LDT base ffffbd000000a000, limit 0057 >>> (XEN) *** LDT: gl1e 0000000000000000 not present >>> (XEN) *** pv_map_ldt_shadow_page(0x40) failed >> Ok.  So the mapping registered for the LDT is not yet present.  Xen >> should be raising #PF with the guest, and would be in every case other >> than the weird context on IRET, where we've confused bad guest state >> with bad hypervisor state. > Unfortunably it doesn't fix the problem. I'm now getting a loop of > (XEN) *** LDT: gl1e 0000000000000000 not present > (XEN) *** pv_map_ldt_shadow_page(0x40) failed Oh of course - we don't follow the exit-to-guest path on the way out here. As a gross hack to check that we've at least diagnosed the issue appropriately, could you modify NetBSD to explicitly load the %ss selector into %es (or any other free segment) before first entering user context? If it a sequence of LDT demand-faulting issues, that should cause them to be fully resolved before Xen's IRET becomes the first actual LDT load. ~Andrew