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

Re: [PATCH v4] xen/arm: avoid overflow when setting vtimer in context switch


  • To: Julien Grall <julien@xxxxxxx>
  • From: Bertrand Marquis <Bertrand.Marquis@xxxxxxx>
  • Date: Thu, 7 Jul 2022 15:35:52 +0000
  • Accept-language: en-GB, en-US
  • Arc-authentication-results: i=2; mx.microsoft.com 1; spf=pass (sender ip is 63.35.35.123) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com; arc=pass (0 oda=1 ltdi=1 spf=[1,1,smtp.mailfrom=arm.com] dkim=[1,1,header.d=arm.com] dmarc=[1,1,header.from=arm.com])
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none
  • Arc-message-signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=pGY+VV9hCUPZRXDBldhaSoi35/X4k/KdbHvCmaZMBHc=; b=VzRuACY4fNJxuwxD6KcDwQF1cMq/OdsobPBHVVoyA+mZxN8+aHW0YEjQyayiHcpVbnmUgJnGIJ+mLNVuROEMKEgSaVdwHHj3t1tFYVztpIfZT9d3RhvtO62cIQxbrzFme5UWw5fFZrIvqRIFlX+SmLej4Tx2KuaDkH6Iek9ugai6M7qM8SyvVZyoqjVnD2K7GWjvi43WimOB8IaZAE93TvbQFqBNwV/mSDV8NsJCDYnstkxd5R7AI2VTb6FHz9j+/jr8gbVrP8jicGCn5ady2trYGAYGrcSo3cSlodrJZPmap0yq1fpZzgHnZJRTqWB4rKRCc/p0brZNs5JYBZdDLQ==
  • 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=pGY+VV9hCUPZRXDBldhaSoi35/X4k/KdbHvCmaZMBHc=; b=hOJVIdzXwueZMAO+S58raZIJaQegR5zq3+1e6/j62ISmTmy5AECB0T7UaY4AqV2TuQTK5/O6uixNCNFippkO3TCIjOjWLKPbKv7GHZF+EFSQkNYLJm6t+tDPcno7oQQWv7WL5NYvV6PNt8jBG8xMYwtYIrQjxQjz7POQsPzvmn3y0+0wWaBsmwkrOeTWQeFisg3yu2b0cPXaJJX4gXLnT0OlZqHNBz6zXv7gzrX/sthFs0+8nlM2sxWn+gMSen2yKTmkpU01yHd9hNhbKGdUK+53N3XswCIefyzb5lep5nEI2xMM1Xd2H2Y/HgjpiNe+i2GswG0u0kgofr4fZzKYsA==
  • Arc-seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=L+gsgTEzSa/5yhp/VGbRNOp9L+SRlUSiXTPSXfbf4f3LrGs8pwYcfWMTi4xbrYvnvJrDGaemCUnh+Tk/OgUuXlROKbRgvg1g0o4/5Zdx51d7sMaqEKxPqRYFg84WDOCd1syiCRPFT1PXEsBEKh5tdIKycHABxx83X0KNvouVNI1mt4iyfisDlAJg/sJGoFIfth1UJcMLujFme5R/X6l7zCuP2HAYl4EiXPHip0/Glpnv2e1txlsiy09JDXpCkIzNfsSiF5NWOhXErX5uJSO2JIiRuA3L+IOSAaP/9qbBrbUas5v239RGTT9DQxlvbT/Xy02cp1koF7Ow2Xf4zKf9GQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PBz4toH86alDcyWasL2eHOrhWYiI8KK+DYuvBFgTROf3NXhqV2js7bCzRkUVKcsoOmr2KyerojTPjoK7MQmWy4h/gKXToccUj8g7kkTopmy6VBQfck8HAtZyNaru0jVwV7CiPuBz9PbZW6Pd8DXXNJiPv86JSWaVDSxUbeg5AUp5vngkcd+twN7s1eidY7rd/wWe2JKL+CvrAjjKZJOER14SXCg4t7MrM280ytPgOWEEtKIhundCNik1Mtmpt3iUMotx7FL16K3TBa+fBUhAXMwM9NftRaw7X2AzS4eNax7+LqqCqUIEAEilcTktP0WnxLdwaKO4qtEFQj9YW3MZkA==
  • Authentication-results-original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
  • Cc: Jiamei Xie <Jiamei.Xie@xxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, Wei Chen <Wei.Chen@xxxxxxx>
  • Delivery-date: Thu, 07 Jul 2022 15:36:12 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Nodisclaimer: true
  • Original-authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
  • Thread-index: AQHYkRIUbyH8VqZ9NUOQezXCQ2anPa1zC8wAgAAAigA=
  • Thread-topic: [PATCH v4] xen/arm: avoid overflow when setting vtimer in context switch

Hi Julien,

> On 7 Jul 2022, at 16:33, Julien Grall <julien@xxxxxxx> wrote:
> 
> Hi Jiamei,
> 
> On 06/07/2022 09:25, Jiamei Xie wrote:
>> virt_vtimer_save() will calculate the next deadline when the vCPU is
>> scheduled out. At the moment, Xen will use the following equation:
>> virt_timer.cval + virt_time_base.offset - boot_count
>> The three values are 64-bit and one (cval) is controlled by domain. In
>> theory, it would be possible that the domain has started a long time
>> after the system boot. So virt_time_base.offset - boot_count may be a
>> large numbers.
>> This means a domain may inadvertently set a cval so the result would
>> overflow. Consequently, the deadline would be set very far in the
>> future. This could result to loss of timer interrupts or the vCPU
>> getting block "forever".
>> One way to solve the problem, would be to separately
>> 1) compute when the domain was created in ns
>> 2) convert cval to ns
>> 3) Add 1 and 2 together
>> The first part of the equation never change (the value is set/known at
>> domain creation). So take the opportunity to store it in domain structure.
>> Signed-off-by: Jiamei Xie <jiamei.xie@xxxxxxx>
> 
> Reviewed-by: Julien Grall <jgrall@xxxxxxxxxx>
> 
> The commit message is my own, I would like to Bertrand or Stefano to confirm 
> they are happy with it :).

I am ok with it so:
Reviewed-by: Bertrand Marquis <bertrand.marquis@xxxxxxx>

Cheers
Bertrand

> 
> Cheers,
> 
> -- 
> Julien Grall




 


Rackspace

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