* [PATCH v2] linux/dim: Fix divide 0 in RDMA DIM.
@ 2022-06-27 11:30 Tao Liu
2022-06-27 12:51 ` Leon Romanovsky
0 siblings, 1 reply; 3+ messages in thread
From: Tao Liu @ 2022-06-27 11:30 UTC (permalink / raw)
To: linux-rdma; +Cc: saeedm, talgi, leonro, mgurtovoy, jgg, yaminf, thomas.liu
We hit a divide 0 error in ofed 5.1.2.3.7.1. It is caused in
rdma_dim_stats_compare() when prev->cpe_ratio == 0.
dim.c and rdma_dim.c in ofed share same code with upstream.
We check the 0 case in IS_SIGNIFICANT_DIFF(), and do not change
decision order.
Signed-off-by: Tao Liu <thomas.liu@ucloud.cn>
---
include/linux/dim.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/linux/dim.h b/include/linux/dim.h
index b698266d0035..6c5733981563 100644
--- a/include/linux/dim.h
+++ b/include/linux/dim.h
@@ -21,7 +21,7 @@
* We consider 10% difference as significant.
*/
#define IS_SIGNIFICANT_DIFF(val, ref) \
- (((100UL * abs((val) - (ref))) / (ref)) > 10)
+ ((ref) && (((100UL * abs((val) - (ref))) / (ref)) > 10))
/*
* Calculate the gap between two values.
--
2.30.1 (Apple Git-130)
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v2] linux/dim: Fix divide 0 in RDMA DIM.
2022-06-27 11:30 [PATCH v2] linux/dim: Fix divide 0 in RDMA DIM Tao Liu
@ 2022-06-27 12:51 ` Leon Romanovsky
2022-06-27 12:57 ` Max Gurtovoy
0 siblings, 1 reply; 3+ messages in thread
From: Leon Romanovsky @ 2022-06-27 12:51 UTC (permalink / raw)
To: Tao Liu; +Cc: linux-rdma, saeedm, talgi, mgurtovoy, jgg, yaminf
On Mon, Jun 27, 2022 at 07:30:36PM +0800, Tao Liu wrote:
> We hit a divide 0 error in ofed 5.1.2.3.7.1. It is caused in
> rdma_dim_stats_compare() when prev->cpe_ratio == 0.
>
> dim.c and rdma_dim.c in ofed share same code with upstream.
> We check the 0 case in IS_SIGNIFICANT_DIFF(), and do not change
> decision order.
>
> Signed-off-by: Tao Liu <thomas.liu@ucloud.cn>
> ---
> include/linux/dim.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
I liked the commit message from v1 more.
It had proper kernel panic dump together with Fixes line.
https://lore.kernel.org/all/20220623085858.42945-1-thomas.liu@ucloud.cn
The change itself is ok.
Thanks,
Acked-by: Leon Romanovsky <leonro@nvidia.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2] linux/dim: Fix divide 0 in RDMA DIM.
2022-06-27 12:51 ` Leon Romanovsky
@ 2022-06-27 12:57 ` Max Gurtovoy
0 siblings, 0 replies; 3+ messages in thread
From: Max Gurtovoy @ 2022-06-27 12:57 UTC (permalink / raw)
To: Leon Romanovsky, Tao Liu; +Cc: linux-rdma, saeedm, talgi, jgg, yaminf
On 6/27/2022 3:51 PM, Leon Romanovsky wrote:
> On Mon, Jun 27, 2022 at 07:30:36PM +0800, Tao Liu wrote:
>> We hit a divide 0 error in ofed 5.1.2.3.7.1. It is caused in
>> rdma_dim_stats_compare() when prev->cpe_ratio == 0.
>>
>> dim.c and rdma_dim.c in ofed share same code with upstream.
>> We check the 0 case in IS_SIGNIFICANT_DIFF(), and do not change
>> decision order.
>>
>> Signed-off-by: Tao Liu <thomas.liu@ucloud.cn>
>> ---
>> include/linux/dim.h | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
> I liked the commit message from v1 more.
I think you need to do a combination of the commit msg (remove the ofed
notion):
"fix a divide 0 error in rdma_dim_stats_compare() when prev->cpe_ratio == 0.
CallTrace:
....
Fixes(...)"
Otherwise,
Looks good,
Reviewed-by: Max Gurtovoy <mgurtovoy@nvidia.com>
> It had proper kernel panic dump together with Fixes line.
> https://lore.kernel.org/all/20220623085858.42945-1-thomas.liu@ucloud.cn
>
> The change itself is ok.
>
> Thanks,
> Acked-by: Leon Romanovsky <leonro@nvidia.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-06-27 12:57 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-06-27 11:30 [PATCH v2] linux/dim: Fix divide 0 in RDMA DIM Tao Liu
2022-06-27 12:51 ` Leon Romanovsky
2022-06-27 12:57 ` Max Gurtovoy
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.