Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1008676pxb; Thu, 4 Mar 2021 00:21:12 -0800 (PST) X-Google-Smtp-Source: ABdhPJzfCTOjXOzeI02qlVauTot4GAYmnBcMoNsmWLpyA+I7Mg8V3uCSWSvHPxqxswL7GpqKucye X-Received: by 2002:aa7:d588:: with SMTP id r8mr3061828edq.88.1614846071972; Thu, 04 Mar 2021 00:21:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614846071; cv=none; d=google.com; s=arc-20160816; b=Ld42L6yBaps6mM11Jp7BWnjVUuX5BrUjpOtxCMYG3T/LQ8xxcYbhB3W7HtFs0DTipd 8NZQffs/t7dZ/DWvnQvMlYZbPUvoEvAgWmjygwMH11c+WbpEGXTRKpY88f3i598hicgb uzzxmhCz3FGB8GMryAVrhexA8vq8IYv6yamsN5B8St2XRMKbaSBjrabxB5G3vfNOvtlB Bw8E7gfwkI+Z5LNWumkKeNEyWojayoZKK5VGhUlS2xOQ10HHx6pz8tsXvFaUSPwoLZvH vVep/HKhXDMVdzGb0ZNuRnrbuIMR1Pc69no9R6KwJSSM/oOIUZ3KuhAwx0gtoSUHk3Jz 3GnQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:references:in-reply-to:cc:subject:to:from:date; bh=8WoY6I9Mhg6B2YZaS85uVTRsF5NZXT3IYabNmQYM+3I=; b=oYeG5ejum4AMhw/mbGDGdM7bH499envkrxs5MR91ItanUXHRf2Ycvfrqlr4FCoGMNW cX2e14XhamLS5nGyyJ2dTpXWSyS0iS1wlph7HD1cPk4dPVtdWRFLQ6nqhjW71m6XUW9v hjSAhQtEgRoo+rQLTR5oP9G8m8bP465bu9sOzZfN41Tp85WN1QI/DHjRNN+/E9mkFAR2 RVL2ic8WMawUdsha0QDZx5rPxdFr38ivwaFnPAeMlv0NFEySvwVxVO+lebojL9LHCRnS I/rkrIrtQGo0q5+iUgMnrFhkOZLSgI5qGW9yZQrD5dIB+TnEhYdDGKSM8sh7xAY8mlY+ eu5Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c23si5404782edv.312.2021.03.04.00.20.49; Thu, 04 Mar 2021 00:21:11 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1351867AbhCCLub (ORCPT + 99 others); Wed, 3 Mar 2021 06:50:31 -0500 Received: from mx.socionext.com ([202.248.49.38]:13676 "EHLO mx.socionext.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1578259AbhCCEjx (ORCPT ); Tue, 2 Mar 2021 23:39:53 -0500 Received: from unknown (HELO kinkan2-ex.css.socionext.com) ([172.31.9.52]) by mx.socionext.com with ESMTP; 03 Mar 2021 13:33:29 +0900 Received: from mail.mfilter.local (m-filter-1 [10.213.24.61]) by kinkan2-ex.css.socionext.com (Postfix) with ESMTP id 2A3F62059025; Wed, 3 Mar 2021 13:33:29 +0900 (JST) Received: from 172.31.9.53 (172.31.9.53) by m-FILTER with ESMTP; Wed, 3 Mar 2021 13:33:29 +0900 Received: from yuzu.css.socionext.com (yuzu [172.31.8.45]) by iyokan2.css.socionext.com (Postfix) with ESMTP id A14AEB1D40; Wed, 3 Mar 2021 13:33:28 +0900 (JST) Received: from [10.213.132.48] (unknown [10.213.132.48]) by yuzu.css.socionext.com (Postfix) with ESMTP id 7A78112053F; Wed, 3 Mar 2021 13:33:28 +0900 (JST) Date: Wed, 03 Mar 2021 13:33:28 +0900 From: Kunihiko Hayashi To: Konrad Rzeszutek Wilk Subject: Re: [PATCH] swiotlb: Fix type of max_slot Cc: Christoph Hellwig , Marek Szyprowski , Robin Murphy , Jianxiong Gao , iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org In-Reply-To: <436bf276-5b16-62af-6a32-70f91fce7557@oracle.com> References: <1614705688-10567-1-git-send-email-hayashi.kunihiko@socionext.com> <436bf276-5b16-62af-6a32-70f91fce7557@oracle.com> Message-Id: <20210303133328.4D12.4A936039@socionext.com> MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Mailer: Becky! ver. 2.70 [ja] Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 2 Mar 2021 15:20:08 -0500 Konrad Rzeszutek Wilk wrote: > On 3/2/21 12:21 PM, Kunihiko Hayashi wrote: > > After the refactoring phase, the type of max_slot has changed from unsigned > > long to unsigned int. The return type of the function get_max_slots() and > > the 4th argument type of iommu_is_span_boundary() are different from the > > type of max_slot. Finally, asserts BUG_ON in iommu_is_span_boundary(). > > > Cc: Christoph Hellwig > > Fixes: 567d877f9a7d ("swiotlb: refactor swiotlb_tbl_map_single") > > Signed-off-by: Kunihiko Hayashi > > I think this is all good. Looking at Linus's master I see: > > > 537 unsigned long max_slots = get_max_slots(boundary_mask); > > ? Thanks for the information, and sorry for that. I found it in next-20210226: 567d877f9a7d ("swiotlb: refactor swiotlb_tbl_map_single") And it has already fixed in next-20210301: 26a7e094783d ("swiotlb: refactor swiotlb_tbl_map_single") $ git diff 567d877f9a7d..26a7e094783d diff --git a/kernel/dma/swiotlb.c b/kernel/dma/swiotlb.c index 381c24e..6962cb4 100644 --- a/kernel/dma/swiotlb.c +++ b/kernel/dma/swiotlb.c @@ -496,7 +496,7 @@ static int find_slots(struct device *dev, size_t alloc_size) unsigned long boundary_mask = dma_get_seg_boundary(dev); dma_addr_t tbl_dma_addr = phys_to_dma_unencrypted(dev, io_tlb_start) & boundary_mask; - unsigned int max_slots = get_max_slots(boundary_mask); + unsigned long max_slots = get_max_slots(boundary_mask); unsigned int nslots = nr_slots(alloc_size), stride = 1; unsigned int index, wrap, count = 0, i; unsigned long flags; Thank you, --- Best Regards, Kunihiko Hayashi