From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C33483A7F47 for ; Wed, 12 Aug 2026 22:58:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786575511; cv=none; b=G1Abpe+p60vlC4ROJ0/oZPGYJ14Na7Sj8EACjFFzYFiVTPC1tRjNeW274M3sNgLv7W44F4ok/ElXfQwuPQwsIrsT/sLcC7OBqM/MA7Z9c19OuWGdNWWNkChkvzcVpqSzeAVHu2+4IaMW3i+TeoB28NJMvfXh5Nt8Y+7p1M/MZ0Q= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786575511; c=relaxed/simple; bh=MplUte4ujOItwCBgX7gcZZbQDqRQ34rSzx1zp5ASP/4=; h=Date:From:To:Cc:Subject:Message-Id:In-Reply-To:References: Mime-Version:Content-Type; b=cyZZeVKzsqquLFzqlgv17jn8LbUm4c86gN0MfH/cszHPuqEvQvmDnuUMTNXWwor3rvYnSeZ+KxQ6+V9XHsQvj8pUKOXLk+5Gnllne6r5fRczjAYay6sDdOsryMl1+h4pKX1882MrEPsk0cDTurNPQL1tnUoGDmFE68jZCxMQJgw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b=pw4B/tZv; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b="pw4B/tZv" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 28B831F000E9; Wed, 12 Aug 2026 22:58:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=korg; t=1786575510; bh=Xs9kYarR6shzvLO/ONqDC6uphwPH8pJQ2AhMCAQ8C+8=; h=Date:From:To:Cc:Subject:In-Reply-To:References; b=pw4B/tZv7K+RDI7ncSfjgc7Xoms5biqKDoIU6JHPsU017gpdwrF1fdqRBvNZ3xhaA 9D53P3RktGoUn1C64cj31m5I+GDEkbCHE5Y49Z6o6U1yellQZkMngVS+R/qhccSKBM 5aHyOgxcnaHBPcBncentvbCUzc8rxjSxGdo8RiC8= Date: Wed, 12 Aug 2026 15:58:29 -0700 From: Andrew Morton To: liuqiangneo@163.com Cc: jgg@ziepe.ca, leon@kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Qiang Liu Subject: Re: [PATCH v2] lib/test_hmm: fix garbage pfn and wrong direction in devmem fault debug Message-Id: <20260812155829.43ebf2838420b8dcab83f55d@linux-foundation.org> In-Reply-To: <20260812092856.55296-1-liuqiangneo@163.com> References: <20260812092856.55296-1-liuqiangneo@163.com> X-Mailer: Sylpheed 3.8.0beta1 (GTK+ 2.24.33; x86_64-pc-linux-gnu) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Wed, 12 Aug 2026 17:28:56 +0800 liuqiangneo@163.com wrote: > From: Qiang Liu > > Move pr_debug() inside the `if (dpage)` block to avoid > printing garbage pfn for NULL dpage, and correct the > direction label from "sys to dev" to "dev to sys". > > ... > > --- a/lib/test_hmm.c > +++ b/lib/test_hmm.c > @@ -1151,10 +1151,9 @@ static vm_fault_t dmirror_devmem_fault_alloc_and_copy(struct migrate_vma *args, > if (!dpage && !order) > return VM_FAULT_OOM; > > - pr_debug("migrating from sys to dev pfn src: 0x%lx pfn dst: 0x%lx\n", > - page_to_pfn(spage), page_to_pfn(dpage)); > - > if (dpage) { > + pr_debug("migrating from dev to sys pfn src: 0x%lx pfn dst: 0x%lx\n", > + page_to_pfn(spage), page_to_pfn(dpage)); > lock_page(dpage); > *dst |= migrate_pfn(page_to_pfn(dpage)); Looks OK to me, thanks. We could just remove the pr_debug. I suspect it was a development-time thing and nobody uses it any more. Your patch prompted Sashiko to find three possible pre-existing issues in this code: https://sashiko.dev/#/patchset/20260812092856.55296-1-liuqiangneo@163.com