From patchwork Fri Feb 19 20:58:06 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luis Chamberlain X-Patchwork-Id: 8363901 Return-Path: X-Original-To: patchwork-xen-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 9C7FE9F372 for ; Fri, 19 Feb 2016 21:01:05 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C043B203E5 for ; Fri, 19 Feb 2016 21:01:04 +0000 (UTC) Received: from lists.xen.org (lists.xenproject.org [50.57.142.19]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id CAA94203E3 for ; Fri, 19 Feb 2016 21:01:03 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xen.org) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1aWs7u-00032x-HI; Fri, 19 Feb 2016 20:58:10 +0000 Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1aWs7s-00032l-F7 for xen-devel@lists.xensource.com; Fri, 19 Feb 2016 20:58:08 +0000 Received: from [193.109.254.147] by server-1.bemta-14.messagelabs.com id 70/15-28791-FD187C65; Fri, 19 Feb 2016 20:58:07 +0000 X-Env-Sender: lurodriguez@suse.de X-Msg-Ref: server-2.tower-27.messagelabs.com!1455915486!23282829!1 X-Originating-IP: [195.135.220.15] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 7.35.1; banners=-,-,- X-VirusChecked: Checked Received: (qmail 18591 invoked from network); 19 Feb 2016 20:58:07 -0000 Received: from mx2.suse.de (HELO mx2.suse.de) (195.135.220.15) by server-2.tower-27.messagelabs.com with DHE-RSA-CAMELLIA256-SHA encrypted SMTP; 19 Feb 2016 20:58:07 -0000 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 1F08DAD10; Fri, 19 Feb 2016 20:58:06 +0000 (UTC) Date: Fri, 19 Feb 2016 21:58:06 +0100 From: "Luis R. Rodriguez" To: Boris Ostrovsky Message-ID: <20160219205806.GS25240@wotan.suse.de> References: <1455887316-9223-1-git-send-email-mcgrof@kernel.org> <1455887316-9223-6-git-send-email-mcgrof@kernel.org> <56C72FFB.5090105@oracle.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <56C72FFB.5090105@oracle.com> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: rusty@rustcorp.com.au, x86@kernel.org, linux-kernel@vger.kernel.org, luto@amacapital.net, "Luis R. Rodriguez" , xen-devel@lists.xensource.com, bp@alien8.de, david.vrabel@citrix.com Subject: Re: [Xen-devel] [PATCH 5/9] apm32: remove paravirt_enabled() use X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On Fri, Feb 19, 2016 at 10:08:43AM -0500, Boris Ostrovsky wrote: > > > On 02/19/2016 08:08 AM, Luis R. Rodriguez wrote: > >There is already a check for apm_info.bios == 0, the > >apm_info.bios is set from the boot_params.apm_bios_info. > >Both Xen and lguest, which are also the only ones that set > >paravirt_enabled to true) do never set the apm_bios_info, > >the paravirt_enabled() check is simply not needed. > > We need to guarantee that boot_params is filled with zeroes. On > baremetal path we clear .bss (which is where boot_params live) > before copying data from zero page. To be clear Xen is the only user of this that just sets it outright instead of poking at the file and using that as reference, and setting what it needs. Its a good point though that things like this which are 0 still should probably be set. > So we need to at least memset(&boot_params, 0, sz) This use case would be just Xen specific, for lguest we can just set the things we need clearly on the launcher. So like this (I can fold in a separate patch): > in xen_start_kernel(). Better yet, clear whole .bss. > > (This applies to the next patch as well). So clear_bss() -- oh look, another call that xen_start_kernel() could have made good use of. :) Can you send a respective patch I can old into this series? I'm afraid it is by no means obvious to me where it would be safe to do this on xen_start_kernel(). Luis diff --git a/tools/lguest/lguest.c b/tools/lguest/lguest.c index ff0aa580c6e1..0aa75af6e862 100644 --- a/tools/lguest/lguest.c +++ b/tools/lguest/lguest.c @@ -3357,6 +3357,12 @@ int main(int argc, char *argv[]) /* Tell the entry path not to try to reload segment registers. */ boot->hdr.loadflags |= KEEP_SEGMENTS; + /* We don't support tboot */ + boot->tboot_addr = 0; + + /* Ensure this is 0 to prevent apm from loading */ + boot->apm_bios_info.version = 0; + /* We tell the kernel to initialize the Guest. */ tell_kernel(start);