Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp199327imu; Thu, 8 Nov 2018 17:47:52 -0800 (PST) X-Google-Smtp-Source: AJdET5c7KCfyjJJaPUQF/i+2IQkO6Q8E7px+yzeaVqv2hjq7jODce/8pManUGXm2iK6vvpOqH616 X-Received: by 2002:a62:4b4b:: with SMTP id y72-v6mr3992991pfa.67.1541728072690; Thu, 08 Nov 2018 17:47:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541728072; cv=none; d=google.com; s=arc-20160816; b=f4biPhJaXAw8ZkFG/SCNijqL2/DJUpZ9BCfcSw5sXEqFDDEnF9IziWZxFSbc1h9OW4 m06m/nIy5Sc0Z0uZPo80u5Z6gM5Fia+7zH7VCkphUN3iaMVAxYRnBf7ZnrIOKH+c1mNS 80tAbQZwJeAsoUtE8xFLrq5crhKt+IFPZWE0Gurvhs6I6RXBUbJ8YAP3VsvokjTcGCKF 8LCJf2vvhQluldjY7Gb5x2Eu8rBCTV0sdfNeSUJRMSL1pj4lKG7uIgr4t0qrgJwgxAzU KX3/fzViitMQAqtAdclkYIE848y90o4o7IM8cdk0ikHaoS9vcMl4LrSzjNMFothCZVxe Hxeg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:organization:from:references:cc:to:subject; bh=1/Zep7zKan6qH6GjIIfUQxHejfCsacPcbzNsbunr0E4=; b=YbEnq3OL1jGdk6Mf5xONagMcnznlY0m1M+7sk+tNriwH+rq1EOYaGAqYDF7xFrUkPF MevubCOtWpUM0R3Fv9agdw7j2WM0KTj8RmQqdIA7wn3OFUC0oeWvi+fHcZZY8yd1T9IM fv967Xv1PzZ0eJOJ7K2fGcP1sEc5+/4Exy4rbHTONbxij2IUvTZuoMom6SFUcBqQJGgb ZwXKIaM4YlWl0jpx02Fw27HEQm1lGBw8dqnsWA2J6Q8wmbqG4Cj5Ivx903rGvUZrzIFv PQSeaKjijOO8W40DH/+umMbiL3iGPJAEqJQzezTT9ZZtqB9G0Ixt+FTlU99vAtUN7st2 l45A== ARC-Authentication-Results: i=1; mx.google.com; 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 d17si5521095pgl.484.2018.11.08.17.47.37; Thu, 08 Nov 2018 17:47:52 -0800 (PST) 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; 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 S1727665AbeKILZh (ORCPT + 99 others); Fri, 9 Nov 2018 06:25:37 -0500 Received: from mail.cn.fujitsu.com ([183.91.158.132]:17972 "EHLO heian.cn.fujitsu.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727336AbeKILZh (ORCPT ); Fri, 9 Nov 2018 06:25:37 -0500 X-IronPort-AV: E=Sophos;i="5.43,368,1503331200"; d="scan'208";a="47624000" Received: from unknown (HELO cn.fujitsu.com) ([10.167.33.5]) by heian.cn.fujitsu.com with ESMTP; 09 Nov 2018 09:47:14 +0800 Received: from G08CNEXCHPEKD03.g08.fujitsu.local (unknown [10.167.33.85]) by cn.fujitsu.com (Postfix) with ESMTP id 71C724B71EB5; Fri, 9 Nov 2018 09:47:13 +0800 (CST) Received: from [10.167.226.45] (10.167.226.45) by G08CNEXCHPEKD03.g08.fujitsu.local (10.167.33.89) with Microsoft SMTP Server id 14.3.408.0; Fri, 9 Nov 2018 09:47:16 +0800 Subject: Re: [Qemu-devel] [RFC/PoC PATCH 1/3] i386: set initrd_max to 4G - 1 to allow up to 4G initrd To: Peter Maydell , , , , , CC: QEMU Developers , Philip Li , , References: <1541674784-25936-1-git-send-email-lizhijian@cn.fujitsu.com> <1541674784-25936-2-git-send-email-lizhijian@cn.fujitsu.com> From: Li Zhijian Organization: fnst-ulinux Message-ID: Date: Fri, 9 Nov 2018 09:47:10 +0800 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: Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US X-Originating-IP: [10.167.226.45] X-yoursite-MailScanner-ID: 71C724B71EB5.AC066 X-yoursite-MailScanner: Found to be clean X-yoursite-MailScanner-From: lizhijian@cn.fujitsu.com X-Spam-Status: No Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 11/08/2018 07:06 PM, Peter Maydell wrote: > On 8 November 2018 at 10:59, Li Zhijian wrote: >> x86/x86_64 has alredy supported 4G initrd. >> >> linux/arch/x86/boot/header.S: >> # (Header version 0x0203 or later) the highest safe address for the contents >> # of an initrd. The current kernel allows up to 4 GB, but leave it at 2 GB to >> # avoid possible bootloader bugs. >> >> CC: Philip Li >> Signed-off-by: Li Zhijian >> --- >> hw/i386/pc.c | 6 ++++++ >> 1 file changed, 6 insertions(+) >> >> diff --git a/hw/i386/pc.c b/hw/i386/pc.c >> index cd5029c..e1b910f 100644 >> --- a/hw/i386/pc.c >> +++ b/hw/i386/pc.c >> @@ -913,6 +913,12 @@ static void load_linux(PCMachineState *pcms, >> /* highest address for loading the initrd */ >> if (protocol >= 0x203) { >> initrd_max = ldl_p(header+0x22c); >> + if (initrd_max == 0x7fffffff) { >> + /* for some reasons, initrd_max is hard code with 0x7fffffff >> + * hard code to 4G - 1 to allow 4G initrd >> + */ >> + initrd_max = UINT32_MAX - 1; >> + } > I don't understand this. If the header of the file we're using > says "this is the maximum", then we should trust the header to > in fact not be lying to us, shouldn't we ? > > If the kernel initrd creation process creates an initrd which > is larger than 2GB and also claims that it can't be placed > with any part of it above 2GB, then that sounds like a bug > in the initrd creation process... Exactly, it's a real problem. Add x86 maintainers and LKML: The background is that QEMU want to support up to 4G initrd. but linux header ( initrd_addr_max field) only allow 2G-1. Is one of the below approaches reasonable: 1) change initrd_addr_max to 4G-1 directly simply(arch/x86/boot/header.S)? 2) lie QEMU bootloader the initrd_addr_max is 4G-1 even though header said 2G-1 3) any else > >> } else { >> initrd_max = 0x37ffffff; >> } > This patch should come last in the series: only after we have fixed all > of QEMU's internal plumbing to handle larger initrd sizes should we > enable it. Got it. Thanks Zhijian > > thanks > -- PMM > > >