Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp6928723imm; Tue, 24 Jul 2018 05:43:49 -0700 (PDT) X-Google-Smtp-Source: AAOMgpd34vUbP75v52Wu/SKNNf7yDzEOoWqxsN1r1RAfApxnuOWE8ddsuEOIFkVyctsZhcvRJ8B5 X-Received: by 2002:a63:7a43:: with SMTP id j3-v6mr16051683pgn.363.1532436229895; Tue, 24 Jul 2018 05:43:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532436229; cv=none; d=google.com; s=arc-20160816; b=gknwSiEwliP0WKLlDiJBG52xtCTXtzybHbUmo+xS1Yvo31S44fmd+YXpFkb/mMUZMR X7LLAqKtmAjnPI9Yi20d1DnaOt2AXdFrmpFPR/7XeTqM9XIIFuPdjCkb3olAdIhla1O3 I4F5TemgsbUFKK+hcU8O3tIdD5IzJ2NETK+Fb7UDDv+bYJ/QI+xm0oSeTI7B5sArq+xe ByIMPLOOKpL/K3ZQT36aoeuRygl/cd08quf63M/x6yUiOoik+xAtY7eBgWlEqlB1KiKn 5xjcveUbLGh5rvF9ifhs7l478+tnumN6z2VglfYXxHrJx4/1/KEh8/7kmTyIei3IbySL kqmA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature :arc-authentication-results; bh=0By32EOjOrZPnFmL5TblDwLA9GgGrbmlPdx21rwlB/w=; b=yEv+qdBHPNDC+VA67DOqurVG+9rNoGzDQZNcaxpdR00cZilnmJY3euKKrbPJ5ewLSV +6BOSbzEIOTAYGJG61DjB5pZoufXOVUYIOzLZO/qZ2UKi693hI6nRfy5e39z2m3oLhot UN4mIK8pNwgLC6s42PBduT48VwwzkGbMbyVG5aFER9q8jm/FojEIS0vh4xMtJgQs74B+ 9DowhshZkClxpeIRP8uWnmPMTWESSN8fsiZ3LjjfMd7/Hg2zKtaBK+l/ohfYvV9tSydm eoWOnwIUuq1H7g7J9nEHNX1s71BFPusiuTAbykPksvCjlrnEyhZyHK2cXYK0c3ukz7gm RlGw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@runbox.com header.s=rbselector1 header.b=Tm8ULAOL; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 91-v6si10270438ply.296.2018.07.24.05.43.34; Tue, 24 Jul 2018 05:43:49 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@runbox.com header.s=rbselector1 header.b=Tm8ULAOL; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727673AbeGXNtD (ORCPT + 99 others); Tue, 24 Jul 2018 09:49:03 -0400 Received: from aibo.runbox.com ([91.220.196.211]:36844 "EHLO aibo.runbox.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726270AbeGXNtC (ORCPT ); Tue, 24 Jul 2018 09:49:02 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=runbox.com; s=rbselector1; h=Content-Transfer-Encoding:Content-Type:In-Reply-To: MIME-Version:Date:Message-ID:From:References:Cc:To:Subject; bh=0By32EOjOrZPnFmL5TblDwLA9GgGrbmlPdx21rwlB/w=; b=Tm8ULAOL8lcSWyCPijnG2GS45A 1NcaOWnRsyD8H8J4XJvKJrun8CAPoFKftK7EiJ3/gzYmtYOizv4CUFbYJsLePAUhcBXUvZJ82jWJz Hcto6kMhFpnxgUe5rMNF9zDc/XdJm6yz1HI3AOgOhIyH00pxgyrb7lR/DfdFqJTlFzYi6Iuw813KT a11pTpFJJtxYpzbdMQpxJhwAlqAYNiSNYa4TXigHgVM12EiIrMc3Y/SebPZpdiYmkg/RYS/mF/F+X /Gd4ylkyKYU6ys+dt6rljuzYz/PMbJqe0+MCOXquPVVwNzGKxyuWvpUBJNDMOzm77NyjQ8b0wYmvt b2Ux6xKA==; Received: from [10.9.9.210] (helo=mailfront10.runbox.com) by mailtransmit03.runbox with esmtp (Exim 4.86_2) (envelope-from ) id 1fhweE-00080x-GE; Tue, 24 Jul 2018 14:42:38 +0200 Received: by mailfront10.runbox.com with esmtpsa (uid:769847 ) (TLS1.2:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.82) id 1fhwe9-0005TA-R5; Tue, 24 Jul 2018 14:42:34 +0200 Subject: Re: [PATCH 2/2] xen/pv: Call get_cpu_address_sizes to set x86_virt/phys_bits To: Boris Ostrovsky , linux-kernel@vger.kernel.org Cc: "Kirill A. Shutemov" , Andy Lutomirski , Ingo Molnar , "H. Peter Anvin" , Thomas Gleixner , Juergen Gross , xen-devel@lists.xenproject.org, x86@kernel.org, stable@vger.kernel.org References: <20180721194909.23903-1-m.v.b@runbox.com> <20180721194909.23903-2-m.v.b@runbox.com> <90bc371d-a296-51b3-8b78-62106c9690de@oracle.com> <13b774d7-bc8c-039a-fbc0-52318f535883@runbox.com> <8c17dccf-d382-0ba4-612c-8c674f5dd9e0@oracle.com> From: "M. Vefa Bicakci" Message-ID: Date: Tue, 24 Jul 2018 08:42:28 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <8c17dccf-d382-0ba4-612c-8c674f5dd9e0@oracle.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Language: en-CA Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 07/23/2018 11:04 AM, Boris Ostrovsky wrote: > On 07/22/2018 11:57 AM, M. Vefa Bicakci wrote: >> On 07/21/2018 07:17 PM, M. Vefa Bicakci wrote: >>> On 07/21/2018 05:25 PM, Boris Ostrovsky wrote: >>>> On 07/21/2018 03:49 PM, M. Vefa Bicakci wrote: >>>>> diff --git a/arch/x86/xen/enlighten_pv.c b/arch/x86/xen/enlighten_pv.c >>>>> index 439a94bf89ad..87afb000142a 100644 >>>>> --- a/arch/x86/xen/enlighten_pv.c >>>>> +++ b/arch/x86/xen/enlighten_pv.c >>>>> @@ -1257,6 +1257,7 @@ asmlinkage __visible void __init >>>>> xen_start_kernel(void) >>>>> ????? /* Work out if we support NX */ >>>>> ????? get_cpu_cap(&boot_cpu_data); >>>>> +??? get_cpu_address_sizes(&boot_cpu_data); >>>>> ????? x86_configure_nx(); >>>> >>>> >>>> Have you observed any problems without this call? get_cpu_cap() is only >>>> called here to set X86_FEATURE_NX, and is then called again, together >>>> with get_cpu_address_sizes(), from early_identify_cpu(). >>> >>> Thank you for the reviews! Without the call to get_cpu_address_sizes, >>> paravirtualized virtual machines do not boot up kernels with versions >>> 4.17 and up at all; this includes dom0 and domU. No domU logs are >>> generated in dom0's /var/log/xen/console/ directory either, despite >>> having earlyprintk=xen on the kernel command line for my test domU. >> >> Hello Boris, >> >> I debugged this further with a debugging version of Xen (so that I can >> get early kernel print-outs via the "xen_raw_console_write" function), >> and I found the root cause of the boot up failure. >> >> In summary, the issue is due to the following call path in version >> 4.17 (and higher, I assume), which the kernel goes through /only/ when >> CONFIG_DEBUG_VIRTUAL is enabled: >> >> enlighten_pv.c::xen_start_kernel >> ? mmu_pv.c::xen_reserve_special_pages >> ??? page.h::__pa >> ????? physaddr.c::__phys_addr >> ??????? physaddr.h::phys_addr_valid // uses boot_cpu_data.x86_phys_bits >> >> The return value of phys_addr_valid is used with the VIRTUAL_BUG_ON >> macro, >> which evaluates to BUG_ON in case CONFIG_DEBUG_VIRTUAL is enabled. > > > Ah, that's why it hasn't been detected. > > >> >> It looks like the call to get_cpu_address_size is required in the >> xen_start_kernel function. Perhaps there is a more elegant way to >> resolve this issue as well. >> >> Another approach could be to check in the phys_addr_valid function >> whether >> boot_cpu_data.x86_phys_bits has been initialized or not, I think, but >> I am >> not sure about the correctness of this approach. > > > No, I think your patch is good. The only thing I'd suggest is to move > the call a few lines down. The way it is placed now may create > impression that we are calling get_cpu_address_sizes() to figure out NX > support. Sorry for the delay, and thank you for your comments! I will send an updated version of this patch in a few moments. Vefa