[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: "jgross@xxxxxxxx" <jgross@xxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>
  • Date: Fri, 12 Jun 2020 11:30:43 +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=1iB5UzSHH1KgP6PRHIhObGC20xwVLHX64wBQq/sIm64=; b=c9Q9l+4QvbkXsHC6wKl9pZsQAb34dBW4ZLwNcV1wGSep9UW4evcNRSJc697fi/AlygJuZf8gopvo9HTWlJ1FRIIjtjK+Nq1S8j96o4Rr70vE1ILBRuDsy35KJJV6+u0Q/r7sNGaXSKhSeKBjI8E7RxJKpqpDa5mWbyLi3GJAuRbDVleB0tC5k2+BhNJ82BiHts+ib8lZFB/BrHexIH7Q7CC+aQWQ7dpwvv2fvJ4QhIjb1IiVeecEcleggfKiFEAUhsGM1zvzGnR1FswtK1x7gtrgwhNSC/TaWKa8lcMqBX29o73reINKHlkYFRWWZ2K/Yv7hKNj8pVpGJ26BP3udqA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gtMhAL8pw8bcVYheruZOFjZc9EAsG6mA48ETm+00qG75RO/G6PhaUjZav6nkdWIiYhy7UceWiRRvZ5FBgH3zzPFrq19sMbBdHqbD1giHgc4KVkdjDV5prXwPe/pdaaAkZBgYaHby7+E+bo3l2TdDoMbQAHpjnQJDaONs3oESDOR+u4hDCGB8GTJBw6zY2d/8EgAyCYe4hVTJLiJwIOIgryS5oQwpV7wgDx6fscxSJNDy+w4OGFLX0gkSQ6Y57yAQWIDT6Y+DLPGPu5/qqrhlJRzAm9QfLX+LHr1KeKswHYVN6uI7Uhb3UZS8imcKGVsLvbY0jX1fcvBQyQGENTe6Vg==
  • Authentication-results: suse.com; dkim=none (message not signed) header.d=none;suse.com; dmarc=none action=none header.from=epam.com;
  • Cc: "sstabellini@xxxxxxxxxx" <sstabellini@xxxxxxxxxx>, "julien@xxxxxxx" <julien@xxxxxxx>, "wl@xxxxxxx" <wl@xxxxxxx>, "andrew.cooper3@xxxxxxxxxx" <andrew.cooper3@xxxxxxxxxx>, "ian.jackson@xxxxxxxxxxxxx" <ian.jackson@xxxxxxxxxxxxx>, "george.dunlap@xxxxxxxxxx" <george.dunlap@xxxxxxxxxx>, "dfaggioli@xxxxxxxx" <dfaggioli@xxxxxxxx>, "jbeulich@xxxxxxxx" <jbeulich@xxxxxxxx>
  • Delivery-date: Fri, 12 Jun 2020 11:30:50 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHWQE+SUtF98x/3akmRxwBff1s+m6jUZ0iAgABx6YA=
  • Thread-topic: [RFC PATCH v1 2/6] sched: track time spent in hypervisor tasks

On Fri, 2020-06-12 at 06:43 +0200, Jürgen Groß wrote:
> On 12.06.20 02:22, Volodymyr Babchuk wrote:
> > +void vcpu_end_hyp_task(struct vcpu *v)
> > +{
> > +    int delta;
> > +
> > +    if ( is_idle_vcpu(v) )
> > +        return;
> > +
> > +    ASSERT(v->in_hyp_task);
> > +
> > +    /* We assume that hypervisor task time will not overflow int */
> 
> This will definitely happen for long running VMs. Please use a 64-bit
> variable.
> 

It is not suposed to hold long time spans, as I described in the reply
to previous email.

> > +    delta = NOW() - v->hyp_entry_time;
> > +    atomic_add(delta, &v->sched_unit->hyp_time);
> > +
> > +#ifndef NDEBUG
> > +    v->in_hyp_task = false;
> > +#endif
> > +}
> > +
> >   /*
> >    * Do the actual movement of an unit from old to new CPU. Locks for *both*
> >    * CPUs needs to have been taken already when calling this!
> > @@ -2615,6 +2646,7 @@ static void schedule(void)
> >   
> >       SCHED_STAT_CRANK(sched_run);
> >   
> > +    vcpu_end_hyp_task(current);
> >       rcu_read_lock(&sched_res_rculock);
> >   
> >       lock = pcpu_schedule_lock_irq(cpu);
> > diff --git a/xen/common/softirq.c b/xen/common/softirq.c
> > index 063e93cbe3..03a29384d1 100644
> > --- a/xen/common/softirq.c
> > +++ b/xen/common/softirq.c
> > @@ -71,7 +71,9 @@ void process_pending_softirqs(void)
> >   void do_softirq(void)
> >   {
> >       ASSERT_NOT_IN_ATOMIC();
> > +    vcpu_begin_hyp_task(current);
> >       __do_softirq(0);
> > +    vcpu_end_hyp_task(current);
> 
> This won't work for scheduling. current will either have changed,
> or in x86 case __do_softirq() might just not return. You need to
> handle that case explicitly in schedule() (you did that for the
> old vcpu, but for the case schedule() is returning you need to
> call vcpu_begin_hyp_task(current) there).
> 

Well, this is one of questions, I wanted to discuss. I certainly need
to call vcpu_begin_hyp_task(current) after context switch. But what it
is the right place? If my understaning is right, code on x86 platform
will never reach this point. Or I'm wrong there?



 


Rackspace

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