[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CS1PR84MB0294132B3BE2597C54A8778382010@CS1PR84MB0294.NAMPRD84.PROD.OUTLOOK.COM>
Date: Mon, 10 Apr 2017 22:47:02 +0000
From: "Kani, Toshimitsu" <toshi.kani@....com>
To: Dan Williams <dan.j.williams@...el.com>
CC: "linux-nvdimm@...ts.01.org" <linux-nvdimm@...ts.01.org>,
Jan Kara <jack@...e.cz>,
Matthew Wilcox <mawilcox@...rosoft.com>,
"x86@...nel.org" <x86@...nel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"stable@...r.kernel.org" <stable@...r.kernel.org>,
Christoph Hellwig <hch@....de>, Jeff Moyer <jmoyer@...hat.com>,
Ingo Molnar <mingo@...hat.com>,
Al Viro <viro@...iv.linux.org.uk>,
"H. Peter Anvin" <hpa@...or.com>,
Thomas Gleixner <tglx@...utronix.de>,
Ross Zwisler <ross.zwisler@...ux.intel.com>
Subject: RE: [PATCH v2] x86, pmem: fix broken __copy_user_nocache cache-bypass
assumptions
> >> > The clflush here flushes for the cacheline size. So, we do not need to
> flush
> >> > the same cacheline again when the unaligned tail is in the same line.
> >>
> >> Ok, makes sense. Last question, can't we reduce the check to be:
> >>
> >> if ((bytes > flushed) && ((bytes - flushed) & 3))
> >>
> >> ...since if 'bytes' was 4-byte aligned we would have performed
> >> non-temporal stores.
> >
> > That is not documented behavior of copy_user_nocache, but as long as the
> pmem
> > version of copy_user_nocache follows the same implemented behavior, yes,
> that
> > works.
>
> Hmm, sorry this comment confuses me, I'm only referring to the current
> version of __copy_user_nocache not the new pmem version. The way I
> read the current code we only ever jump to the cached copy loop
> (.L_1b_cache_copy_loop) if the trailing byte-count is 4-byte
> misaligned.
Yes, you are right and that's how the code is implemented. I added this trailing
4-byte handling for the >=8B case, which is shared with <8B case, since it was
easy to do. But I considered it a bonus. This function also needs to handle
4B-aligned destination if it is to state that it handles 4B alignment for the >=8B
case as well. Otherwise, it's inconsistent. Since I did not see much point of supporting
such case, I simply documented in the Note that 8 byte alignment is required for
the >=8B case.
Thanks,
-Toshi
Powered by blists - more mailing lists