From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.9 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3C059C4363D for ; Fri, 25 Sep 2020 17:23:25 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D42E92083B for ; Fri, 25 Sep 2020 17:23:24 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=suse.com header.i=@suse.com header.b="CLsfKZnU" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D42E92083B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=suse.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kLrQm-0004sF-2E; Fri, 25 Sep 2020 17:22:48 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kLrQk-0004sA-Mi for xen-devel@lists.xenproject.org; Fri, 25 Sep 2020 17:22:46 +0000 X-Inumbo-ID: 067901aa-39c3-46f2-9cb1-0a24e66d9224 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 067901aa-39c3-46f2-9cb1-0a24e66d9224; Fri, 25 Sep 2020 17:22:45 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1601054564; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=38qzbhBEXzv3ijc8u3t+DUEJNo/y6DnA23MNpZW/FdY=; b=CLsfKZnU0BN8+bPSso30+t+YEdy+4Xru3mfSplPrBIoCx7CFhSgx07pILYUGCYEDpvecH3 UOeU5Bu4fdX4Rc4VVEspCdIQQPjvAl4wlkC12yQ4JMn6RVcPP1OF6tRa88pX60ZABKU5rw HxhjI4JRI/k2CACjk4Py/aNSBjXJFqg= Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id C05E7AC5B; Fri, 25 Sep 2020 17:22:44 +0000 (UTC) Message-ID: <66880caef018abdbf9fe99116594a2826efcb603.camel@suse.com> Subject: Re: [RFC PATCH v1 2/6] sched: track time spent in hypervisor tasks From: Dario Faggioli To: Volodymyr Babchuk , =?ISO-8859-1?Q?J=FCrgen_Gro=DF?= Cc: "xen-devel@lists.xenproject.org" , "julien@xen.org" , "jbeulich@suse.com" , "wl@xen.org" , "sstabellini@kernel.org" , "ian.jackson@eu.citrix.com" , "george.dunlap@citrix.com" , "andrew.cooper3@citrix.com" Date: Fri, 25 Sep 2020 19:22:43 +0200 In-Reply-To: <87d02bavz7.fsf@epam.com> References: <20200612002205.174295-1-volodymyr_babchuk@epam.com> <20200612002205.174295-3-volodymyr_babchuk@epam.com> <918fa2e1-232c-a3ff-d0a9-776b470ee5db@suse.com> <87d02bavz7.fsf@epam.com> Content-Type: multipart/signed; micalg="pgp-sha256"; protocol="application/pgp-signature"; boundary="=-ootfjBMZnoKDRu8qlf1e" User-Agent: Evolution 3.38.0 (by Flathub.org) MIME-Version: 1.0 X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" --=-ootfjBMZnoKDRu8qlf1e Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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): >=20 > 1. do_softirq() calls vcpu_begin_hyp_task() and then executes > __do_softirq() >=20 > 2. __do_softirq() does different jobs and eventually calls schedule() >=20 > 3. schedule() calls vcpu_end_hyp_task() and makes scheduling decision > which leads to call to context_switch() >=20 > 4. On end context_switch() we will exit hypervisor and enter VM. At > least, this is how I understand >=20 > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 nextd->arch.ctxt_switch->tail(next); >=20 > call. >=20 > So, no need to call vcpu_begin_hyp_task() in context_switch() for > x86. >=20 Mmm... This looks correct to me too. And what about the cases where schedule() does return? 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 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 :) >=20 Yeah, good to know. :-) Are you doing these tests with both core-scheduling disabled and enabled? Regards --=20 Dario Faggioli, Ph.D http://about.me/dario.faggioli Virtualization Software Engineer SUSE Labs, SUSE https://www.suse.com/ ------------------------------------------------------------------- <> (Raistlin Majere) --=-ootfjBMZnoKDRu8qlf1e Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEES5ssOj3Vhr0WPnOLFkJ4iaW4c+4FAl9uJ2MACgkQFkJ4iaW4 c+6fbg//T+gci0WAW/CSuKgp1LLzT7uRduHejsyrq8EGX6dglulmES1bTsuuhY5W /0S1ItJcpgbm1bZGYjHnvuttpYy8hbShvEwPV15a6B+3GYBF0CtYdD+IUywlW+0X t7AgFxig2ylwJjVisaoHkC7u8pcKqWZZ25QshtAtXY43EtKl86hrhA5oJ5a5t9lD W/zNTUCwkHpPXEu2iagvN7wLXVZbd9I0/JrbxmhmroywwCrOZ44NwxTI2Ei1Qekv yTOkexysEtbQGnbNNka8336eAoY8T9ro95MDrNfTmAimJytILzmm/k3+GiWYMgDU yqp0tEWjlbonEUMiM7IXTDSXCFWBKEPO3VPOqPDVOORztUYov4QOuDxKAk2YWjDT aO9hI6t/gKdzRvoLQqJEMl+KbBX4+xiFOJrpWIB6bMKlwc3LZPdBeKWJlMb/ELXD gJQ6aTFFw3Oy8Tz0MNkn9BBZmtsfjKf+Q5iOHxWywp0GD8VgZQD4vJXOErldXkmt +8NJIGbfrd/IawCPfq4OkHcP0h7y0BafPl6HltFcLUNYRs4BaX3DcCI5aXqCb+b2 krcK6Lw5p1y/xg6XVrL10cZI7ZoctY+0SyX8DB4nWOfn0+WX/ym/87IBy8zCPnup c6+3OR6JZwIzRsA4cLbIE0gGb83PNGRj4d0A+oWw/SK6AhoMjaI= =e6JN -----END PGP SIGNATURE----- --=-ootfjBMZnoKDRu8qlf1e--