lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <6f9dcc74-5688-4bcb-9bb6-15c34df9317b@linux.microsoft.com>
Date: Fri, 18 Oct 2024 17:46:17 +0530
From: Naman Jain <namjain@...ux.microsoft.com>
To: Easwar Hariharan <eahariha@...ux.microsoft.com>, lkp@...el.com,
 "K. Y. Srinivasan" <kys@...rosoft.com>,
 Haiyang Zhang <haiyangz@...rosoft.com>, Wei Liu <wei.liu@...nel.org>,
 Dexuan Cui <decui@...rosoft.com>,
 "open list:Hyper-V/Azure CORE AND DRIVERS" <linux-hyperv@...r.kernel.org>,
 open list <linux-kernel@...r.kernel.org>
Subject: Re: [RFC PATCH] drivers: hv: Convert open-coded timeouts to
 msecs_to_jiffies()



On 10/17/2024 4:07 AM, Easwar Hariharan wrote:
> We have several places where timeouts are open-coded as N (seconds) * HZ,
> but best practice is to use msecs_to_jiffies(). Convert the timeouts to
> make them HZ invariant.
> 
> Signed-off-by: Easwar Hariharan <eahariha@...ux.microsoft.com>
> ---
>   drivers/hv/hv_balloon.c  | 9 +++++----
>   drivers/hv/hv_kvp.c      | 4 ++--
>   drivers/hv/hv_snapshot.c | 6 ++++--
>   drivers/hv/vmbus_drv.c   | 2 +-
>   4 files changed, 12 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/hv/hv_balloon.c b/drivers/hv/hv_balloon.c
> index c38dcdfcb914d..3017d41f12681 100644
> --- a/drivers/hv/hv_balloon.c

<.>


>   	if (wait_for_completion_timeout(
> -		&vmbus_connection.ready_for_resume_event, 10 * HZ) == 0)
> +		&vmbus_connection.ready_for_resume_event, msecs_to_jiffies(10 * 1000)) == 0)
>   		pr_err("Some vmbus device is missing after suspending?\n");
>   
>   	/* Reset the event for the next suspend. */


Looks good to me. There can be different ways of passing arg to
msecs_to_jiffies though-

for 10 seconds
* 10000
* 10 * 1000
* 10 * MSEC_PER_SEC

I don't have any strong opinion on this, and you can probably choose
whichever feels better.

Even the current implementation with x * HZ works fine, with different
HZ values. But, yes, I agree that using msecs_to_jiffies is better.

Regards,
Naman

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ