From: David Laight <David.Laight@ACULAB.COM>
To: 'Yin Fengwei' <fengwei.yin@intel.com>,
"rjw@rjwysocki.net" <rjw@rjwysocki.net>,
"lenb@kernel.org" <lenb@kernel.org>,
"linux-acpi@vger.kernel.org" <linux-acpi@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: RE: [PATCH v2] ACPI / processor_idle: use ndelay instead of io port access for wait
Date: Tue, 15 Oct 2019 11:48:15 +0000 [thread overview]
Message-ID: <c9f3f4f93bb946f790fce4709253b359@AcuMS.aculab.com> (raw)
In-Reply-To: <20191015080404.6013-1-fengwei.yin@intel.com>
From: Yin Fengwei
> Sent: 15 October 2019 09:04
> In function acpi_idle_do_entry(), an ioport access is used for dummy
> wait to guarantee hardware behavior. But it could trigger unnecessary
> vmexit in virtualization environment.
>
> If we run linux as guest and export all available native C state to
> guest, we did see many PM timer access triggered VMexit when guest
> enter deeper C state in our environment (We used ACRN hypervisor
> instead of kvm or xen which has PM timer emulated and exports all
> native C state to guest).
>
> According to the original comments of this part of code, io port
> access is only for dummy wait. We could use busy wait instead of io
> port access to guarantee hardware behavior and avoid unnecessary
> VMexit.
You need some hard synchronisation instruction(s) after the inb()
and before any kind of delay to ensure your delay code is executed
after the inb() completes.
I'm pretty sure that inb() is only synchronised with memory reads.
...
> + /* profiling the time used for dummy wait op */
> + ktime_get_real_ts64(&ts0);
> + inl(acpi_gbl_FADT.xpm_timer_block.address);
> + ktime_get_real_ts64(&ts1);
That could be dominated by the cost of ktime_get_real_ts64().
It also need synchronising instructions.
David
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)
next prev parent reply other threads:[~2019-10-15 11:48 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-15 8:04 Yin Fengwei
2019-10-15 11:48 ` David Laight [this message]
2019-10-16 5:56 ` Yin, Fengwei
2019-10-18 10:12 ` Rafael J. Wysocki
2019-10-18 10:39 ` Yin, Fengwei
2019-10-22 14:25 ` Yin Fengwei
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=c9f3f4f93bb946f790fce4709253b359@AcuMS.aculab.com \
--to=david.laight@aculab.com \
--cc=fengwei.yin@intel.com \
--cc=lenb@kernel.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rjw@rjwysocki.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome