From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by ml01.01.org (Postfix) with ESMTP id 78A181A1E5A for ; Wed, 23 Mar 2016 13:50:54 -0700 (PDT) Date: Wed, 23 Mar 2016 14:50:00 -0600 From: Ross Zwisler Subject: Re: [PATCH 07/10] dax: Disable huge page handling Message-ID: <20160323205000.GE5544@linux.intel.com> References: <1458566575-28063-1-git-send-email-jack@suse.cz> <1458566575-28063-8-git-send-email-jack@suse.cz> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1458566575-28063-8-git-send-email-jack@suse.cz> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: linux-nvdimm-bounces@lists.01.org Sender: "Linux-nvdimm" To: Jan Kara Cc: linux-nvdimm@lists.01.org, NeilBrown , Wilcox, List-ID: On Mon, Mar 21, 2016 at 02:22:52PM +0100, Jan Kara wrote: > Currently the handling of huge pages for DAX is racy. For example the > following can happen: > > CPU0 (THP write fault) CPU1 (normal read fault) > > __dax_pmd_fault() __dax_fault() > get_block(inode, block, &bh, 0) -> not mapped > get_block(inode, block, &bh, 0) > -> not mapped > if (!buffer_mapped(&bh) && write) > get_block(inode, block, &bh, 1) -> allocates blocks > truncate_pagecache_range(inode, lstart, lend); > dax_load_hole(); > > This results in data corruption since process on CPU1 won't see changes > into the file done by CPU0. > > The race can happen even if two normal faults race however with THP the > situation is even worse because the two faults don't operate on the same > entries in the radix tree and we want to use these entries for > serialization. So disable THP support in DAX code for now. Yep, I agree that we should disable PMD faults until we get the multi-order radix tree work finished and integrated with this locking. I do agree with Dan though that it would be preferable to disable PMD faults by having CONFIG_FS_DAX_PMD depend on BROKEN. That seems smaller and easier to switch PMD faults back on for testing. > Signed-off-by: Jan Kara > --- > fs/dax.c | 2 +- > include/linux/dax.h | 2 +- > 2 files changed, 2 insertions(+), 2 deletions(-) > > diff --git a/fs/dax.c b/fs/dax.c > index 0329ec0bee2e..444e9dd079ca 100644 > --- a/fs/dax.c > +++ b/fs/dax.c > @@ -719,7 +719,7 @@ int dax_fault(struct vm_area_struct *vma, struct vm_fault *vmf, > } > EXPORT_SYMBOL_GPL(dax_fault); > > -#ifdef CONFIG_TRANSPARENT_HUGEPAGE > +#if 0 > /* > * The 'colour' (ie low bits) within a PMD of a page offset. This comes up > * more often than one might expect in the below function. > diff --git a/include/linux/dax.h b/include/linux/dax.h > index 4b63923e1f8d..fd28d824254b 100644 > --- a/include/linux/dax.h > +++ b/include/linux/dax.h > @@ -29,7 +29,7 @@ static inline struct page *read_dax_sector(struct block_device *bdev, > } > #endif > > -#ifdef CONFIG_TRANSPARENT_HUGEPAGE > +#if 0 > int dax_pmd_fault(struct vm_area_struct *, unsigned long addr, pmd_t *, > unsigned int flags, get_block_t); > int __dax_pmd_fault(struct vm_area_struct *, unsigned long addr, pmd_t *, > -- > 2.6.2 > _______________________________________________ Linux-nvdimm mailing list Linux-nvdimm@lists.01.org https://lists.01.org/mailman/listinfo/linux-nvdimm From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga03.intel.com ([134.134.136.65]:32719 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756991AbcCWUua (ORCPT ); Wed, 23 Mar 2016 16:50:30 -0400 Date: Wed, 23 Mar 2016 14:50:00 -0600 From: Ross Zwisler To: Jan Kara Cc: linux-fsdevel@vger.kernel.org, "Wilcox, Matthew R" , Ross Zwisler , Dan Williams , linux-nvdimm@lists.01.org, NeilBrown Subject: Re: [PATCH 07/10] dax: Disable huge page handling Message-ID: <20160323205000.GE5544@linux.intel.com> References: <1458566575-28063-1-git-send-email-jack@suse.cz> <1458566575-28063-8-git-send-email-jack@suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1458566575-28063-8-git-send-email-jack@suse.cz> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: On Mon, Mar 21, 2016 at 02:22:52PM +0100, Jan Kara wrote: > Currently the handling of huge pages for DAX is racy. For example the > following can happen: > > CPU0 (THP write fault) CPU1 (normal read fault) > > __dax_pmd_fault() __dax_fault() > get_block(inode, block, &bh, 0) -> not mapped > get_block(inode, block, &bh, 0) > -> not mapped > if (!buffer_mapped(&bh) && write) > get_block(inode, block, &bh, 1) -> allocates blocks > truncate_pagecache_range(inode, lstart, lend); > dax_load_hole(); > > This results in data corruption since process on CPU1 won't see changes > into the file done by CPU0. > > The race can happen even if two normal faults race however with THP the > situation is even worse because the two faults don't operate on the same > entries in the radix tree and we want to use these entries for > serialization. So disable THP support in DAX code for now. Yep, I agree that we should disable PMD faults until we get the multi-order radix tree work finished and integrated with this locking. I do agree with Dan though that it would be preferable to disable PMD faults by having CONFIG_FS_DAX_PMD depend on BROKEN. That seems smaller and easier to switch PMD faults back on for testing. > Signed-off-by: Jan Kara > --- > fs/dax.c | 2 +- > include/linux/dax.h | 2 +- > 2 files changed, 2 insertions(+), 2 deletions(-) > > diff --git a/fs/dax.c b/fs/dax.c > index 0329ec0bee2e..444e9dd079ca 100644 > --- a/fs/dax.c > +++ b/fs/dax.c > @@ -719,7 +719,7 @@ int dax_fault(struct vm_area_struct *vma, struct vm_fault *vmf, > } > EXPORT_SYMBOL_GPL(dax_fault); > > -#ifdef CONFIG_TRANSPARENT_HUGEPAGE > +#if 0 > /* > * The 'colour' (ie low bits) within a PMD of a page offset. This comes up > * more often than one might expect in the below function. > diff --git a/include/linux/dax.h b/include/linux/dax.h > index 4b63923e1f8d..fd28d824254b 100644 > --- a/include/linux/dax.h > +++ b/include/linux/dax.h > @@ -29,7 +29,7 @@ static inline struct page *read_dax_sector(struct block_device *bdev, > } > #endif > > -#ifdef CONFIG_TRANSPARENT_HUGEPAGE > +#if 0 > int dax_pmd_fault(struct vm_area_struct *, unsigned long addr, pmd_t *, > unsigned int flags, get_block_t); > int __dax_pmd_fault(struct vm_area_struct *, unsigned long addr, pmd_t *, > -- > 2.6.2 >