[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [RFC PATCH v1 2/6] sched: track time spent in hypervisor tasks


  • To: Dario Faggioli <dfaggioli@xxxxxxxx>
  • From: Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>
  • Date: Fri, 25 Sep 2020 20:21:44 +0000
  • Accept-language: en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=epam.com; dmarc=pass action=none header.from=epam.com; dkim=pass header.d=epam.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=fPIUYITiwM1eftGekOu6gh8Ab/IcbX35K7FKHge+TYQ=; b=BaAgu+bDR85sLkfrTB8Hr1MWn154soosrYdr40n2rSXHWO5NGQ3WO7o8ada6qM4bXJza1jUz7OptEyckGYIyWDhxzeX8mYEGCVd0E/VHT4+AinzPZpXkg/oq/icQCioGjGinvIW12dQWC3Fq3145FglXpRv21BcGH0n7oEF3/5o70iWPJUHWcVCLeIugp0/+JtOxK9jwEE26h5092nDwVlTwsz3+FzbHFqyVzYAn0ryzEPLQ+kjAMuRxf/GptEdRZhKnX5XxDUxraexbbMFljXOgyIUVZwJYwnpStOt9rxbgtRmoV8IJwDzlxXJdEiuTnhP+DjQXSBoeGk2Q6rICUw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ByCSJjZ1GcgSScPayD59QfNz5jfD/C+TdrEsWuVtJpESCRmJNz2ydbbts3JUzO2G/k79A+s7KbQXz1+Q8W4SR6T/4/D594Bmeh3kxA/9f5Z5BiXiaJghJm8pA/SOIuABJKG+G+pzspovCcd4d2kI1UVq57Co3Ym4qN3RkISmuWCKI2LmxKX8qSYbbj6D5kJhTK9BLEIz/HLmScA6IrXrvMSA8Oj4VixvWgz1haxPGPljUG9Nr+nEFWcW0vWXSDMJtvp1VfM+B54rZ3KKSsO9Z8xExU3CTnJ+bBFEf51CyEYuT4n3+m1ffvSulTtsEmbWbFMMZ3AZIKqNP51gPHmp4g==
  • Authentication-results: suse.com; dkim=none (message not signed) header.d=none;suse.com; dmarc=none action=none header.from=epam.com;
  • Cc: Jürgen Groß <jgross@xxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, "julien@xxxxxxx" <julien@xxxxxxx>, "jbeulich@xxxxxxxx" <jbeulich@xxxxxxxx>, "wl@xxxxxxx" <wl@xxxxxxx>, "sstabellini@xxxxxxxxxx" <sstabellini@xxxxxxxxxx>, "ian.jackson@xxxxxxxxxxxxx" <ian.jackson@xxxxxxxxxxxxx>, "george.dunlap@xxxxxxxxxx" <george.dunlap@xxxxxxxxxx>, "andrew.cooper3@xxxxxxxxxx" <andrew.cooper3@xxxxxxxxxx>
  • Delivery-date: Fri, 25 Sep 2020 20:22:12 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHWQE+SUtF98x/3akmRxwBff1s+m6jUZ0iAgABx6YCAAALVgICj3sIAgAGFjYCAADIDgA==
  • Thread-topic: [RFC PATCH v1 2/6] sched: track time spent in hypervisor tasks

Hi Dario,


Dario Faggioli writes:

> On Thu, 2020-09-24 at 18:08 +0000, Volodymyr Babchuk wrote:
>> So, as I see this, functions are called in the following way (on
>> x86):
>> 
>> 1. do_softirq() calls vcpu_begin_hyp_task() and then executes
>> __do_softirq()
>> 
>> 2. __do_softirq() does different jobs and eventually calls schedule()
>> 
>> 3. schedule() calls vcpu_end_hyp_task() and makes scheduling decision
>> which leads to call to context_switch()
>> 
>> 4. On end context_switch() we will exit hypervisor and enter VM. At
>> least, this is how I understand
>> 
>>        nextd->arch.ctxt_switch->tail(next);
>> 
>> call.
>> 
>> So, no need to call vcpu_begin_hyp_task() in context_switch() for
>> x86.
>> 
> Mmm... This looks correct to me too.
>
> And what about the cases where schedule() does return?

Can it return on x86? I want to test this case, but how force it? Null
scheduler, perhaps?

> Are these also fine because they're handled within __do_softirq()
> (i.e., without actually going back to do_softirq() and hence never
> calling end_hyp_task() for a second time)?

I afraid, that there will be a bug. schedule() calls end_hyp_task(), and
if it will eventually return from __do_softirq() to do_softirq(),
end_hyp_task() will be called twice.

>
>> I have put bunch of ASSERTs to ensure that vcpu_begin_hyp_task() or
>> vcpu_end_hyp_task() are not called twice and that vcpu_end_hyp_task()
>> is
>> called after vcpu_begin_hyp_task(). Those asserts are not failing, so
>> I
>> assume that I did all this in the right way :)
>> 
> Yeah, good to know. :-)
>
> Are you doing these tests with both core-scheduling disabled and
> enabled?

Good question. On x86 I am running Xen in QEMU. With -smp=2 it sees two
CPUs:

(XEN) Brought up 2 CPUs
(XEN) Scheduling granularity: cpu, 1 CPU per sched-resource

You are right, I need to try other variants of scheduling granularity.

Do you by any chance know how to emulate more complex setup in QEMU?
Also, what is the preferred way to test/debug Xen on x86?

-- 
Volodymyr Babchuk at EPAM


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.