From: Michal Kubecek <mkubecek@suse.cz>
To: netdev@vger.kernel.org
Cc: Borislav Petkov <bp@alien8.de>, Alex Vesker <valex@mellanox.com>,
Stephen Hemminger <stephen@networkplumber.org>,
linux-rdma@vger.kernel.org, Saeed Mahameed <saeedm@mellanox.com>,
Leon Romanovsky <leon@kernel.org>,
lkml <linux-kernel@vger.kernel.org>
Subject: Re: ERROR: "__umoddi3" [drivers/net/ethernet/mellanox/mlx5/core/mlx5_core.ko] undefined!
Date: Tue, 1 Oct 2019 17:14:39 +0200 [thread overview]
Message-ID: <20191001151439.GA24815@unicorn.suse.cz> (raw)
In-Reply-To: <20190930184031.GJ29694@zn.tnic>
On Mon, Sep 30, 2019 at 08:40:31PM +0200, Borislav Petkov wrote:
> On Mon, Sep 30, 2019 at 09:55:16AM -0700, Stephen Hemminger wrote:
> > Could also us div_u64_rem here?
>
> Yah, the below seems to work and the resulting asm looks sensible to me
> but someone should definitely double-check me as I don't know this code
> at all.
>
> Thx.
>
> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_icm_pool.c b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_icm_pool.c
> index 913f1e5aaaf2..b4302658e5f8 100644
> --- a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_icm_pool.c
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_icm_pool.c
> @@ -137,7 +137,7 @@ dr_icm_pool_mr_create(struct mlx5dr_icm_pool *pool,
>
> icm_mr->icm_start_addr = icm_mr->dm.addr;
>
> - align_diff = icm_mr->icm_start_addr % align_base;
> + div_u64_rem(icm_mr->icm_start_addr, align_base, &align_diff);
> if (align_diff)
> icm_mr->used_length = align_base - align_diff;
>
>
While this fixes 32-bit builds, it breaks 64-bit ones as align_diff is
64-bit and div_u64_rem expects pointer to u32. :-(
I checked that align_base is always a power of two so that we could get
away with
align_diff = icm_mr->icm_start_addr & (align_base - 1)
I'm not sure, however, if it's safe to assume align_base will always
have to be a power of two or if we should add a check for safety.
(Cc-ing also author of commit 29cf8febd185 ("net/mlx5: DR, ICM pool
memory allocator").)
Michal
next prev parent reply other threads:[~2019-10-01 15:14 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-30 14:13 ERROR: "__umoddi3" [drivers/net/ethernet/mellanox/mlx5/core/mlx5_core.ko] undefined! Borislav Petkov
2019-09-30 15:45 ` Michal Kubecek
2019-09-30 16:29 ` Borislav Petkov
2019-09-30 16:52 ` Stephen Hemminger
2019-09-30 16:55 ` Stephen Hemminger
2019-09-30 18:40 ` Borislav Petkov
2019-10-01 15:14 ` Michal Kubecek [this message]
2019-10-15 20:29 ` Saeed Mahameed
2019-10-15 20:45 ` Saeed Mahameed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20191001151439.GA24815@unicorn.suse.cz \
--to=mkubecek@suse.cz \
--cc=bp@alien8.de \
--cc=leon@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=saeedm@mellanox.com \
--cc=stephen@networkplumber.org \
--cc=valex@mellanox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).