* [PATCH] md/raid5: Fix divide type in raid5_make_request()
@ 2022-06-23 16:55 Logan Gunthorpe
2022-06-23 17:15 ` Song Liu
0 siblings, 1 reply; 3+ messages in thread
From: Logan Gunthorpe @ 2022-06-23 16:55 UTC (permalink / raw)
To: linux-kernel, linux-raid, Song Liu; +Cc: Logan Gunthorpe, kernel test robot
0day reports a build failure on the hexagon architecture:
ld.lld: error: undefined symbol: __hexagon_udivdi3
referenced by raid5.c
md/raid5.o:(raid5_make_request) in archive drivers/built-in.a
referenced by raid5.c
md/raid5.o:(raid5_make_request) in archive drivers/built-in.a
did you mean: __hexagon_udivsi3
defined in: arch/hexagon/built-in.a(lib/udivsi3.o)
This is caused by using DIV_ROUND_UP on a sector_t type.
The actual value is known to be less than 256 so a wide 64bit divide
here is not desirable. Thus cast the argument to an int to ensure it
uses a 32bit divide.
Fixes: 681fb14a7100 ("md/raid5: Pivot raid5_make_request()")
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Logan Gunthorpe <logang@deltatee.com>
---
drivers/md/raid5.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
index 5723a497108a..9d25696b793d 100644
--- a/drivers/md/raid5.c
+++ b/drivers/md/raid5.c
@@ -6091,7 +6091,7 @@ static bool raid5_make_request(struct mddev *mddev, struct bio * bi)
bi->bi_next = NULL;
bitmap_set(ctx.sectors_to_do, 0,
- DIV_ROUND_UP(ctx.last_sector - logical_sector,
+ DIV_ROUND_UP((int)(ctx.last_sector - logical_sector),
RAID5_STRIPE_SECTORS(conf)));
pr_debug("raid456: %s, logical %llu to %llu\n", __func__,
base-commit: 57c19f921f8081c1a9444dc7f3f6b3ea43fe612e
--
2.30.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] md/raid5: Fix divide type in raid5_make_request()
2022-06-23 16:55 [PATCH] md/raid5: Fix divide type in raid5_make_request() Logan Gunthorpe
@ 2022-06-23 17:15 ` Song Liu
2022-06-23 17:18 ` Logan Gunthorpe
0 siblings, 1 reply; 3+ messages in thread
From: Song Liu @ 2022-06-23 17:15 UTC (permalink / raw)
To: Logan Gunthorpe; +Cc: open list, linux-raid, kernel test robot
On Thu, Jun 23, 2022 at 9:56 AM Logan Gunthorpe <logang@deltatee.com> wrote:
>
> 0day reports a build failure on the hexagon architecture:
>
> ld.lld: error: undefined symbol: __hexagon_udivdi3
> referenced by raid5.c
> md/raid5.o:(raid5_make_request) in archive drivers/built-in.a
> referenced by raid5.c
> md/raid5.o:(raid5_make_request) in archive drivers/built-in.a
> did you mean: __hexagon_udivsi3
> defined in: arch/hexagon/built-in.a(lib/udivsi3.o)
>
> This is caused by using DIV_ROUND_UP on a sector_t type.
>
> The actual value is known to be less than 256 so a wide 64bit divide
> here is not desirable. Thus cast the argument to an int to ensure it
> uses a 32bit divide.
I force pushed an update that uses DIV_ROUND_UP_SECTOR_T instead.
I guess that should also work?
Thanks,
Song
>
> Fixes: 681fb14a7100 ("md/raid5: Pivot raid5_make_request()")
> Reported-by: kernel test robot <lkp@intel.com>
> Signed-off-by: Logan Gunthorpe <logang@deltatee.com>
> ---
> drivers/md/raid5.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
> index 5723a497108a..9d25696b793d 100644
> --- a/drivers/md/raid5.c
> +++ b/drivers/md/raid5.c
> @@ -6091,7 +6091,7 @@ static bool raid5_make_request(struct mddev *mddev, struct bio * bi)
> bi->bi_next = NULL;
>
> bitmap_set(ctx.sectors_to_do, 0,
> - DIV_ROUND_UP(ctx.last_sector - logical_sector,
> + DIV_ROUND_UP((int)(ctx.last_sector - logical_sector),
> RAID5_STRIPE_SECTORS(conf)));
>
> pr_debug("raid456: %s, logical %llu to %llu\n", __func__,
>
> base-commit: 57c19f921f8081c1a9444dc7f3f6b3ea43fe612e
> --
> 2.30.2
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] md/raid5: Fix divide type in raid5_make_request()
2022-06-23 17:15 ` Song Liu
@ 2022-06-23 17:18 ` Logan Gunthorpe
0 siblings, 0 replies; 3+ messages in thread
From: Logan Gunthorpe @ 2022-06-23 17:18 UTC (permalink / raw)
To: Song Liu; +Cc: open list, linux-raid, kernel test robot
On 2022-06-23 11:15, Song Liu wrote:
> On Thu, Jun 23, 2022 at 9:56 AM Logan Gunthorpe <logang@deltatee.com> wrote:
>>
>> 0day reports a build failure on the hexagon architecture:
>>
>> ld.lld: error: undefined symbol: __hexagon_udivdi3
>> referenced by raid5.c
>> md/raid5.o:(raid5_make_request) in archive drivers/built-in.a
>> referenced by raid5.c
>> md/raid5.o:(raid5_make_request) in archive drivers/built-in.a
>> did you mean: __hexagon_udivsi3
>> defined in: arch/hexagon/built-in.a(lib/udivsi3.o)
>>
>> This is caused by using DIV_ROUND_UP on a sector_t type.
>>
>> The actual value is known to be less than 256 so a wide 64bit divide
>> here is not desirable. Thus cast the argument to an int to ensure it
>> uses a 32bit divide.
>
> I force pushed an update that uses DIV_ROUND_UP_SECTOR_T instead.
> I guess that should also work?
Ah, yes, that'll also fix the bug. I chose to cast to minimize the
performance impact of an unnecessarily wide divide. But I don't have any
strong basis to suggest the performance will be worse with the wider
division. So fix it whichever way you think is best.
Logan
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-06-23 18:06 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-23 16:55 [PATCH] md/raid5: Fix divide type in raid5_make_request() Logan Gunthorpe
2022-06-23 17:15 ` Song Liu
2022-06-23 17:18 ` Logan Gunthorpe
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.