Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp318368pxj; Wed, 23 Jun 2021 23:18:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw4zand4b2YFUvwf5am5LlALmx0tT8OegtaXIjgt3J1twxmNYF1fa2GxHODh2EPSQ4q34TM X-Received: by 2002:aa7:dccb:: with SMTP id w11mr4742228edu.96.1624515501332; Wed, 23 Jun 2021 23:18:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624515501; cv=none; d=google.com; s=arc-20160816; b=cbRu4kfSjolC7fUvWHGxiQtpoA6LyuWwIuQ2SLuK7ki1sUpv4lmPfuJKikXE1v+yKn 9vLlcdV6GjM8LzekIsqmtoT9vaw9R5HvkHr5VQ/lEWsMumBQlK9GYTxseG+NJ6B4T+Qr nTRzsyDUpha+jHJNkBs9JqYJHMLfElJrJymC3RZjZOroR0zFIXzkxf3qUd/rmnzJVJS4 9n3Gv6e6qjZJ97KOFEl8SyZPY6V8XDpBrKrQ/919Iuab075A4Oh7MnDDw519HE3I64gU doLlrLV9bgq8taO7uLwAODxVcJR4W/h6keDHVkMzVzqCc24/Y8zASj2xLIiaudeYunFV 6T/Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=osJqntoZHJL8VeQbE2d8Gx1TrOiajWQXazXH9w70kIY=; b=gTNiUn+t6yyEZHVzlcRWSFx9LN9P/n1z8X2tExcey96x2Uar9V8tsNA+jHq7Ad5c5I v5x1vO/Vuo2nMbiwNGrl9mFbLqYCM/0uV8rZ4WljBTeopNMw9BpFkP9oyvtvKhlHzgBe TwW+LZkkRJ71ZPsqEzl0a/pwgboEeOwC6rphzS2cxHogGs1gNnKDDgf8gQ+FhPwkNWVg s4YEzt+1iQNA3chaVi7Ro9fEfAAvDtAQnxMFsrodvyBImAVyOeccOTVdG6h3tzUTBYXE HJwUHoNv0gqAisUM3CErti70j/XOPKjVjqazPEtP/JXE6h2fpJdX24DJO6kL4kQyfqVg 6WYQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=f09JHaTt; 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=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c17si2063676edy.569.2021.06.23.23.17.58; Wed, 23 Jun 2021 23:18:21 -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=@chromium.org header.s=google header.b=f09JHaTt; 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=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231266AbhFXGQe (ORCPT + 99 others); Thu, 24 Jun 2021 02:16:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44548 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230518AbhFXGQd (ORCPT ); Thu, 24 Jun 2021 02:16:33 -0400 Received: from mail-pf1-x433.google.com (mail-pf1-x433.google.com [IPv6:2607:f8b0:4864:20::433]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B8B50C061756 for ; Wed, 23 Jun 2021 23:14:14 -0700 (PDT) Received: by mail-pf1-x433.google.com with SMTP id s14so3013573pfg.0 for ; Wed, 23 Jun 2021 23:14:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=osJqntoZHJL8VeQbE2d8Gx1TrOiajWQXazXH9w70kIY=; b=f09JHaTt6yY9HlwcujpzmyCJbvbUoIE0cZNa0aICkCK68T/rODYze/6/aKRkuFqgtc aQSgGc4CEL1bXaOSKVo+xlBop7hH5m1EqqxXbZi8VyWUJmFL6g6BM4X4ZMkMlYffhkXb itPPZk67YIl+8XjGG/C0lboNwjIIr80wXQ+NM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=osJqntoZHJL8VeQbE2d8Gx1TrOiajWQXazXH9w70kIY=; b=O8bvoBuFwsauFXOWt4/PyCLgcBuahgpevfyRUP1UJ3hyqK0Vw+7BhrMIYwNrNkuTth Kh5I/tioHJ42+odkKEaLVABmfqUmB0ah43zjw+qBZoX4UA6RPquVeREafSHQC3kE9Wtb 0XsHwECLPapHl8ULEHs2jt/AIf0mMcY3E+amhUP7KUxbCl0NuZ1CAlCj2IKX1NbOOTg8 svJsj5pCPo0d6DpvH10TBzx9UPUaBYg43/1/RdMbmXNMC4AfFWHE/h7DPCAeXiPWcvqP hCv/oP57p70IZTBFTo0873nV8ShclNIzMgc1ggoMbMOeAwWhGT27nwJOBAPC2oL9NWxr DDMA== X-Gm-Message-State: AOAM530lh/bqPjGX6VvgU9eLqFYydLHuMolwm2W/txs6YJDnNQZk+7xJ 65BETxyQuV7lIvsAWWqUpozI2ezYVyyKdw== X-Received: by 2002:a63:a53:: with SMTP id z19mr3231745pgk.125.1624515254032; Wed, 23 Jun 2021 23:14:14 -0700 (PDT) Received: from mail-pf1-f181.google.com (mail-pf1-f181.google.com. [209.85.210.181]) by smtp.gmail.com with ESMTPSA id s4sm1295713pjn.31.2021.06.23.23.14.13 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 23 Jun 2021 23:14:13 -0700 (PDT) Received: by mail-pf1-f181.google.com with SMTP id w71so4295123pfd.4 for ; Wed, 23 Jun 2021 23:14:13 -0700 (PDT) X-Received: by 2002:a92:750c:: with SMTP id q12mr2332407ilc.303.1624514749926; Wed, 23 Jun 2021 23:05:49 -0700 (PDT) MIME-Version: 1.0 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> <19d4c7a2-744d-21e0-289c-a576e1f0e6f3@quicinc.com> <20210624054315.GA25381@lst.de> In-Reply-To: <20210624054315.GA25381@lst.de> From: Claire Chang Date: Thu, 24 Jun 2021 14:05:39 +0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v14 06/12] swiotlb: Use is_swiotlb_force_bounce for swiotlb data bouncing To: Christoph Hellwig Cc: Qian Cai , Will Deacon , Rob Herring , mpe@ellerman.id.au, Joerg Roedel , Frank Rowand , Konrad Rzeszutek Wilk , boris.ostrovsky@oracle.com, jgross@suse.com, 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, Jianxiong Gao , Stefano Stabellini , 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 Vetter , airlied@linux.ie, maarten.lankhorst@linux.intel.com, linuxppc-dev@lists.ozlabs.org, jani.nikula@linux.intel.com, Nicolas Boichat , rodrigo.vivi@intel.com, Bjorn Helgaas , Dan Williams , Andy Shevchenko , Greg KH , Randy Dunlap , lkml , "list@263.net:IOMMU DRIVERS" , Jim Quinlan , Tom Lendacky , Robin Murphy , bauerman@linux.ibm.com Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jun 24, 2021 at 1:43 PM Christoph Hellwig wrote: > > On Wed, Jun 23, 2021 at 02:44:34PM -0400, Qian Cai wrote: > > 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; > > +} > > To me the crash looks like dev->dma_io_tlb_mem is NULL. Can you > turn this into : > > return dev->dma_io_tlb_mem && dev->dma_io_tlb_mem->force_bounce; > > for a quick debug check? I just realized that dma_io_tlb_mem might be NULL like Christoph pointed out since swiotlb might not get initialized. However, `Unable to handle kernel paging request at virtual address dfff80000000000e` looks more like the address is garbage rather than NULL? I wonder if that's because dev->dma_io_tlb_mem is not assigned properly (which means device_initialize is not called?).