Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965674AbbLPDB7 (ORCPT ); Tue, 15 Dec 2015 22:01:59 -0500 Received: from mail-lf0-f47.google.com ([209.85.215.47]:36221 "EHLO mail-lf0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751445AbbLPDB6 convert rfc822-to-8bit (ORCPT ); Tue, 15 Dec 2015 22:01:58 -0500 MIME-Version: 1.0 Date: Tue, 15 Dec 2015 19:01:57 -0800 Message-ID: Subject: Re: [PATCH 1/2] arm64: Improve error reporting on set_pte_at() checks From: Andrew Pinski To: Catalin Marinas , LKML Cc: "linux-arm-kernel@lists.infradead.org" , Andrew Pinski , Ming Lei , Will Deacon , David Daney Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2588 Lines: 64 On Tue, Dec 9, 2015 at 17:26:56, Catalin Marinas wrote: > > Currently the BUG_ON() checks do not give enough information about the PTEs being set. This patch changes BUG_ON to WARN_ONCE and dumps the values of the old and new PTEs. This change broke building the mantis driver: In file included from ./arch/arm64/include/asm/io.h:30:0, from drivers/media/pci/mantis/mantis_i2c.c:21: ./arch/arm64/include/asm/pgtable.h: In function ‘set_pte_at’: ./arch/arm64/include/asm/pgtable.h:281:3: error: implicit declaration of function ‘BUILD_BUG_ON_INVALID’ [-Werror=implicit-function-declaration] VM_WARN_ONCE(!pte_young(pte), ^ Thanks, Andrew Pinski > > Signed-off-by: Catalin Marinas > Cc: Will Deacon > --- > arch/arm64/include/asm/pgtable.h | 11 +++++++---- > 1 file changed, 7 insertions(+), 4 deletions(-) > > diff --git a/arch/arm64/include/asm/pgtable.h > b/arch/arm64/include/asm/pgtable.h > index 7e074f93f383..002dc61a4dff 100644 > --- a/arch/arm64/include/asm/pgtable.h > +++ b/arch/arm64/include/asm/pgtable.h > @@ -276,10 +276,13 @@ static inline void set_pte_at(struct mm_struct *mm, unsigned long addr, > * hardware updates of the pte (ptep_set_access_flags safely changes > * valid ptes without going through an invalid entry). > */ > - if (IS_ENABLED(CONFIG_DEBUG_VM) && IS_ENABLED(CONFIG_ARM64_HW_AFDBM) && > - pte_valid(*ptep)) { > - BUG_ON(!pte_young(pte)); > - BUG_ON(pte_write(*ptep) && !pte_dirty(pte)); > + if (IS_ENABLED(CONFIG_ARM64_HW_AFDBM) && pte_valid(*ptep)) { > + VM_WARN_ONCE(!pte_young(pte), > + "%s: racy access flag clearing: %016llx -> %016llx", > + __func__, pte_val(*ptep), pte_val(pte)); > + VM_WARN_ONCE(pte_write(*ptep) && !pte_dirty(pte), > + "%s: racy dirty state clearing: %016llx -> %016llx", > + __func__, pte_val(*ptep), pte_val(pte)); > } > > set_pte(ptep, pte); > > _______________________________________________ > linux-arm-kernel mailing list > linux-arm-kernel@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-arm-kernel > > > > -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/