Message ID | ff4366d14b3ef4de6af835a880a772477577139f.1556258135.git.christophe.leroy@c-s.fr (mailing list archive) |
---|---|
State | Rejected |
Headers | show |
Series | Reduce ifdef mess in hugetlbpage.c | expand |
Context | Check | Description |
---|---|---|
snowpatch_ozlabs/apply_patch | success | Successfully applied on branch next (26ad26718dfaa7cf49d106d212ebf2370076c253) |
snowpatch_ozlabs/checkpatch | success | total: 0 errors, 0 warnings, 0 checks, 16 lines checked |
Christophe Leroy <christophe.leroy@c-s.fr> writes: > Use VM_BUG_ON() instead of BUG_ON(), as those BUG_ON() > are not there to catch runtime errors but to catch errors > during development cycle only. I've dropped this one and the next, because I don't like VM_BUG_ON(). Why not? Because it's contradictory. It's a condition that's so important that we should BUG, but only if the kernel has been built specially for debugging. I don't really buy the development cycle distinction, it's not like we have a rigorous test suite that we run and then we declare everything's gold and ship a product. We often don't find bugs until they're hit in the wild. For example the recent corruption Joel discovered with STRICT_KERNEL_RWX could have been caught by a BUG_ON() to check we weren't patching kernel text in radix__change_memory_range(), but he wouldn't have been using CONFIG_DEBUG_VM. (See 8adddf349fda) I know Aneesh disagrees with me on this, so maybe you two can convince me otherwise. cheers > diff --git a/arch/powerpc/include/asm/hugetlb.h b/arch/powerpc/include/asm/hugetlb.h > index 8d40565ad0c3..7f1867e428c0 100644 > --- a/arch/powerpc/include/asm/hugetlb.h > +++ b/arch/powerpc/include/asm/hugetlb.h > @@ -14,7 +14,7 @@ > */ > static inline pte_t *hugepd_page(hugepd_t hpd) > { > - BUG_ON(!hugepd_ok(hpd)); > + VM_BUG_ON(!hugepd_ok(hpd)); > /* > * We have only four bits to encode, MMU page size > */ > @@ -42,7 +42,7 @@ static inline void flush_hugetlb_page(struct vm_area_struct *vma, > > static inline pte_t *hugepd_page(hugepd_t hpd) > { > - BUG_ON(!hugepd_ok(hpd)); > + VM_BUG_ON(!hugepd_ok(hpd)); > #ifdef CONFIG_PPC_8xx > return (pte_t *)__va(hpd_val(hpd) & ~HUGEPD_SHIFT_MASK); > #else > -- > 2.13.3
Le 02/05/2019 à 14:02, Michael Ellerman a écrit : > Christophe Leroy <christophe.leroy@c-s.fr> writes: >> Use VM_BUG_ON() instead of BUG_ON(), as those BUG_ON() >> are not there to catch runtime errors but to catch errors >> during development cycle only. > > I've dropped this one and the next, because I don't like VM_BUG_ON(). > > Why not? Because it's contradictory. It's a condition that's so > important that we should BUG, but only if the kernel has been built > specially for debugging. > > I don't really buy the development cycle distinction, it's not like we > have a rigorous test suite that we run and then we declare everything's > gold and ship a product. We often don't find bugs until they're hit in > the wild. > > For example the recent corruption Joel discovered with STRICT_KERNEL_RWX > could have been caught by a BUG_ON() to check we weren't patching kernel > text in radix__change_memory_range(), but he wouldn't have been using > CONFIG_DEBUG_VM. (See 8adddf349fda) > > I know Aneesh disagrees with me on this, so maybe you two can convince > me otherwise. > I have no strong oppinion about this. In v1, I replaced them with a WARN_ON(), and Aneesh suggested to go with VM_BUG_ON() instead. My main purpose was to reduce the amount of BUG/BUG_ON and I thought those were good candidates, but if you prefer keeping the BUG(), that's ok for me. Or maybe you prefered v1 alternatives (series at https://patchwork.ozlabs.org/project/linuxppc-dev/list/?series=98170) ? Christophe
diff --git a/arch/powerpc/include/asm/hugetlb.h b/arch/powerpc/include/asm/hugetlb.h index 8d40565ad0c3..7f1867e428c0 100644 --- a/arch/powerpc/include/asm/hugetlb.h +++ b/arch/powerpc/include/asm/hugetlb.h @@ -14,7 +14,7 @@ */ static inline pte_t *hugepd_page(hugepd_t hpd) { - BUG_ON(!hugepd_ok(hpd)); + VM_BUG_ON(!hugepd_ok(hpd)); /* * We have only four bits to encode, MMU page size */ @@ -42,7 +42,7 @@ static inline void flush_hugetlb_page(struct vm_area_struct *vma, static inline pte_t *hugepd_page(hugepd_t hpd) { - BUG_ON(!hugepd_ok(hpd)); + VM_BUG_ON(!hugepd_ok(hpd)); #ifdef CONFIG_PPC_8xx return (pte_t *)__va(hpd_val(hpd) & ~HUGEPD_SHIFT_MASK); #else
Use VM_BUG_ON() instead of BUG_ON(), as those BUG_ON() are not there to catch runtime errors but to catch errors during development cycle only. Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr> --- arch/powerpc/include/asm/hugetlb.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)