Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp8452303ybn; Tue, 1 Oct 2019 08:18:21 -0700 (PDT) X-Google-Smtp-Source: APXvYqyU/9faTw0BQ1RFFjS5nx4QZvPnxOpTJrHpdDIlAL78hNHc7l9M6xXDtEh+On9Q0ffxmVaM X-Received: by 2002:a17:906:278a:: with SMTP id j10mr24427577ejc.228.1569943101268; Tue, 01 Oct 2019 08:18:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569943101; cv=none; d=google.com; s=arc-20160816; b=aGmFrRCUsACPuuTwIxdJRGqE29zzqREfk1IlYncv39NFIaPdjg7zKt+0eOG6wxmCWP N5LrGEqkXuB7NA6PO3VkOt5zhK5ACSZisc/4OrpMqpOin7+oTdlri3eubjK0Iq5HRDs5 EvB+3JDiKEqZkTbnPCovFf/SgtylL3dQJai/uIuO7svNvWWnIDAdo5mGQAKryixaRi56 3mjMkjWOrLzca5+m9KuXBhWqpyjRzzKrXlTGCCsyds+Vy3U7msYNIFwwqRMWSCvIHyPj bOHZ83xDvQrqkEfOOnYkfdenBJdcaEyVCEtE0QsIFn/fCwxQmOj5KCMkBt5BzDehV4ot vU6A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=mtA4iqbL3ft0jv3LdFzHMBwsVdnRli1SCI3N+/lOSMA=; b=CAcdquL6qeuG+OUuacvY751wN9E0kFeeCo+PiNoja9CU6mGG1OSXAwGJTpvLssUdiV tLarHN8szdkaAHWtsCj+luVAlq72dVh9797A7DvmLsMffYvTZn+24H9GVW6UymisZuL1 GY/rad4u8nOebvlSlYJ8G/IDZEPXBVoiJbhlZPGyUc5eXWXYj6YYuL5N0/C+vyISDlMH rbwofFVqQ5/70D1Y0JslKFZPElQ9bpbAvmwSHgrG2LUTobC/A2RqRq8bXZ6A2/C5uy7T QBO8rF32cf00oANQ2o0Nc6ji4PuHrD77Xxfe4Lg//5gzzK+3mMkNHQ+HZZMtAAzX9+YR OAyA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j4si9105701ejv.67.2019.10.01.08.17.55; Tue, 01 Oct 2019 08:18:21 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389526AbfJAPOm (ORCPT + 99 others); Tue, 1 Oct 2019 11:14:42 -0400 Received: from mx2.suse.de ([195.135.220.15]:42270 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2389129AbfJAPOm (ORCPT ); Tue, 1 Oct 2019 11:14:42 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 71301AFC6; Tue, 1 Oct 2019 15:14:40 +0000 (UTC) Received: by unicorn.suse.cz (Postfix, from userid 1000) id E9E8FE0083; Tue, 1 Oct 2019 17:14:39 +0200 (CEST) Date: Tue, 1 Oct 2019 17:14:39 +0200 From: Michal Kubecek To: netdev@vger.kernel.org Cc: Borislav Petkov , Alex Vesker , Stephen Hemminger , linux-rdma@vger.kernel.org, Saeed Mahameed , Leon Romanovsky , lkml Subject: Re: ERROR: "__umoddi3" [drivers/net/ethernet/mellanox/mlx5/core/mlx5_core.ko] undefined! Message-ID: <20191001151439.GA24815@unicorn.suse.cz> References: <20190930141316.GG29694@zn.tnic> <20190930154535.GC22120@unicorn.suse.cz> <20190930162910.GI29694@zn.tnic> <20190930095516.0f55513a@hermes.lan> <20190930184031.GJ29694@zn.tnic> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190930184031.GJ29694@zn.tnic> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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