From nobody Wed May 1 20:01:48 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1517493209104275.16329690256646; Thu, 1 Feb 2018 05:53:29 -0800 (PST) Received: from localhost ([::1]:38005 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ehFIq-0004xY-BI for importer@patchew.org; Thu, 01 Feb 2018 08:53:24 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40010) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ehFHc-0004G6-12 for qemu-devel@nongnu.org; Thu, 01 Feb 2018 08:52:12 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ehFHZ-0000Qo-6X for qemu-devel@nongnu.org; Thu, 01 Feb 2018 08:52:08 -0500 Received: from szxga04-in.huawei.com ([45.249.212.190]:2159 helo=huawei.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ehFHY-0000Pi-Rf for qemu-devel@nongnu.org; Thu, 01 Feb 2018 08:52:05 -0500 Received: from DGGEMS413-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id 6EAFAD72440EB; Thu, 1 Feb 2018 21:51:49 +0800 (CST) Received: from localhost (10.177.18.62) by DGGEMS413-HUB.china.huawei.com (10.3.19.213) with Microsoft SMTP Server id 14.3.361.1; Thu, 1 Feb 2018 21:51:45 +0800 From: Gonglei To: Date: Thu, 1 Feb 2018 21:51:31 +0800 Message-ID: <1517493091-23620-1-git-send-email-arei.gonglei@huawei.com> X-Mailer: git-send-email 2.8.2.windows.1 MIME-Version: 1.0 X-Originating-IP: [10.177.18.62] X-CFilter-Loop: Reflected X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 45.249.212.190 Subject: [Qemu-devel] [PATCH] rtc: placing RTC memory region outside BQL 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: pbonzini@redhat.com, Gonglei , weidong.huang@huawei.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" As windows guest use rtc as the clock source device, and access rtc frequently. Let's move the rtc memory region outside BQL to decrease overhead for windows guests. $ cat strace_c.sh strace -tt -p $1 -c -o result_$1.log & sleep $2 pid=3D$(pidof strace) kill $pid cat result_$1.log Before appling this change: $ ./strace_c.sh 10528 30 % time seconds usecs/call calls errors syscall ------ ----------- ----------- --------- --------- ---------------- 93.87 0.119070 30 4000 ppoll 3.27 0.004148 2 2038 ioctl 2.66 0.003370 2 2014 futex 0.09 0.000113 1 106 read 0.09 0.000109 1 104 io_getevents 0.02 0.000029 1 30 poll 0.00 0.000000 0 1 write ------ ----------- ----------- --------- --------- ---------------- 100.00 0.126839 8293 total After appling the change: $ ./strace_c.sh 23829 30 % time seconds usecs/call calls errors syscall ------ ----------- ----------- --------- --------- ---------------- 92.86 0.067441 16 4094 ppoll 4.85 0.003522 2 2136 ioctl 1.17 0.000850 4 189 futex 0.54 0.000395 2 202 read 0.52 0.000379 2 202 io_getevents 0.05 0.000037 1 30 poll ------ ----------- ----------- --------- --------- ---------------- 100.00 0.072624 6853 total The futex call number decreases ~90.6% on an idle windows 7 guest. Signed-off-by: Gonglei --- hw/timer/mc146818rtc.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/timer/mc146818rtc.c b/hw/timer/mc146818rtc.c index 35a05a6..d9d99c5 100644 --- a/hw/timer/mc146818rtc.c +++ b/hw/timer/mc146818rtc.c @@ -986,6 +986,7 @@ static void rtc_realizefn(DeviceState *dev, Error **err= p) qemu_register_suspend_notifier(&s->suspend_notifier); =20 memory_region_init_io(&s->io, OBJECT(s), &cmos_ops, s, "rtc", 2); + memory_region_clear_global_locking(&s->io); isa_register_ioport(isadev, &s->io, base); =20 qdev_set_legacy_instance_id(dev, base, 3); --=20 1.8.3.1