Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp120464pxv; Thu, 24 Jun 2021 04:20:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzEakIALIEanHFGnY1EzduZ8vbsn5Ft+VLl6LqoMz7HIHE86DZ/ve3gZvn5dbcSTuq2INsD X-Received: by 2002:a02:c808:: with SMTP id p8mr4208288jao.109.1624533607753; Thu, 24 Jun 2021 04:20:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624533607; cv=none; d=google.com; s=arc-20160816; b=zg1b+AyWh2lI5GtzYY+7Q2g53H/HAi96CBvNB3v0RcNH2sI8hZpgAoqr8H27ngSyWT QYEq+ZLsV1u9KdF5yPer6aL/WFbIT/IOMNn/7y0fle+5DwYcrh4cMiSM65jt5T10ccLZ 0LaQTA5Dm63IkI/EeN8AtGq9fEVRKnOsNx+LH2DYbJ6l3h+lk5xlimwwbFdQXmHx0x0X kdgZUx7Y24uwwCP357PEhQT0shu8eGnm8nQRoICFqZ0Zo8T1RgS+L+KzQ9haTpbolsFg q1xiBNA7oOnMPAx3+Z0n0D/i6vFxsNVXsuTx0gF3nVBq+vIKgyZw2rPxZL/cEKJ8QsrD euyg== 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=rR5gqVt2KRaI1MeZR7EP5zdhTFyDrq4DRXuBGVr97uw=; b=mGhJbvtauaRbA0xue2xy2/pWacAcnhnucThoEjqu92WgcUk6bKtTEFXV4BEnFy14/+ /W2+0aoCH9ehndhoRhPOKbxiy6vrWchGSXzWM7vhLODwLBmIF/WBj/2ntH0RSqEVEXmH 5KeC/21at7DXP6FoQ58xyKEf3KjtlrK6lrXt6J3/WfwmxkAfg1UIfeL8q0aBb1ICmo3d zFtFbpoC/F9XkYiXrzdDFkiZW0QBDD3KjVtFi0kRoZnB4H3K0q1vUTfZRdV6gDNXEKlp KPvj6FFX9J4ZJUYOKsa+n9GwNjsYF2FU+toaVxAt3rem/RLP7ogJIc5QJd9mIUL+pzFK CehQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=bw4AVsGw; 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 x19si3436539jat.6.2021.06.24.04.19.52; Thu, 24 Jun 2021 04:20:07 -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=bw4AVsGw; 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 S232350AbhFXLV0 (ORCPT + 99 others); Thu, 24 Jun 2021 07:21:26 -0400 Received: from mail.kernel.org ([198.145.29.99]:33474 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232005AbhFXLV0 (ORCPT ); Thu, 24 Jun 2021 07:21:26 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 6D5C7613C1; Thu, 24 Jun 2021 11:18:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1624533547; bh=fyQk9K7V5mi+iulKCuVouHY96p/8l9exJzzlUIeSpn8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=bw4AVsGwRrbnlqsX5CZZBCGVkLRWbVSBBROzH0cW0WxgQnoyiN2SkbZT9Y0qsOq8u JL8IIrlYNHTHfBROv+myGIoSXn3V0Qajeyu6WrQ15CejRET9x4mwWpuBCwWkKgfe+I +cOMFFna8tPSjLTq48KMyVkK5wGgtDdocNICZALKyCcFBQrrDac4GVZrs41lrwovdH A7+mTUl4b8SpYL5RZSXQGAdCk4J4xBM23HuRVgN0YiE8QMME9/0wtATNSKneCXnM3U aM6IUBXxfGBIajg731amXfhwP7wHdtJMySWai/ROQfVX1amjwBJVAnH3akjkMUY271 lYvk5WkbaBLcQ== Date: Thu, 24 Jun 2021 12:18:56 +0100 From: Will Deacon To: Robin Murphy Cc: Claire Chang , Christoph Hellwig , Qian Cai , 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 , bauerman@linux.ibm.com Subject: Re: [PATCH v14 06/12] swiotlb: Use is_swiotlb_force_bounce for swiotlb data bouncing Message-ID: <20210624111855.GA1382@willie-the-truck> 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> <364e6715-eafd-fc4a-e0af-ce2a042756b4@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <364e6715-eafd-fc4a-e0af-ce2a042756b4@arm.com> User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jun 24, 2021 at 12:14:39PM +0100, Robin Murphy wrote: > On 2021-06-24 07:05, Claire Chang wrote: > > 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?). > > What also looks odd is that the base "address" 0xdfff800000000000 is held in > a couple of registers, but the offset 0xe looks too small to match up to any > relevant structure member in that dereference chain :/ FWIW, I've managed to trigger a NULL dereference locally when swiotlb hasn't been initialised but we dereference 'dev->dma_io_tlb_mem', so I think Christoph's suggestion is needed regardless. But I agree that it won't help with the issue reported by Qian Cai. Qian Cai: please can you share your .config and your command line? Thanks, Will