Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp5915392pxj; Wed, 23 Jun 2021 11:45:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyxdefr7zZgPITRccVNHwEIYryo0KiI6wu8fPfFQpiXXmqg66oEd3e8ftn6BZJrdbQa850Y X-Received: by 2002:a92:d348:: with SMTP id a8mr603739ilh.93.1624473931553; Wed, 23 Jun 2021 11:45:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624473931; cv=none; d=google.com; s=arc-20160816; b=YjJ1P1vlm47sG9t214afqO48seZ9b1eNHCygQ3vnUR1t3JSAJlRGJm8npU7nJfLKqb 2sEeQt/UDwdrI0uIUmmLVeyMwJ8jMwf3KPBdE5EaP3VGyQ7QOTMnt52p8+yL2vfl9m/U BwJTVYJ5XEoiwk2bcYjwlCoy4yFBbktNcfAO7+GJsu6cWKygGWk9lTV9UW3dG5NP7MdL U+Lh1RjPAxBcuPJWhaGYQC/ukGFaDHQTbUMXYT25UhQwq8VQVzHn1o/hzBOviGf8FcmL j1B3FdOCB+x2KlYfzZ0vWy62gaztzs7S7vPTujufrsf9s8oVXs6CbLCf4kIpeD1oxAlN 38Jw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=p3UgskNuF+GMB39eWl1IY+L0F7cloUcgAkPVObgl16k=; b=oUJbXLXRpzLEL+qHtHP2lQ4qbFWUZkbcJRUvqPCfwNlGVPxHhKLB0R3uYIW04f6/rF QGecSY+uGrLklg7Re+ih3sq5lu1kWFz6VvMIryOryVI+g9ziG2vKxWkXBt9umASyW6eh qvJXTId5onh3/+Me8X5E/W09HO5UxGB3Dzof6Fz198hqmXuswfUph+Q4Z0IQPlWPw24n bVb4Xa9KR274aplUDcBy6Wb05xJ194Rxel6lF+wpEgUPb/8TPTbqcScA29xzJXdgPfxR ifyX/UfMmYrrY3FUdavK4D2tlK2ZCjHZegedYy1zaqNGs1L//IF6bpFj0FDVK1+PxqR6 gDZQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@quicinc.com header.s=qcdkim header.b=tY8226zh; 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=fail (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w21si823199jal.38.2021.06.23.11.45.17; Wed, 23 Jun 2021 11:45: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=fail header.i=@quicinc.com header.s=qcdkim header.b=tY8226zh; 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=fail (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229882AbhFWSrA (ORCPT + 99 others); Wed, 23 Jun 2021 14:47:00 -0400 Received: from alexa-out-sd-02.qualcomm.com ([199.106.114.39]:40932 "EHLO alexa-out-sd-02.qualcomm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229523AbhFWSrA (ORCPT ); Wed, 23 Jun 2021 14:47:00 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=quicinc.com; i=@quicinc.com; q=dns/txt; s=qcdkim; t=1624473882; x=1656009882; h=subject:to:cc:references:from:message-id:date: mime-version:in-reply-to:content-transfer-encoding; bh=N07wTNJU87j8J0GwX4jxR069BiU3mP0B1FK82hyEXsU=; b=tY8226zhhKnXNPU9rX3v+Qz+lpCfzG0jhsIEWrTpx/TST7X0tgEf4JgD 2Y65V4YOehsiJf6flFqbR62zZsZj1Fr0VeDsZ0dICzu+iEBowFahrbO1N M+Lk8k1v/CZYWkPQ3v2k4YcFQh8UvSkuxoUrK8gIPb4Nh2AeXXZFycKKY U=; Received: from unknown (HELO ironmsg05-sd.qualcomm.com) ([10.53.140.145]) by alexa-out-sd-02.qualcomm.com with ESMTP; 23 Jun 2021 11:44:42 -0700 X-QCInternal: smtphost Received: from nasanexm03e.na.qualcomm.com ([10.85.0.48]) by ironmsg05-sd.qualcomm.com with ESMTP/TLS/AES256-SHA; 23 Jun 2021 11:44:41 -0700 Received: from [10.38.240.33] (10.80.80.8) by nasanexm03e.na.qualcomm.com (10.85.0.48) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Wed, 23 Jun 2021 11:44:35 -0700 Subject: Re: [PATCH v14 06/12] swiotlb: Use is_swiotlb_force_bounce for swiotlb data bouncing To: Will Deacon CC: Claire Chang , Rob Herring , , Joerg Roedel , Frank Rowand , Konrad Rzeszutek Wilk , , , Christoph Hellwig , Marek Szyprowski , , , , , , , , , , , , , Saravana Kannan , , "Rafael J . Wysocki" , Bartosz Golaszewski , , , , Thierry Reding , , , linux-devicetree , , , , , , Nicolas Boichat , , , Dan Williams , Andy Shevchenko , Greg KH , Randy Dunlap , lkml , "list@263.net:IOMMU DRIVERS" , Jim Quinlan , , Robin Murphy , References: <20210619034043.199220-1-tientzu@chromium.org> <20210619034043.199220-7-tientzu@chromium.org> <76c3343d-72e5-9df3-8924-5474ee698ef4@quicinc.com> <20210623183736.GA472@willie-the-truck> From: Qian Cai Message-ID: <19d4c7a2-744d-21e0-289c-a576e1f0e6f3@quicinc.com> Date: Wed, 23 Jun 2021 14:44:34 -0400 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: <20210623183736.GA472@willie-the-truck> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nasanexm03e.na.qualcomm.com (10.85.0.48) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 6/23/2021 2:37 PM, Will Deacon wrote: > 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? Will, no. It is rather patch #6 (this patch). Only the patch from #6 to #12 were reverted to fix the issue. Also, looking at this offset of the crash, pc : dma_direct_map_sg+0x304/0x8f0 is_swiotlb_force_bounce at /usr/src/linux-next/./include/linux/swiotlb.h:119 is_swiotlb_force_bounce() was the new function introduced in this patch here. +static inline bool is_swiotlb_force_bounce(struct device *dev) +{ + return dev->dma_io_tlb_mem->force_bounce; +} > > 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 >