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

Re: [RFC PATCH v1 4/6] xentop: collect IRQ and HYP time statistics.


  • To: Jürgen Groß <jgross@xxxxxxxx>
  • From: Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>
  • Date: Thu, 18 Jun 2020 02:58:46 +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=qEcOKTTivdcI/+SmPUGs4eCU2VxuzFEADnyOKg3Ucm0=; b=bT/UFjE0uf3aqkr/tO1E+8OpdnAMPv0vetuR5xnuZrTJ1eF/VDhE/wHnBBVBSjaBTxwblC48RYb8Ohk1eJehnHa8cogJAiOOpi5SJHlqBjIeu++q/N4mMDUGPuJWyYTrhtZVJxsOVConLOMUE8Wv9+V9hNprZF56VDVisysnXbDpc8rRKd0X8N1rgUaZscRDeV1K8F5JGwufXMt7vORlNPfFjDGZ8jFJcIbz2/2LY0+53Xwdl35IajBjXIlbD+05+pRV0DBVzDFsb9XEEkHgIfYcZBPHmrvreDpusDNpVFcrXMWN+rc/RFUS0qNaFy6z15bCcfdfvAbcSQ61yLJ+ew==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=k6JMS3ze7Iw3W5InMQIZ1L0etn1zLdCy8bIYoNAgJgLdtSPssEFqlz3nHZeelUM0g1SvyB8TLdDCQpx6PEHNuCxLd6G4UqDrvuSWsHQzYCP4YUR2+iBl7tUcJHTTDEKve/gINKWQv+PGKLOyeM5teAx8YVNy0Bu7nUfC/pbrLRrhU25nruSEc4GzuzxmrY7n7OZmiPcNTYg/h7jS3ZC/YTAXkoIUlek/BLfbpTLDjlKqQA6kJXnBgKjdxMjXus3Ea8nxg4ATCC5sfILIwFpFuN2poRkz8zDM7eB3C2zIijURv4ch6/MYxB8iAvkw2p7oYoo/2b0YbMmtQgGv4ltqYw==
  • 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>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Thu, 18 Jun 2020 02:58:58 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHWQE+Tib/gTK49mk6bUudd1VvXZqjUa0CAgAB+fACAAANFAIAALvMAgAB0vgCAAISmAIAHosuA
  • Thread-topic: [RFC PATCH v1 4/6] xentop: collect IRQ and HYP time statistics.

Hi Jürgen,

Jürgen Groß writes:

> On 13.06.20 00:27, Volodymyr Babchuk wrote:
>> On Fri, 2020-06-12 at 17:29 +0200, Dario Faggioli wrote:
>>> On Fri, 2020-06-12 at 14:41 +0200, Jürgen Groß wrote:
>>>> On 12.06.20 14:29, Julien Grall wrote:
>>>>> On 12/06/2020 05:57, Jürgen Groß wrote:
>>>>>> On 12.06.20 02:22, Volodymyr Babchuk wrote:
>>>>>>> @@ -994,9 +998,22 @@ s_time_t sched_get_time_correction(struct
>>>>>>> sched_unit *u)
>>>>>>>                break;
>>>>>>>        }
>>>>>>> +    spin_lock_irqsave(&sched_stat_lock, flags);
>>>>>>> +    sched_stat_irq_time += irq;
>>>>>>> +    sched_stat_hyp_time += hyp;
>>>>>>> +    spin_unlock_irqrestore(&sched_stat_lock, flags);
>>>>>>
>>>>>> Please don't use a lock. Just use add_sized() instead which will
>>>>>> add
>>>>>> atomically.
>>>>>
>>>>> If we expect sched_get_time_correction to be called concurrently
>>>>> then we
>>>>> would need to introduce atomic64_t or a spin lock.
>>>>
>>>> Or we could use percpu variables and add the cpu values up when
>>>> fetching the values.
>>>>
>>> Yes, either percpu or atomic looks much better than locking, to me, for
>>> this.
>>
>> Looks like we going to have atomic64_t after all. So, I'll prefer to to
>> use atomics there.
>
> Performance would be better using percpu variables, as those would avoid
> the cacheline moved between cpus a lot.

I see. But don't we need locking in this case? I can see scenario, when
one pCPU updates own counters while another pCPU is reading them.

IIRC, ARMv8 guarantees that 64 bit read of aligned data would be
consistent. "Consistent" in the sense that, for example, we would not
see lower 32 bits of the new value and upper 32 bits of the old value.

I can't say for sure about ARMv7 and about x86.

-- 
Volodymyr Babchuk at EPAM

 


Rackspace

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