From patchwork Wed Dec 5 22:31:23 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liam Merwick X-Patchwork-Id: 10714997 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1AA61109C for ; Wed, 5 Dec 2018 22:35:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B7D4F2DD88 for ; Wed, 5 Dec 2018 22:35:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AC4002DD93; Wed, 5 Dec 2018 22:35:06 +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=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 4BA8B2DD89 for ; Wed, 5 Dec 2018 22:35:06 +0000 (UTC) Received: from localhost ([::1]:37291 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gUfl3-0004RU-F5 for patchwork-qemu-devel@patchwork.kernel.org; Wed, 05 Dec 2018 17:35:05 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41605) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gUfiA-00013B-Ut for qemu-devel@nongnu.org; Wed, 05 Dec 2018 17:32:07 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gUfi6-0003nL-2M for qemu-devel@nongnu.org; Wed, 05 Dec 2018 17:32:06 -0500 Received: from userp2130.oracle.com ([156.151.31.86]:48184) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gUfi5-0003mq-Pd for qemu-devel@nongnu.org; Wed, 05 Dec 2018 17:32:01 -0500 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.22/8.16.0.22) with SMTP id wB5MT2LT120357; Wed, 5 Dec 2018 22:32:00 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references; s=corp-2018-07-02; bh=y+DrkfeVA5l1wkaZci+Tr6Hyj7tMkDVeJNAAT0vkm5Q=; b=C1QlxBwuaO/7IhEtURACila64xCxvBf2h8w8XSqBak+s0PSI8WZzaI5xpA74SCY8zpsb BqmPKVQnhdXJcGijfNDmhNiPfBfdtdsH/2MZ5+822hnenMZ/AfeJFJqmyrkXtt+vpFqU KFdmHVpa9LIuv8SPatasv2ZzdbgQMwhqOxuVZB9aXx8AJxqED93aK+ho3u/EhzSsvg+7 cxS3o4KNDALNjeSVO41KTXeXl7Vwdr+qY8cU3YJObbMU0rWGkOznmpS+09jwkfS5w8Zy pGo7Wupd4KYYN02IzyWhsQZGPoFDKTY63TSY0kzyGq8RGt0A6ohMmTfzmimw+VZo6WW9 1A== Received: from aserv0021.oracle.com (aserv0021.oracle.com [141.146.126.233]) by userp2130.oracle.com with ESMTP id 2p3hqu58ds-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 05 Dec 2018 22:32:00 +0000 Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by aserv0021.oracle.com (8.14.4/8.14.4) with ESMTP id wB5MVxXj003257 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 5 Dec 2018 22:31:59 GMT Received: from abhmp0014.oracle.com (abhmp0014.oracle.com [141.146.116.20]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id wB5MVxMw018753; Wed, 5 Dec 2018 22:31:59 GMT Received: from ol7.uk.oracle.com (/10.175.200.102) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 05 Dec 2018 14:31:58 -0800 From: Liam Merwick To: pbonzini@redhat.com Date: Wed, 5 Dec 2018 22:31:23 +0000 Message-Id: <1544049083-16087-4-git-send-email-liam.merwick@oracle.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1544049083-16087-1-git-send-email-liam.merwick@oracle.com> References: <1544049083-16087-1-git-send-email-liam.merwick@oracle.com> X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9098 signatures=668679 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=1 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=742 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1812050197 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] [fuzzy] X-Received-From: 156.151.31.86 Subject: [Qemu-devel] [RFC qboot 3/3] pvh: add benchmark exit point X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: maran.wilson@oracle.com, qemu-devel@nongnu.org, sgarzare@redhat.com Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP This commit adds a PVH specific VM exit point for use in benchmarking boot times using a QEMU specific device that terminates the QEMU process and thus the VM itself when handling those VM exits. Since the VM terminates right at those exit points, generic tools like time can be used to measure the time spent between the QEMU startup and termination moments. The QEMU device used for those measurement is called isa-debug-exit for the PC and Q35 machine types. These devices take 2 arguments: iobase and iosize. iobase specifies which IO port we need to write into to have these devices eventually handle the corresponding VM exit. If for example, QEMU is started with the following argument: -device isa-debug-exit,iobase=0xf4 then any IO write to 0xf4 will terminate the QEMU process and the corresponding VM. Signed-off-by: Liam Merwick --- benchmark.h | 3 ++- fw_cfg.c | 7 +++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/benchmark.h b/benchmark.h index 089c549b5803..2be08e7b2cec 100644 --- a/benchmark.h +++ b/benchmark.h @@ -9,5 +9,6 @@ #define FW_START 1 #define LINUX_START_FWCFG 2 #define LINUX_START_BOOT 3 +#define LINUX_START_PVHBOOT 4 -#endif +#endif /* BENCHMARK_H */ diff --git a/fw_cfg.c b/fw_cfg.c index e13ec20d0e8b..690ff19e74a0 100644 --- a/fw_cfg.c +++ b/fw_cfg.c @@ -240,10 +240,17 @@ void boot_pvh_from_fw_cfg(void) if (!sz) panic(); + fw_cfg_select(FW_CFG_KERNEL_ENTRY); kernel_entry = (void *) fw_cfg_readl_le(); asm volatile("movl %0, %%ebx" : : "r"(&start_info)); +#ifdef BENCHMARK_HACK + /* Exit just before jumping to vmlinux, so that it is easy + * to time/profile the firmware. + */ + outb(LINUX_EXIT_PORT, LINUX_START_PVHBOOT); +#endif asm volatile("jmp *%2" : : "a" (0x2badb002), "b"(&start_info), "c"(kernel_entry)); panic();