Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp562464pxf; Thu, 11 Mar 2021 09:29:38 -0800 (PST) X-Google-Smtp-Source: ABdhPJyGcnMdAfxMXxkLSWNo73TClhNjY2ywc1q3KEiXgGxRNnBSiE7KWdWnkZb0VWR4ZMxVKghq X-Received: by 2002:a17:906:5d12:: with SMTP id g18mr4048830ejt.246.1615483778313; Thu, 11 Mar 2021 09:29:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1615483778; cv=none; d=google.com; s=arc-20160816; b=EyJCYW3y0S3J1Qs5mus+UsnXKUCzzPipnNuTxbp8MhkxMoz6VAU6fp1S55UhObvlRI qcff3ZQ/ZbB33tjcGJb9zJ9kX5+C3OdIBxY+ii4VjLBw35eOvp+YoDruHwOxdGhxtmAM 6tBP7Q5kVVadc34ruDFbQmrgRPMDr3Xje5+JviULlKnZOMvq1R4Vno4huT5h3esZKEZX 2A8rwShhMbX10qVozm30jiSb+HdDFDH7uh5z2QBJ2o171BxH1zcGe1roF2acG9H7cwFR AxabkPENV73wgMmwvhgNayyGVm/ESVrld71O+Zg5wVPPx4MWfbihgMJa4i0axRsg9Ne/ KRWw== 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=yG/vJmP1bt9V/zcHq9LX/hDiqMUciXWcy0fyRaWMlUE=; b=lYlQQNVD7OByA1aPePPMl3UbiDQ1huqFBx3JNKmBiLrfMjM/sXCAUZvjhDiA0whzjo +/R0cSNlD3ovPRMCBJY2ihf5tiHY3AvZeMvmaF2ipWC2lmEQGJTwSX9vTFKOKyUv46ji 8yZoZ5qHAtwMT0W0MU3Wqy/Ytr0MpyWUlTTZi7a+6zdlqXfCGZuiFaoTtEAnY5/RfVaI 7oeEnC8iJn5CLTD41bCgRHIVNRwCEwsxBZCOZTOk3kg6viLHUnH/LnetdeggU2QCy7ji f7jy4qRF6hvokWp3AtGqXpcA1tn5T/tmepxj6VSiMxQfxLKKg/4YS9E5t0Y/aI7WN0ow Nq9w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel-com.20150623.gappssmtp.com header.s=20150623 header.b=0YX0R0Q2; 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=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i6si2153204edu.313.2021.03.11.09.29.15; Thu, 11 Mar 2021 09:29:38 -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; dkim=pass header.i=@intel-com.20150623.gappssmtp.com header.s=20150623 header.b=0YX0R0Q2; 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=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230075AbhCKRZw (ORCPT + 99 others); Thu, 11 Mar 2021 12:25:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41108 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229578AbhCKRZX (ORCPT ); Thu, 11 Mar 2021 12:25:23 -0500 Received: from mail-ed1-x52b.google.com (mail-ed1-x52b.google.com [IPv6:2a00:1450:4864:20::52b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BFAFCC061574 for ; Thu, 11 Mar 2021 09:25:22 -0800 (PST) Received: by mail-ed1-x52b.google.com with SMTP id dm8so3989144edb.2 for ; Thu, 11 Mar 2021 09:25:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=yG/vJmP1bt9V/zcHq9LX/hDiqMUciXWcy0fyRaWMlUE=; b=0YX0R0Q2hP+VRr62VJBofrj5bwB+MCjUnWO/PvCvGfcEsYGhMMejCqBm8Pfj5e8TdI tREJb6S5wxcQOrnVPKESltVTqt698WVEwkHUhw6f646QkClKEo46BT5Pnx4PgGwwzpO3 tmo5tkrk/yQ2sRylmuPQmAPVuX47NBSI2bBBy2oVNLI2mE2W9cw46R8sHkRC8vbvs8aM fJk54uUOb4JlfqsCahno6tBFIGSrTM11D1eXjVahUlcYLWXbPEs/bKkZIqkR95ZVBOgP gfHGo42KJ88F0zo9mQ7JNr4WkHjSitiNGvkyRqyfELfoh99GZtkbGnaEih5B1EUO51t6 eiVw== 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=yG/vJmP1bt9V/zcHq9LX/hDiqMUciXWcy0fyRaWMlUE=; b=nuTzW1zxELedeoVZ58vSv7crf1iZoIEbGynV5l1h3Qjw/LLTnLS8pNZe+jWzQCAZjR U7S52FxLAirn3GpTZnNC71mknYH4BVrcgJzjyTkZCI6Sk/BpfM8kkOzBPCII8m3kRoac +elrfGmyXvMjmfgKM65CGt/LGQc0cXhN77waOjC+I01uAa5fuG6FhvE2/MMb6a5jZr7C LcdvJSZpXlQGBvEmJUmgdiC+bKhQKuxt5zc6aNFR4gNzDCGCzIXf+N7KLDjAjRw6QXeK mv/YnN3JZgFZUTVkjt3yFvptwpfbwhVcSs1JPoWeHoEnkhBq3tIO8XoPfntwME/eJ0yW +nyA== X-Gm-Message-State: AOAM530URF9PbU6t+EcxyfzU3+13MOncw8y8/q8ikmzMqyEXiVBGhWUr 0SZpD1DV0ABtDoMjEJSOmgLiyR6UUTjW2dUAjwMqUA== X-Received: by 2002:a05:6402:4301:: with SMTP id m1mr9971780edc.210.1615483521452; Thu, 11 Mar 2021 09:25:21 -0800 (PST) MIME-Version: 1.0 References: <20210311121923.GU3479805@casper.infradead.org> In-Reply-To: <20210311121923.GU3479805@casper.infradead.org> From: Dan Williams Date: Thu, 11 Mar 2021 09:25:10 -0800 Message-ID: Subject: Re: [question] Panic in dax_writeback_one To: Matthew Wilcox Cc: "chenjun (AM)" , "linux-kernel@vger.kernel.org" , "linux-fsdevel@vger.kernel.org" , Jan Kara , "Xiangrui (Euler)" , "lizhe (Y)" , yangerkun , "zhangyi (F)" Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Mar 11, 2021 at 4:20 AM Matthew Wilcox wrote: > > On Thu, Mar 11, 2021 at 07:48:25AM +0000, chenjun (AM) wrote: > > static int dax_writeback_one(struct xa_state *xas, struct dax_device > > *dax_dev, struct address_space *mapping, void *entry) > > ----dax_flush(dax_dev, page_address(pfn_to_page(pfn)), count * PAGE_SIZE); > > The pfn is returned by the driver. In my case, the pfn does not have > > struct page. so pfn_to_page(pfn) return a wrong address. > > I wasn't involved, but I think the right solution here is simply to > replace page_address(pfn_to_page(pfn)) with pfn_to_virt(pfn). I don't > know why Dan decided to do this in the more complicated way. pfn_to_virt() only works for the direct-map. If pages are not mapped I don't see how pfn_to_virt() is expected to work. The real question Chenjun is why are you writing a new simulator of memory as a block-device vs reusing the pmem driver or brd?