From: Ross Zwisler <ross.zwisler@linux.intel.com>
To: Jan Kara <jack@suse.cz>
Cc: linux-nvdimm@lists.01.org, Ted Tso <tytso@mit.edu>,
linux-ext4@vger.kernel.org,
Vishal Verma <vishal.l.verma@intel.com>,
Ross Zwisler <ross.zwisler@linux.intel.com>,
Dan Williams <dan.j.williams@intel.com>,
linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH 5/7] dax: New fault locking
Date: Thu, 12 May 2016 13:36:24 -0600 [thread overview]
Message-ID: <20160512193624.GA20719@linux.intel.com> (raw)
In-Reply-To: <1463070560-1979-6-git-send-email-jack@suse.cz>
On Thu, May 12, 2016 at 06:29:18PM +0200, Jan Kara wrote:
> Currently DAX page fault locking is racy.
>
> CPU0 (write fault) CPU1 (read fault)
>
> __dax_fault() __dax_fault()
> get_block(inode, block, &bh, 0) -> not mapped
> get_block(inode, block, &bh, 0)
> -> not mapped
> if (!buffer_mapped(&bh))
> if (vmf->flags & FAULT_FLAG_WRITE)
> get_block(inode, block, &bh, 1) -> allocates blocks
> if (page) -> no
> if (!buffer_mapped(&bh))
> if (vmf->flags & FAULT_FLAG_WRITE) {
> } else {
> dax_load_hole();
> }
> dax_insert_mapping()
>
> And we are in a situation where we fail in dax_radix_entry() with -EIO.
>
> Another problem with the current DAX page fault locking is that there is
> no race-free way to clear dirty tag in the radix tree. We can always
> end up with clean radix tree and dirty data in CPU cache.
>
> We fix the first problem by introducing locking of exceptional radix
> tree entries in DAX mappings acting very similarly to page lock and thus
> synchronizing properly faults against the same mapping index. The same
> lock can later be used to avoid races when clearing radix tree dirty
> tag.
>
> Reviewed-by: NeilBrown <neilb@suse.com>
> Reviewed-by: Ross Zwisler <ross.zwisler@linux.intel.com>
> Signed-off-by: Jan Kara <jack@suse.cz>
> ---
<>
> @@ -897,13 +1166,10 @@ int __dax_pmd_fault(struct vm_area_struct *vma, unsigned long address,
> * the write to insert a dirty entry.
> */
> if (write) {
> - error = dax_radix_entry(mapping, pgoff, dax.sector,
> - true, true);
> - if (error) {
> - dax_pmd_dbg(&bh, address,
> - "PMD radix insertion failed");
> - goto fallback;
> - }
> + /*
> + * We should insert radix-tree entry and dirty it here.
> + * For now this is broken...
> + */
With this change the 'error' variable in __dax_pmd_fault() is now unused,
resulting in a compiler warning.
fs/dax.c: In function ‘__dax_pmd_fault’:
fs/dax.c:1019:6: warning: unused variable ‘error’ [-Wunused-variable]
int error, result = 0;
^
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
WARNING: multiple messages have this Message-ID (diff)
From: Ross Zwisler <ross.zwisler@linux.intel.com>
To: Jan Kara <jack@suse.cz>
Cc: Ted Tso <tytso@mit.edu>,
linux-nvdimm@lists.01.org, linux-fsdevel@vger.kernel.org,
linux-ext4@vger.kernel.org
Subject: Re: [PATCH 5/7] dax: New fault locking
Date: Thu, 12 May 2016 13:36:24 -0600 [thread overview]
Message-ID: <20160512193624.GA20719@linux.intel.com> (raw)
In-Reply-To: <1463070560-1979-6-git-send-email-jack@suse.cz>
On Thu, May 12, 2016 at 06:29:18PM +0200, Jan Kara wrote:
> Currently DAX page fault locking is racy.
>
> CPU0 (write fault) CPU1 (read fault)
>
> __dax_fault() __dax_fault()
> get_block(inode, block, &bh, 0) -> not mapped
> get_block(inode, block, &bh, 0)
> -> not mapped
> if (!buffer_mapped(&bh))
> if (vmf->flags & FAULT_FLAG_WRITE)
> get_block(inode, block, &bh, 1) -> allocates blocks
> if (page) -> no
> if (!buffer_mapped(&bh))
> if (vmf->flags & FAULT_FLAG_WRITE) {
> } else {
> dax_load_hole();
> }
> dax_insert_mapping()
>
> And we are in a situation where we fail in dax_radix_entry() with -EIO.
>
> Another problem with the current DAX page fault locking is that there is
> no race-free way to clear dirty tag in the radix tree. We can always
> end up with clean radix tree and dirty data in CPU cache.
>
> We fix the first problem by introducing locking of exceptional radix
> tree entries in DAX mappings acting very similarly to page lock and thus
> synchronizing properly faults against the same mapping index. The same
> lock can later be used to avoid races when clearing radix tree dirty
> tag.
>
> Reviewed-by: NeilBrown <neilb@suse.com>
> Reviewed-by: Ross Zwisler <ross.zwisler@linux.intel.com>
> Signed-off-by: Jan Kara <jack@suse.cz>
> ---
<>
> @@ -897,13 +1166,10 @@ int __dax_pmd_fault(struct vm_area_struct *vma, unsigned long address,
> * the write to insert a dirty entry.
> */
> if (write) {
> - error = dax_radix_entry(mapping, pgoff, dax.sector,
> - true, true);
> - if (error) {
> - dax_pmd_dbg(&bh, address,
> - "PMD radix insertion failed");
> - goto fallback;
> - }
> + /*
> + * We should insert radix-tree entry and dirty it here.
> + * For now this is broken...
> + */
With this change the 'error' variable in __dax_pmd_fault() is now unused,
resulting in a compiler warning.
fs/dax.c: In function ‘__dax_pmd_fault’:
fs/dax.c:1019:6: warning: unused variable ‘error’ [-Wunused-variable]
int error, result = 0;
^
_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm
WARNING: multiple messages have this Message-ID (diff)
From: Ross Zwisler <ross.zwisler@linux.intel.com>
To: Jan Kara <jack@suse.cz>
Cc: linux-nvdimm@lists.01.org, Ted Tso <tytso@mit.edu>,
linux-ext4@vger.kernel.org,
Vishal Verma <vishal.l.verma@intel.com>,
Ross Zwisler <ross.zwisler@linux.intel.com>,
Dan Williams <dan.j.williams@intel.com>,
linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH 5/7] dax: New fault locking
Date: Thu, 12 May 2016 13:36:24 -0600 [thread overview]
Message-ID: <20160512193624.GA20719@linux.intel.com> (raw)
In-Reply-To: <1463070560-1979-6-git-send-email-jack@suse.cz>
On Thu, May 12, 2016 at 06:29:18PM +0200, Jan Kara wrote:
> Currently DAX page fault locking is racy.
>
> CPU0 (write fault) CPU1 (read fault)
>
> __dax_fault() __dax_fault()
> get_block(inode, block, &bh, 0) -> not mapped
> get_block(inode, block, &bh, 0)
> -> not mapped
> if (!buffer_mapped(&bh))
> if (vmf->flags & FAULT_FLAG_WRITE)
> get_block(inode, block, &bh, 1) -> allocates blocks
> if (page) -> no
> if (!buffer_mapped(&bh))
> if (vmf->flags & FAULT_FLAG_WRITE) {
> } else {
> dax_load_hole();
> }
> dax_insert_mapping()
>
> And we are in a situation where we fail in dax_radix_entry() with -EIO.
>
> Another problem with the current DAX page fault locking is that there is
> no race-free way to clear dirty tag in the radix tree. We can always
> end up with clean radix tree and dirty data in CPU cache.
>
> We fix the first problem by introducing locking of exceptional radix
> tree entries in DAX mappings acting very similarly to page lock and thus
> synchronizing properly faults against the same mapping index. The same
> lock can later be used to avoid races when clearing radix tree dirty
> tag.
>
> Reviewed-by: NeilBrown <neilb@suse.com>
> Reviewed-by: Ross Zwisler <ross.zwisler@linux.intel.com>
> Signed-off-by: Jan Kara <jack@suse.cz>
> ---
<>
> @@ -897,13 +1166,10 @@ int __dax_pmd_fault(struct vm_area_struct *vma, unsigned long address,
> * the write to insert a dirty entry.
> */
> if (write) {
> - error = dax_radix_entry(mapping, pgoff, dax.sector,
> - true, true);
> - if (error) {
> - dax_pmd_dbg(&bh, address,
> - "PMD radix insertion failed");
> - goto fallback;
> - }
> + /*
> + * We should insert radix-tree entry and dirty it here.
> + * For now this is broken...
> + */
With this change the 'error' variable in __dax_pmd_fault() is now unused,
resulting in a compiler warning.
fs/dax.c: In function ‘__dax_pmd_fault’:
fs/dax.c:1019:6: warning: unused variable ‘error’ [-Wunused-variable]
int error, result = 0;
^
next prev parent reply other threads:[~2016-05-12 19:36 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-12 16:29 [PATCH 0/7 v4] DAX page fault locking Jan Kara
2016-05-12 16:29 ` Jan Kara
2016-05-12 16:29 ` [PATCH 1/7] dax: Fix condition for filling of PMD holes Jan Kara
2016-05-12 16:29 ` Jan Kara
2016-05-12 19:03 ` Ross Zwisler
2016-05-12 19:03 ` Ross Zwisler
2016-05-12 16:29 ` [PATCH 2/7] dax: Make huge page handling depend of CONFIG_BROKEN Jan Kara
2016-05-12 16:29 ` Jan Kara
2016-05-12 18:59 ` Ross Zwisler
2016-05-12 18:59 ` Ross Zwisler
2016-05-12 16:29 ` [PATCH 3/7] dax: Define DAX lock bit for radix tree exceptional entry Jan Kara
2016-05-12 16:29 ` Jan Kara
2016-05-12 16:29 ` [PATCH 4/7] dax: Allow DAX code to replace exceptional entries Jan Kara
2016-05-12 16:29 ` Jan Kara
2016-05-12 16:29 ` [PATCH 5/7] dax: New fault locking Jan Kara
2016-05-12 16:29 ` Jan Kara
2016-05-12 19:36 ` Ross Zwisler [this message]
2016-05-12 19:36 ` Ross Zwisler
2016-05-12 19:36 ` Ross Zwisler
2016-05-19 9:27 ` Jan Kara
2016-05-19 9:27 ` Jan Kara
2016-05-19 9:27 ` Jan Kara
2016-05-12 16:29 ` [PATCH 6/7] dax: Use radix tree entry lock to protect cow faults Jan Kara
2016-05-12 16:29 ` Jan Kara
2016-05-12 16:29 ` [PATCH 7/7] dax: Remove i_mmap_lock protection Jan Kara
2016-05-12 16:29 ` Jan Kara
2016-05-12 16:29 ` Jan Kara
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20160512193624.GA20719@linux.intel.com \
--to=ross.zwisler@linux.intel.com \
--cc=dan.j.williams@intel.com \
--cc=jack@suse.cz \
--cc=linux-ext4@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-nvdimm@lists.01.org \
--cc=tytso@mit.edu \
--cc=vishal.l.verma@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.