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

Re: [XEN v1] xen: arm: Check if timer is enabled for timer irq


  • To: Julien Grall <julien@xxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • From: Ayan Kumar Halder <ayankuma@xxxxxxx>
  • Date: Wed, 10 Aug 2022 17:44:00 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=6SssnIpM48YIUE2OLtl1iBnPsDbowaRmdHSF6rIkGUM=; b=VFNxO5Vc2g40rDVQsR0IL27fOOVsF42NQCdHaJnBnbhp9OB1jXKOUHtW5q09jt/wkM4X8WnMUmFL5O8WsmoDrcQQKZdKKo8JJsBuUKUVaf7qwZNtNxmheoHyNOMQcpNH+Tbjpnjvja1S3dPSuwnv84ZR6U1bk17ZibhEv1Lwr1EkS0Rbk5SbBY0rzLFjxBP1aRgOtjGUPa4Yol4AIvCeEb4w5GRNzmSJ/l4dWj9MSpUC6ZfFXgjbNXy/QB1TR2NNusm5TPgip2pci7CsqP7TGOgK/jzLRMGJTUZhLUc7mz6V85iP2wOotlTh5D7yULIAnoo1zx9/12WSjoF1KgbyTA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FslCcDXOTvkefU6afIs5W6E2fyB6vDYdHFF2NHjTJ7MKsoE6hA0wvE7rK5dHmUAadXWx+0jJPXWPFw+3Hp0cAfQDrqRqalguYVRp3GF1x7zXi3nMVU2MnbMw2oxeugpsSoDE3z6+GxQk6rG/Ruw8wRs6zJtE+aGj+I6a3ENwbM9e5u0j4KhMqk3Mt2Y7U+o5uzP6sMXwQAjNDCbQVXpmoeil3SH3hWN9iR1e8fYNLGfuLynCiZ2couns+vdwxReY8rF08a4ipxmFCcGKl0/76pBhKhjQZgeKush0DUI3/DzPIAIo+KQAp3oRujeKoLTJ34TTk4F9sfjkO+QQNBoSjA==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com;
  • Cc: sstabellini@xxxxxxxxxx, stefanos@xxxxxxx, Volodymyr_Babchuk@xxxxxxxx, bertrand.marquis@xxxxxxx
  • Delivery-date: Wed, 10 Aug 2022 16:44:17 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>


On 10/08/2022 15:51, Julien Grall wrote:
Hi Ayan,
Hi Julien,

On 10/08/2022 15:00, Ayan Kumar Halder wrote:
On 10/08/2022 14:34, Julien Grall wrote:
On 10/08/2022 11:58, Ayan Kumar Halder wrote:
Refer "Arm Architecture Registers DDI 0595", AArch32 system registers,
Checking the 'enable' is not going to add too much overhead. So I am fine if this is added. That said, would you be able to provide more details on how this was spotted?

This was spotted while debugging an unrelated problem while porting Xen on R52. For a different reason, I was not able to get context switch to work correctly.

When I was scrutinizing the timer_interrupt() with the documentation, I found that we are not checking ENABLE.

Although the code works fine today (on aarch32 or aarch64), I thought it is better to add the check for the sake of compliance with the documentation.

Thanks for the clarification. I am quite curious to know why you think our code is not compliant.

As I wrote before, when ENABLE is cleared, you should never have an interrupt because the timer interrupt is level. So I believe our code is compliant with the Arm Arm.

The only reason I am OK with checking ENABLE is because the overhead is limited. If this wasn't the case, then I think I would have wanted clear justification in the commit message *why* this is not compliant.

Sorry, I think I misunderstood this part of the documentation

"When the value of the ENABLE bit is 1, ISTATUS indicates whether the timer condition is met."

I understood this as "ENABLE" need to be checked before "ISTATUS" is checked.

- Ayan


FWIW, Linux seems to use the same approach as us (see [1]). So, if you think this is not compliant, then maybe this is something you also want to consider to fix there?

Cheers,

[1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/clocksource/arm_arch_timer.c#n644




 


Rackspace

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