Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp5911773pxj; Wed, 23 Jun 2021 11:39:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwv8WmP3hC4ISgACMlNLIYmGGPl8pwxTaMpVPaQbZhwV93ahSqqIWoivAd4nZwQXkLspris X-Received: by 2002:a05:6402:278a:: with SMTP id b10mr1717761ede.54.1624473571953; Wed, 23 Jun 2021 11:39:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624473571; cv=none; d=google.com; s=arc-20160816; b=urpJozTOABWcAThJ2e+vqoYPa+iNezefMC4VUxR5bzPYGvTtcdz6DrhxNzdnoCswn/ 4+LN7D23/zbvmgh+HmwsiTOQbpEhTKIwo0GM5K7UY8WqsnpgQ3DrGjEFe1xEeNbFFsFV NzpWTFHSl3PsouKR4jvN9G8Vllby7ud+uDGUooJYWqEpM2Wd9LYN1cCSp8RlzhfQ/lzW /IEwl5nyLbvixkXViTPRqMI4YGeBMwbGzAzPL/glDU1PH3B8UDZUZl1pHOTKzQ4FmA+W /dpB4DI3XOb+DxD+huqLScrXqZoB6PhU+ZJhsTTqQjlXI4onmc9aYGeoQ0ugCZPBK2/+ AAWg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=AJPDMinCzE8iyIB1rejNnAKWUPXJSQXF6MGJ6A0Zr60=; b=ABgejaA5h15416Xu1vtsbDL4l6miLf76TZQCOnMTM1Q7YQoo2jbmYK/wVL2XAhl3ys nXqypJRbcA4iCg1YsHmeeoIs5t9bHe2+2asbuQMcWpdnpQMpwMH3VobifJg3PEVm92px VG6BLzsnqoBXDvGpEE0rz4oCVl51la9FVRX8O7H72De05nS/12Xyto+nxiBEg8dszkX8 r6wc7rOg82PlyeboP9QYJreajt6CY1DkGwZGGYs6/yIYykukt2yWY4zd0zyPtp2hjYV3 6Ep1+k2VCQnuyanr9TNwJJqzPOv7UoZn4irO9lcfopAB2gp6qc2hRsv7RJdiv+BK3inv nTSA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=pew0mCSt; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id be3si585988edb.568.2021.06.23.11.39.08; Wed, 23 Jun 2021 11:39:31 -0700 (PDT) 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; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=pew0mCSt; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229794AbhFWSkH (ORCPT + 99 others); Wed, 23 Jun 2021 14:40:07 -0400 Received: from mail.kernel.org ([198.145.29.99]:58450 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229523AbhFWSkF (ORCPT ); Wed, 23 Jun 2021 14:40:05 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 3C1E061185; Wed, 23 Jun 2021 18:37:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1624473468; bh=K9ctSOOXg/HLNG/KMzo+bt+uXbhOKksVK31vHq8QEAc=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=pew0mCStiOrsU0bWjM0b54f2cDTk0BFJYuT7oL0Hl93RfndilrrpZ00P5EcbMTEX/ /lbkdoUtJfhzG6xhgO6NWycBIcDRvmNhEJGTWAKSFbeL2aFhOe2jpLrVodVSrKGkzr gHxURUCJo+Bry9z+VHTZDIOT/ABoSs0DN2Tjo7IL/UHU38iukI2V/m5xdJIYc7NUws 7NMVKjT7vcMuSIu2fy0OZOLVI8+LwwecPlMOHv27TBpClMax/sAEQmgzVN3VS5iIlB HGiL4Uzn3xHn2voW7eTXBh/NjM9NO32LN+GkhPpRHj+kINjyQizH9+P5WDGveYcADU kFBCzfquuEa8w== Date: Wed, 23 Jun 2021 19:37:37 +0100 From: Will Deacon To: Qian Cai Cc: Claire Chang , Rob Herring , mpe@ellerman.id.au, Joerg Roedel , Frank Rowand , Konrad Rzeszutek Wilk , boris.ostrovsky@oracle.com, jgross@suse.com, Christoph Hellwig , Marek Szyprowski , heikki.krogerus@linux.intel.com, thomas.hellstrom@linux.intel.com, peterz@infradead.org, benh@kernel.crashing.org, joonas.lahtinen@linux.intel.com, dri-devel@lists.freedesktop.org, chris@chris-wilson.co.uk, grant.likely@arm.com, paulus@samba.org, mingo@kernel.org, jxgao@google.com, sstabellini@kernel.org, Saravana Kannan , xypron.glpk@gmx.de, "Rafael J . Wysocki" , Bartosz Golaszewski , bskeggs@redhat.com, linux-pci@vger.kernel.org, xen-devel@lists.xenproject.org, Thierry Reding , intel-gfx@lists.freedesktop.org, matthew.auld@intel.com, linux-devicetree , daniel@ffwll.ch, airlied@linux.ie, maarten.lankhorst@linux.intel.com, linuxppc-dev@lists.ozlabs.org, jani.nikula@linux.intel.com, Nicolas Boichat , rodrigo.vivi@intel.com, bhelgaas@google.com, Dan Williams , Andy Shevchenko , Greg KH , Randy Dunlap , lkml , "list@263.net:IOMMU DRIVERS" , Jim Quinlan , thomas.lendacky@amd.com, Robin Murphy , bauerman@linux.ibm.com Subject: Re: [PATCH v14 06/12] swiotlb: Use is_swiotlb_force_bounce for swiotlb data bouncing Message-ID: <20210623183736.GA472@willie-the-truck> References: <20210619034043.199220-1-tientzu@chromium.org> <20210619034043.199220-7-tientzu@chromium.org> <76c3343d-72e5-9df3-8924-5474ee698ef4@quicinc.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <76c3343d-72e5-9df3-8924-5474ee698ef4@quicinc.com> User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jun 23, 2021 at 12:39:29PM -0400, Qian Cai wrote: > > > On 6/18/2021 11:40 PM, Claire Chang wrote: > > Propagate the swiotlb_force into io_tlb_default_mem->force_bounce and > > use it to determine whether to bounce the data or not. This will be > > useful later to allow for different pools. > > > > Signed-off-by: Claire Chang > > Reviewed-by: Christoph Hellwig > > Tested-by: Stefano Stabellini > > Tested-by: Will Deacon > > Acked-by: Stefano Stabellini > > Reverting the rest of the series up to this patch fixed a boot crash with NVMe on today's linux-next. Hmm, so that makes patch 7 the suspicious one, right? Looking at that one more closely, it looks like swiotlb_find_slots() takes 'alloc_size + offset' as its 'alloc_size' parameter from swiotlb_tbl_map_single() and initialises 'mem->slots[i].alloc_size' based on 'alloc_size + offset', which looks like a change in behaviour from the old code, which didn't include the offset there. swiotlb_release_slots() then adds the offset back on afaict, so we end up accounting for it twice and possibly unmap more than we're supposed to? Will