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]
Date:   Sun, 17 Oct 2021 11:52:07 +0200 (CEST)
From:   Julia Lawall <julia.lawall@...ia.fr>
To:     Kushal-kothari <kushalkothari285@...il.com>
cc:     linux-arm-kernel@...ts.infradead.org, mike.rapoport@...il.com,
        kushalkothari2850@...il.com, outreachy-kernel@...glegroups.com,
        gregkh@...uxfoundation.org, linux-kernel@...r.kernel.org,
        linux-staging@...ts.linux.dev, nsaenz@...nel.org,
        bcm-kernel-feedback-list@...adcom.com
Subject: Re: [Outreachy kernel] [PATCH v2] staging: vc04_services: replace
 msleep() by usleep_range()



On Sun, 17 Oct 2021, Kushal-kothari wrote:

> Fixed the warning:-msleep < 20ms can sleep for up to 20ms by replacing
> msleep(unsigned long msecs) by usleep_range(unsigned long min, unsigned long max)
> in usecs as msleep(1ms~20ms) can sleep for upto 20 ms.

In addition to Greg's comments, the log message is still not really ideal.
There is still the word Fix that doesn't really contribute anything.  The
prototypes of msleep and usleep are also not useful - the reader either
knows them or can easily find them.  A better messge could be something
like:

"Checkpatch warns that an msleep of less than 20ms can sleep for up to
20ms.  Replace msleep(1) by a call to usleep_range that makes the possible
range (1ms - 20ms) explicit."

But the argument to msleep is in milliseconds.  If the appropriate first
argument to usleep_range is 1000, then it would seem that the second
argument should be 20000?

One thing that you can do to try to understand such a problem better is to
see what others have done before to resolve it.  You could try a command
like

git log -S msleep -p

to see commits that have changed the number of calls to msleep.

I reiterate Greg's comments that making these timing changes without being
able to test the result is risky.  These are just suggestions of some
methodologies that you could follow for a change where it is more clear
that the change is correct.

julia

>
> Signed-off-by: Kushal-kothari <kushalkothari285@...il.com>
> ---
>
> Changes from v1: Reword both the subject and the log message.
>
>  drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
> index 6fbafdfe340f..80a7898c5331 100644
> --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
> +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
> @@ -857,7 +857,7 @@ vchiq_bulk_transmit(unsigned int handle, const void *data, unsigned int size,
>  		if (status != VCHIQ_RETRY)
>  			break;
>
> -		msleep(1);
> +		usleep_range(1000, 2000);
>  	}
>
>  	return status;
> @@ -894,7 +894,7 @@ enum vchiq_status vchiq_bulk_receive(unsigned int handle, void *data,
>  		if (status != VCHIQ_RETRY)
>  			break;
>
> -		msleep(1);
> +		usleep_range(1000, 2000);
>  	}
>
>  	return status;
> --
> 2.25.1
>
> --
> You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to outreachy-kernel+unsubscribe@...glegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/20211017092900.134752-1-kushalkothari285%40gmail.com.
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ