[RFC] inconsistent semantics of _copy_mc_to_iter()

2021-04-24 Thread Al Viro
In case of failure halfway through the operation we get very different results depending upon the iov_iter flavour: iovec, pipe - advances by the amount actually copied, kvec, bvec - does *NOT* advance at all Which semantics is desired? AFAICS, the calls can be repeated -

Re: [PATCH v4 4/9] cxl/mem: Add basic IOCTL interface

2021-02-16 Thread Al Viro
On Mon, Feb 15, 2021 at 05:45:33PM -0800, Ben Widawsky wrote: > + if (cmd->info.size_in) { > + mbox_cmd.payload_in = kvzalloc(cmd->info.size_in, GFP_KERNEL); > + if (!mbox_cmd.payload_in) { > + rc = -ENOMEM; > + goto out; > +

Re: [PATCH v2 4/8] cxl/mem: Add basic IOCTL interface

2021-02-14 Thread Al Viro
On Sun, Feb 14, 2021 at 11:50:12PM +, Al Viro wrote: > check that len is reasonable > p = kmalloc(offsetof(struct foo, string[len]), GFP_KERNEL); > copy_from_user(p, user_object, len); offsetof(struct foo, string[len])

Re: [PATCH v2 4/8] cxl/mem: Add basic IOCTL interface

2021-02-14 Thread Al Viro
On Sun, Feb 14, 2021 at 03:14:56PM -0800, Ben Widawsky wrote: > On 21-02-14 16:30:09, Al Viro wrote: > > On Tue, Feb 09, 2021 at 04:02:55PM -0800, Ben Widawsky wrote: > > > > > +static int handle_mailbox_cmd_from_user(struct cxl_memdev *cxlmd, > > > +

Re: [PATCH v2 4/8] cxl/mem: Add basic IOCTL interface

2021-02-14 Thread Al Viro
On Tue, Feb 09, 2021 at 04:02:55PM -0800, Ben Widawsky wrote: > +static int handle_mailbox_cmd_from_user(struct cxl_memdev *cxlmd, > + const struct cxl_mem_command *cmd, > + u64 in_payload, u64 out_payload, > +

Re: [RFC v2] nvfs: a filesystem for persistent memory

2021-01-11 Thread Al Viro
On Mon, Jan 11, 2021 at 11:57:08AM +, David Laight wrote: > > > > size = copy_to_iter(to, ptr, size); > > > > if (unlikely(!size)) { > > > > r = -EFAULT; > > > > goto ret_r; > > > > } > > > > > > > >

Re: [RFC v2] nvfs: a filesystem for persistent memory

2021-01-10 Thread Al Viro
On Sun, Jan 10, 2021 at 04:14:55PM -0500, Mikulas Patocka wrote: > That's a good point. I split nvfs_rw_iter to separate functions > nvfs_read_iter and nvfs_write_iter - and inlined nvfs_rw_iter_locked into > both of them. It improved performance by 1.3%. > > > Not that it had been more useful

Re: [RFC v2] nvfs: a filesystem for persistent memory

2021-01-10 Thread Al Viro
On Sun, Jan 10, 2021 at 04:20:08PM +, Al Viro wrote: > On Thu, Jan 07, 2021 at 08:15:41AM -0500, Mikulas Patocka wrote: > > Hi > > > > I announce a new version of NVFS - a filesystem for persistent memory. > > http://people.redhat.com/~mpatocka/nvfs/ > Ut

Re: [RFC v2] nvfs: a filesystem for persistent memory

2021-01-10 Thread Al Viro
On Thu, Jan 07, 2021 at 08:15:41AM -0500, Mikulas Patocka wrote: > Hi > > I announce a new version of NVFS - a filesystem for persistent memory. > http://people.redhat.com/~mpatocka/nvfs/ Utilities, AFAICS > git://leontynka.twibright.com/nvfs.git Seems to hang on git pull at the momen

Re: [PATCH v2] fs/dax: include to fix build error on ARC

2021-01-04 Thread Al Viro
On Thu, Dec 31, 2020 at 08:29:14PM -0800, Randy Dunlap wrote: > fs/dax.c uses copy_user_page() but ARC does not provide that interface, > resulting in a build error. > > Provide copy_user_page() in (beside copy_page()) and > add to fs/dax.c to fix the build error. > > ../fs/dax.c: In function '

Re: [PATCH RFC PKS/PMEM 33/58] fs/cramfs: Utilize new kmap_thread()

2020-10-13 Thread Al Viro
On Tue, Oct 13, 2020 at 08:36:43PM +0100, Matthew Wilcox wrote: > static inline void copy_to_highpage(struct page *to, void *vfrom, unsigned > int size) > { > char *vto = kmap_atomic(to); > > memcpy(vto, vfrom, size); > kunmap_atomic(vto); > } > > in linux/highmem.h ? You mea

Re: [PATCH v3 12/26] compat_ioctl: move more drivers to compat_ptr_ioctl

2019-04-25 Thread Al Viro
On Thu, Apr 25, 2019 at 05:55:23PM +0200, Arnd Bergmann wrote: > On Thu, Apr 25, 2019 at 5:35 PM Al Viro wrote: > > > > On Thu, Apr 25, 2019 at 12:21:53PM -0300, Mauro Carvalho Chehab wrote: > > > > > If I understand your patch description well, using compat_ptr

Re: [PATCH v3 12/26] compat_ioctl: move more drivers to compat_ptr_ioctl

2019-04-25 Thread Al Viro
On Thu, Apr 25, 2019 at 12:21:53PM -0300, Mauro Carvalho Chehab wrote: > If I understand your patch description well, using compat_ptr_ioctl > only works if the driver is not for s390, right? No; s390 is where "oh, just set ->compat_ioctl same as ->unlocked_ioctl and be done with that; compat_ptr

Re: [PATCH v2 05/17] compat_ioctl: move more drivers to generic_compat_ioctl_ptrarg

2018-09-14 Thread Al Viro
On Fri, Sep 14, 2018 at 01:35:06PM -0700, Darren Hart wrote: > Acked-by: Darren Hart (VMware) > > As for a longer term solution, would it be possible to init fops in such > a way that the compat_ioctl call defaults to generic_compat_ioctl_ptrarg > so we don't have to duplicate this boilerplate

Re: [PATCH 2/3] fs/ext2/inode: Fix a type cast error for fsdax

2018-07-01 Thread Al Viro
On Sun, Jul 01, 2018 at 02:18:47PM +0800, Huaisheng Ye wrote: > From: Huaisheng Ye > > The type of offset within struct iomap is loff_t, which represents > file offset of mapping. > > In ext2_iomap_begin, iomap->offset shall be given a type cast as > loff_t instead of u64. Why is it an error?

Re: [PATCH v9 2/6] fs, mm: pass fd to ->mmap_validate()

2017-10-11 Thread Al Viro
On Wed, Oct 11, 2017 at 05:47:18PM -0700, Dan Williams wrote: > The MAP_DIRECT mechanism for mmap intends to use a file lease to prevent > block map changes while the file is mapped. It requires the fd to setup > an fasync_struct for signalling lease break events to the lease holder. *UGH* That l

Re: [GIT PULL] libnvdimm for 4.13

2017-07-06 Thread Al Viro
On Fri, Jul 07, 2017 at 12:22:38AM +, Williams, Dan J wrote: > Hi Linus, please pull from: > > git://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm > tags/libnvdimm-for-4.13 > > to receive, libnvdimm updates for the latest ACPI and UEFI > specifications. This pull request also inclu

Re: [RFC PATCH 1/2] mm: introduce bmap_walk()

2017-06-19 Thread Al Viro
On Sun, Jun 18, 2017 at 09:51:52AM +0200, Christoph Hellwig wrote: > > That said, I think "please don't add a new bmap() > > user, use iomap instead" is a fair comment. You know me well enough to > > know that would be all it takes to redirect my work, I can do without > > the bluster. > > But th

[NAK] copy_from_iter_ops()

2017-04-24 Thread Al Viro
I should have looked and commented earlier, but I hadn't spotted that thing until -next conflicts had shown up. As the matter of fact, I don't have this series in my mailbox - it had been Cc'd my way, apparently, but it looks like it never made it there, so I'm posting from scratch instead

Re: [RFC] memcpy_nocache() and memcpy_writethrough()

2017-01-03 Thread Al Viro
On Tue, Jan 03, 2017 at 05:38:54PM -0800, Dan Williams wrote: > > 1) memcpy_to_pmem() seems to rely upon the __copy_from_user_nocache() > > having only used movnt; it does not attempt clwb at all. > > Yes, and there was a fix a while back to make sure it always used > movnt so clwb after the fact

Re: [RFC] memcpy_nocache() and memcpy_writethrough()

2017-01-03 Thread Al Viro
On Tue, Jan 03, 2017 at 01:14:11PM -0800, Dan Williams wrote: > Robert was describing the overall flow / mechanics, but I think it is > easier to visualize the sfence as a flush command sent to a disk > device with a volatile cache. In fact, that's how we implemented it in > the pmem block device

Re: [RFC] memcpy_nocache() and memcpy_writethrough()

2017-01-01 Thread Al Viro
On Mon, Jan 02, 2017 at 02:35:36AM +, Elliott, Robert (Persistent Memory) wrote: > > -Original Message- > > From: linux-kernel-ow...@vger.kernel.org [mailto:linux-kernel- > > ow...@vger.kernel.org] On Behalf Of Al Viro > > Sent: Friday, December 30, 2016 8

[RFC] memcpy_nocache() and memcpy_writethrough()

2016-12-30 Thread Al Viro
On Thu, Dec 29, 2016 at 08:56:13PM -0800, Dan Williams wrote: > > Um... Then we do have a problem - nocache variant of uaccess primitives > > does *not* guarantee that clwb is redundant. > > > > What about the requirements of e.g. tcp_sendmsg() with its use of > > skb_add_data_nocache()? What wa

Re: [PATCH v2 1/3] introduce memcpy_nocache()

2016-12-29 Thread Al Viro
On Thu, Dec 29, 2016 at 10:23:15AM -0800, Dan Williams wrote: > > BTW, your "it's iovec, only non-temporal stores there" logics in > > arch_copy_from_iter_pmem() is simply wrong - for one thing, unaligned > > copies will have parts done via normal stores, for another 32bit will > > _not_ go for no

Re: [PATCH v2 1/3] introduce memcpy_nocache()

2016-12-28 Thread Al Viro
On Tue, Nov 01, 2016 at 04:25:12PM +0200, Boaz Harrosh wrote: > >> What about memcpy_to_pmem() in linux/pmem.h it already has all the arch > >> switches. > >> > >> Feels bad to add yet just another arch switch over __copy_user_nocache > >> > >> Just feels like too many things that do the same thi

Re: [PATCH 3/6] dax: add tracepoint infrastructure, PMD tracing

2016-11-27 Thread Al Viro
On Sun, Nov 27, 2016 at 04:58:43PM -0800, Linus Torvalds wrote: > You are living in some unrealistic dream-world where you think you can > get the right tracepoint on the first try. > > So there is no way in hell I would ever mark any tracepoint "stable" > until it has had a fair amount of use, an

Re: [PATCH 3/6] dax: add tracepoint infrastructure, PMD tracing

2016-11-24 Thread Al Viro
On Fri, Nov 25, 2016 at 06:06:42PM +1100, Dave Chinner wrote: > > Tell that to Linus. You had been in the room, IIRC, when that had been > > brought up this year in Santa Fe. > > No, I wasn't at KS or plumbers, so this is all news to me. Sorry, thought you had been at KS ;-/ My apologies... [

Re: [PATCH 3/6] dax: add tracepoint infrastructure, PMD tracing

2016-11-24 Thread Al Viro
[Linus Cc'd] On Fri, Nov 25, 2016 at 01:49:18PM +1100, Dave Chinner wrote: > > they have become parts of stable userland ABI and are to be maintained > > indefinitely. Don't expect "tracepoints are special case" to prevent that. > > I call bullshit just like I always do when someone spouts this

Re: [PATCH 3/6] dax: add tracepoint infrastructure, PMD tracing

2016-11-24 Thread Al Viro
On Wed, Nov 23, 2016 at 11:44:19AM -0700, Ross Zwisler wrote: > Tracepoints are the standard way to capture debugging and tracing > information in many parts of the kernel, including the XFS and ext4 > filesystems. Create a tracepoint header for FS DAX and add the first DAX > tracepoints to the PM

Re: [PATCH] use a nocache copy for bvecs in copy_from_iter_nocache()

2016-10-07 Thread Al Viro
On Fri, Oct 07, 2016 at 10:55:11AM -0500, Brian Boylston wrote: > copy_from_iter_nocache() is only "nocache" for iovecs. Enhance it to also > use a nocache copy for bvecs. This improves performance by 2-3X when > splice()ing to a file in a DAX-mounted, pmem-backed file system. > +static void mem

Re: [PATCH] fs/char_dev: fix cdev_put() vs f_op->release() use-after-free

2016-08-10 Thread Al Viro
On Wed, Aug 10, 2016 at 09:49:22PM -0700, Dan Williams wrote: > Where dax_dev_release() is the f_op->release() method, and is > implemented to simply drop the final references on our driver objects: > > struct dax_dev *dax_dev = filp->private_data; > struct device *dev = dax_dev->