Re: [PATCH 0/5] 4.14 backports of fixes for "CoW after fork() issue"

2021-04-07 Thread Mikulas Patocka
On Wed, 7 Apr 2021, Linus Torvalds wrote: > On Wed, Apr 7, 2021 at 9:33 AM Suren Baghdasaryan wrote: > > > > Trying my hand at backporting the patchsets Peter mentioned proved > > this to be far from easy with many dependencies. Let me look into > > Vlastimil's suggestion to backport only 1783

[RFC v3] nvfs: a filesystem for persistent memory

2021-02-15 Thread Mikulas Patocka
Hi I announce a new version of NVFS - a filesystem for persistent memory. http://people.redhat.com/~mpatocka/nvfs/ git://leontynka.twibright.com/nvfs.git Changes since the last release: I reworked file read/write handling: * the functions nvfs_read and nvfs_write were deleted be

Re: Expense of read_iter

2021-01-21 Thread Mikulas Patocka
On Thu, 21 Jan 2021, Matthew Wilcox wrote: > On Wed, Jan 20, 2021 at 10:12:01AM -0500, Mikulas Patocka wrote: > > Do you have some idea how to optimize the generic code that calls > > ->read_iter? > > Yes. > > > It might be better to maintain an f_iocb_flag

Re: Expense of read_iter

2021-01-20 Thread Mikulas Patocka
On Wed, 20 Jan 2021, Jan Kara wrote: > Yeah, I agree. I'm against ext4 private solution for this read problem. And > I'm also against duplicating ->read_iter functionatily in ->read handler. > The maintenance burden of this code duplication is IMHO just too big. We > rather need to improve the

Re: Expense of read_iter

2021-01-13 Thread Mikulas Patocka
On Tue, 12 Jan 2021, Zhongwei Cai wrote: > > I'm working with Mingkai on optimizations for Ext4-dax. What specific patch are you working on? Please, post it somewhere. > We think that optmizing the read-iter method cannot achieve the > same performance as the read method for Ext4-dax. > We

Re: Expense of read_iter

2021-01-11 Thread Mikulas Patocka
On Mon, 11 Jan 2021, Matthew Wilcox wrote: > On Sun, Jan 10, 2021 at 04:19:15PM -0500, Mikulas Patocka wrote: > > I put counters into vfs_read and vfs_readv. > > > > After a fresh boot of the virtual machine, the counters show "13385 4". > > After a ke

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

2021-01-11 Thread Mikulas Patocka
On Mon, 11 Jan 2021, David Laight wrote: > From: Al Viro On Behalf Of Al Viro > > Sent: 10 January 2021 16:20 > > > > On Thu, Jan 07, 2021 at 08:15:41AM -0500, Mikulas Patocka wrote: > > > Hi > > > > > > I announce a new version of NVFS -

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

2021-01-11 Thread Mikulas Patocka
On Sun, 10 Jan 2021, Al Viro wrote: > 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 > &

Re: Expense of read_iter

2021-01-10 Thread Mikulas Patocka
On Sun, 10 Jan 2021, Matthew Wilcox wrote: > > That is the reason for that 10% degradation with read_iter. > > You seem to be focusing on your argument for "let's just permit > filesystems to implement both ->read and ->read_iter". My suggestion > is that we need to optimise the ->read_iter p

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

2021-01-10 Thread Mikulas Patocka
On Sun, 10 Jan 2021, 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: Expense of read_iter

2021-01-07 Thread Mikulas Patocka
On Thu, 7 Jan 2021, Matthew Wilcox wrote: > On Thu, Jan 07, 2021 at 08:15:41AM -0500, Mikulas Patocka wrote: > > I'd like to ask about this piece of code in __kernel_read: > > if (unlikely(!file->f_op->read_iter || file->f_op->read)) > >

[RFC v2] nvfs: a filesystem for persistent memory

2021-01-07 Thread Mikulas Patocka
Hi I announce a new version of NVFS - a filesystem for persistent memory. http://people.redhat.com/~mpatocka/nvfs/ git://leontynka.twibright.com/nvfs.git Changes since the last release: * I added a microjournal to the filesystem, it can hold up to 16 entries. Each CPU has it's

Re: [PATCH v3 0/2] dm crypt: some fixes to support dm-crypt running in softirq context

2021-01-04 Thread Mikulas Patocka
softirq > > drivers/md/dm-crypt.c | 138 +- > 1 file changed, 123 insertions(+), 15 deletions(-) > > -- > 2.20.1 > Acked-by: Mikulas Patocka

Re: [PATCH v2 1/2] dm crypt: use GFP_ATOMIC when allocating crypto requests from softirq

2021-01-01 Thread Mikulas Patocka
On Wed, 30 Dec 2020, Ignat Korchagin wrote: > diff --git a/drivers/md/dm-crypt.c b/drivers/md/dm-crypt.c > index 53791138d78b..e4fd690c70e1 100644 > --- a/drivers/md/dm-crypt.c > +++ b/drivers/md/dm-crypt.c > @@ -1539,7 +1549,10 @@ static blk_status_t crypt_convert(struct crypt_config > *cc, >

Re: [PATCH 1/2] dm crypt: use GFP_ATOMIC when allocating crypto requests from softirq

2020-12-30 Thread Mikulas Patocka
Hi This patch doesn't handle allocation failure gracefully. Mikulas On Tue, 29 Dec 2020, Ignat Korchagin wrote: > Commit 39d42fa96ba1b7d2544db3f8ed5da8fb0d5cb877 made it possible for some code > paths in dm-crypt to be executed in softirq context, when the underlying > driver > processes IO

Re: [RFC PATCH v3 1/2] block: add simple copy support

2020-12-11 Thread Mikulas Patocka
On Fri, 11 Dec 2020, Johannes Thumshirn wrote: > On 11/12/2020 15:57, SelvaKumar S wrote: > [...] > > +int blk_copy_emulate(struct block_device *bdev, struct blk_copy_payload > > *payload, > > + gfp_t gfp_mask) > > +{ > > + struct request_queue *q = bdev_get_queue(bdev); > > + s

Re: md: dm-writeback: add __noreturn to BUG-ging function

2020-11-18 Thread Mikulas Patocka
e called. And if it can't be called, you don't need to add a code that prints an error in that case. If we don't have DM_WRITECACHE_HAS_PMEM, the compiler optimizer will remove all the code guarded with if (WC_MODE_PMEM(wc)) as unreachable. Mikulas From: Mikulas Patocka Subject:

Re: [PATCH] Revert "dm cache: fix arm link errors with inline"

2020-11-11 Thread Mikulas Patocka
Acked-by: Mikulas Patocka On Tue, 10 Nov 2020, Nick Desaulniers wrote: > This reverts commit 43aeaa29573924df76f44eda2bbd94ca36e407b5. > > Since > commit 0bddd227f3dc ("Documentation: update for gcc 4.9 requirement") > the minimum supported version of GCC is gcc-4.9

Re: NVFS XFS metadata (was: [PATCH] pmem: export the symbols __copy_user_flushcache and __copy_from_user_flushcache)

2020-09-28 Thread Mikulas Patocka
On Thu, 24 Sep 2020, Mikulas Patocka wrote: > On Tue, 22 Sep 2020, Matthew Wilcox wrote: > > > > There is a small window when renamed inode is neither in source nor in > > > target directory. Fsck will reclaim such inode and add it to lost+found - > > > jus

Re: NVFS XFS metadata (was: [PATCH] pmem: export the symbols __copy_user_flushcache and __copy_from_user_flushcache)

2020-09-24 Thread Mikulas Patocka
On Tue, 22 Sep 2020, Matthew Wilcox wrote: > > > The NVFS indirect block tree has a fan-out of 16, > > > > No. The top level in the inode contains 16 blocks (11 direct and 5 > > indirect). And each indirect block can have 512 pointers (4096/8). You can > > format the device with larger block

Re: NVFS XFS metadata (was: [PATCH] pmem: export the symbols __copy_user_flushcache and __copy_from_user_flushcache)

2020-09-23 Thread Mikulas Patocka
On Wed, 23 Sep 2020, Dave Chinner wrote: > > > dir-test /mnt/test/linux-2.6 63000 1048576 > > > nvfs 6.6s > > > ext4 dax 8.4s > > > xfs dax 12.2s > > > > > > > > > dir-test /mnt/test/linux-2.6 63000 1048576 link > > > nvfs 4.7s > > > ext4 dax 5.6s > > > x

Re: NVFS XFS metadata (was: [PATCH] pmem: export the symbols __copy_user_flushcache and __copy_from_user_flushcache)

2020-09-23 Thread Mikulas Patocka
On Wed, 23 Sep 2020, Jan Kara wrote: > On Tue 22-09-20 12:46:05, Mikulas Patocka wrote: > > > mapping 2^21 blocks requires a 5 level indirect tree. Which one if going > > > to be faster to truncate away - a single record or 2 million individual > > > blocks?

Re: A bug in ext4 with big directories (was: NVFS XFS metadata)

2020-09-23 Thread Mikulas Patocka
On Wed, 23 Sep 2020, Jan Kara wrote: > Hi! > > On Wed 23-09-20 05:20:55, Mikulas Patocka wrote: > > There seems to be a bug in ext4 - when I create very large directory, ext4 > > fails with -ENOSPC despite the fact that there is plenty of free space and > > fr

A bug in ext4 with big directories (was: NVFS XFS metadata)

2020-09-23 Thread Mikulas Patocka
Hi There seems to be a bug in ext4 - when I create very large directory, ext4 fails with -ENOSPC despite the fact that there is plenty of free space and free inodes on the filesystem. How to reproduce: download the program dir-test: http://people.redhat.com/~mpatocka/benchmarks/dir-test.c # m

Re: NVFS XFS metadata (was: [PATCH] pmem: export the symbols __copy_user_flushcache and __copy_from_user_flushcache)

2020-09-22 Thread Mikulas Patocka
sn't clearly explained > > On Mon, Sep 21, 2020 at 12:20:42PM -0400, Mikulas Patocka wrote: > > On Wed, 16 Sep 2020, Mikulas Patocka wrote: > > > On Wed, 16 Sep 2020, Dan Williams wrote: > > > > On Wed, Sep 16, 2020 at 10:24 AM Mikulas Patocka >

Re: NVFS XFS metadata (was: [PATCH] pmem: export the symbols __copy_user_flushcache and __copy_from_user_flushcache)

2020-09-22 Thread Mikulas Patocka
On Tue, 22 Sep 2020, Matthew Wilcox wrote: > On Mon, Sep 21, 2020 at 12:20:42PM -0400, Mikulas Patocka wrote: > > The same for directories - NVFS hashes the file name and uses radix-tree > > to locate a directory page where the directory entry is located. XFS > > b+trees

NVFS XFS metadata (was: [PATCH] pmem: export the symbols __copy_user_flushcache and __copy_from_user_flushcache)

2020-09-21 Thread Mikulas Patocka
On Wed, 16 Sep 2020, Mikulas Patocka wrote: > > > On Wed, 16 Sep 2020, Dan Williams wrote: > > > On Wed, Sep 16, 2020 at 10:24 AM Mikulas Patocka > > wrote: > > > > > > > My first question about nvfs is how it compares to a daxfs with > &g

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

2020-09-21 Thread Mikulas Patocka
On Tue, 15 Sep 2020, Dan Williams wrote: > > TODO: > > > > - programs run approximately 4% slower when running from Optane-based > > persistent memory. Therefore, programs and libraries should use page cache > > and not DAX mapping. > > This needs to be based on platform firmware data f(ACPI H

the "read" syscall sees partial effects of the "write" syscall

2020-09-18 Thread Mikulas Patocka
Hi I'd like to ask about this problem: when we write to a file, the kernel takes the write inode lock. When we read from a file, no lock is taken - thus the read syscall can read data that are halfway modified by the write syscall. The standard specifies the effects of the write syscall are at

Re: [PATCH] pmem: export the symbols __copy_user_flushcache and __copy_from_user_flushcache

2020-09-16 Thread Mikulas Patocka
On Wed, 16 Sep 2020, Dan Williams wrote: > On Wed, Sep 16, 2020 at 3:57 AM Mikulas Patocka wrote: > > > > > > > > I'm submitting this patch that adds the required exports (so that we could > > use __copy_from_user_flushcache on x86, arm64 and powerpc). P

[PATCH] pmem: fix __copy_user_flushcache

2020-09-16 Thread Mikulas Patocka
On Wed, 16 Sep 2020, Dan Williams wrote: > On Wed, Sep 16, 2020 at 10:24 AM Mikulas Patocka wrote: > > > > > > > > On Wed, 16 Sep 2020, Dan Williams wrote: > > > > > On Wed, Sep 16, 2020 at 3:57 AM Mikulas Patocka > > > wrote: > > &

Re: [PATCH] pmem: export the symbols __copy_user_flushcache and __copy_from_user_flushcache

2020-09-16 Thread Mikulas Patocka
On Wed, 16 Sep 2020, Dan Williams wrote: > On Wed, Sep 16, 2020 at 10:24 AM Mikulas Patocka wrote: > > > > > My first question about nvfs is how it compares to a daxfs with > > > executables and other binaries configured to use page cache with the > > > new

[PATCH] pmem: export the symbols __copy_user_flushcache and __copy_from_user_flushcache

2020-09-16 Thread Mikulas Patocka
On Tue, 15 Sep 2020, Mikulas Patocka wrote: > > > On Tue, 15 Sep 2020, Mikulas Patocka wrote: > > > > > - __copy_from_user_inatomic_nocache doesn't flush cache for leading and > > > > trailing bytes. > > > > > > You

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

2020-09-15 Thread Mikulas Patocka
On Tue, 15 Sep 2020, Matthew Wilcox wrote: > On Tue, Sep 15, 2020 at 08:34:41AM -0400, Mikulas Patocka wrote: > > - when the fsck.nvfs tool mmaps the device /dev/pmem0, the kernel uses > > buffer cache for the mapping. The buffer cache slows does fsck by a factor > > of

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

2020-09-15 Thread Mikulas Patocka
On Tue, 15 Sep 2020, Dan Williams wrote: > > - when the fsck.nvfs tool mmaps the device /dev/pmem0, the kernel uses > > buffer cache for the mapping. The buffer cache slows does fsck by a factor > > of 5 to 10. Could it be possible to change the kernel so that it maps DAX > > based block device

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

2020-09-15 Thread Mikulas Patocka
On Tue, 15 Sep 2020, Mikulas Patocka wrote: > > > - __copy_from_user_inatomic_nocache doesn't flush cache for leading and > > > trailing bytes. > > > > You want copy_user_flushcache(). See how fs/dax.c arranges for > > dax_copy_from_iter() to r

[RFC] nvfs: a filesystem for persistent memory

2020-09-15 Thread Mikulas Patocka
Hi I am developing a new filesystem suitable for persistent memory - nvfs. The goal is to have a small and fast filesystem that can be used on DAX-based devices. Nvfs maps the whole device into linear address space and it completely bypasses the overhead of the block layer and buffer cache. I

Re: [PATCH 2/2] xfs: don't update mtime on COW faults

2020-09-11 Thread Mikulas Patocka
On Wed, 9 Sep 2020, Darrick J. Wong wrote: > On Sat, Sep 05, 2020 at 01:02:33PM -0400, Mikulas Patocka wrote: > > > > > > > > I've written this program that tests it - you can integrate it into your > > testsuite. > > I don't get it. You&#

[PATCH 2/2 v2] xfs: don't update mtime on COW faults

2020-09-05 Thread Mikulas Patocka
section, and these faults will incorrectly update the timestamp of the objtool binary. The updated timestamp causes make to rebuild the whole tree. Signed-off-by: Mikulas Patocka Cc: sta...@vger.kernel.org --- fs/xfs/xfs_file.c | 13 ++--- 1 file changed, 10 insertions(+), 3 deletions

Re: [PATCH 2/2] xfs: don't update mtime on COW faults

2020-09-05 Thread Mikulas Patocka
On Sat, 5 Sep 2020, Darrick J. Wong wrote: > On Sat, Sep 05, 2020 at 08:13:02AM -0400, Mikulas Patocka wrote: > > When running in a dax mode, if the user maps a page with MAP_PRIVATE and > > PROT_WRITE, the xfs filesystem would incorrectly update ctime and mtime > > whe

[PATCH 2/2] xfs: don't update mtime on COW faults

2020-09-05 Thread Mikulas Patocka
section, and these faults will incorrectly update the timestamp of the objtool binary. The updated timestamp causes make to rebuild the whole tree. Signed-off-by: Mikulas Patocka Cc: sta...@vger.kernel.org --- fs/xfs/xfs_file.c | 11 +-- 1 file changed, 9 insertions(+), 2 deletions

[PATCH 1/2] ext2: don't update mtime on COW faults

2020-09-05 Thread Mikulas Patocka
section, and these faults will incorrectly update the timestamp of the objtool binary. The updated timestamp causes make to rebuild the whole tree. Signed-off-by: Mikulas Patocka Cc: sta...@vger.kernel.org --- fs/ext2/file.c |6 -- 1 file changed, 4 insertions(+), 2 deletions(-) Index

Re: make misbehavior on ext2 in dax mode (was: a crash when running strace from persistent memory)

2020-09-05 Thread Mikulas Patocka
On Fri, 4 Sep 2020, Mikulas Patocka wrote: > Hmm, so I've found another bug in dax mode. > > If you extract the Linux kernel tree on dax-based ext2 filesystem (use the > real ext2 driver, not ext4), and then you run make twice, the second > invocation will rebuild every

make misbehavior on ext2 in dax mode (was: a crash when running strace from persistent memory)

2020-09-04 Thread Mikulas Patocka
On Thu, 3 Sep 2020, Mikulas Patocka wrote: > Hi > > There's a bug when you run strace from dax-based filesystem. Hmm, so I've found another bug in dax mode. If you extract the Linux kernel tree on dax-based ext2 filesystem (use the real ext2 driver, not ext4), and then

Re: a crash when running strace from persistent memory

2020-09-04 Thread Mikulas Patocka
On Thu, 3 Sep 2020, Linus Torvalds wrote: > On Thu, Sep 3, 2020 at 12:24 PM Mikulas Patocka wrote: > > > > There's a bug when you run strace from dax-based filesystem. > > > > -- create real or emulated persistent memory device (/dev/pmem0) > > mkfs.ext

a crash when running strace from persistent memory

2020-09-03 Thread Mikulas Patocka
Hi There's a bug when you run strace from dax-based filesystem. -- create real or emulated persistent memory device (/dev/pmem0) mkfs.ext2 /dev/pmem0 -- mount it mount -t ext2 -o dax /dev/pmem0 /mnt/test -- copy the system to it (well, you can copy just a few files that are needed for running

[PATCH] dm-bufio: do cleanup from a workqueue

2020-07-03 Thread Mikulas Patocka
o a workqueue. Please review it. Mikulas From: Mikulas Patocka kswapd should not block because it degrades system performance. So, move reclaim of buffers to a workqueue. Signed-off-by: Mikulas Patocka --- drivers/md/dm-bufio.c | 60 ++ 1 fi

[PATCH 1/3 v6] crypto: introduce the flag CRYPTO_ALG_ALLOCATES_MEMORY

2020-06-30 Thread Mikulas Patocka
GFP_KERNEL allocation can recurse into the block layer, causing a deadlock. Pass the flag CRYPTO_ALG_ALLOCATES_MEMORY down through the crypto API. Signed-off-by: Mikulas Patocka --- crypto/adiantum.c |8 +--- crypto/authenc.c |7 --- crypto/authencesn.c

Re: [dm-devel] [PATCH 1/3 v4] crypto: introduce the flag CRYPTO_ALG_ALLOCATES_MEMORY

2020-06-30 Thread Mikulas Patocka
On Tue, 30 Jun 2020, Eric Biggers wrote: > On Tue, Jun 30, 2020 at 01:01:16PM -0400, Mikulas Patocka wrote: > > > diff --git a/crypto/pcrypt.c b/crypto/pcrypt.c > > > index 7240e8bbdebb..643f7f1cc91c 100644 > > > --- a/crypto/pcrypt.c > > > +++ b/c

[PATCH 1/3 v5] crypto: introduce the flag CRYPTO_ALG_ALLOCATES_MEMORY

2020-06-30 Thread Mikulas Patocka
GFP_KERNEL allocation can recurse into the block layer, causing a deadlock. Pass the flag CRYPTO_ALG_ALLOCATES_MEMORY down through the crypto API. Signed-off-by: Mikulas Patocka --- crypto/adiantum.c |8 +--- crypto/authenc.c |7 --- crypto/authencesn.c

Re: [dm-devel] [PATCH 1/3 v4] crypto: introduce the flag CRYPTO_ALG_ALLOCATES_MEMORY

2020-06-30 Thread Mikulas Patocka
On Tue, 30 Jun 2020, Eric Biggers wrote: > On Tue, Jun 30, 2020 at 09:56:22AM -0400, Mikulas Patocka wrote: > > Index: linux-2.6/crypto/cryptd.c > > === > > --- linux-2.6.orig/crypto/cryptd.c 2020-06-29 16:

Re: [PATCH v3] dm writecache: reject asynchronous pmem.

2020-06-30 Thread Mikulas Patocka
On Tue, 30 Jun 2020, Mikulas Patocka wrote: > > > On Tue, 30 Jun 2020, Michal Suchanek wrote: > > > The writecache driver does not handle asynchronous pmem. Reject it when > > supplied as cache. > > > > Link: https://lore.kernel.org/linux-nvdimm/87l

Re: [PATCH v3] dm writecache: reject asynchronous pmem.

2020-06-30 Thread Mikulas Patocka
er") > > Signed-off-by: Michal Suchanek Acked-by: Mikulas Patocka > --- > drivers/md/dm-writecache.c | 6 ++ > 1 file changed, 6 insertions(+) > > diff --git a/drivers/md/dm-writecache.c b/drivers/md/dm-writecache.c > index 30505d70f423..5358894bb9fd 100644 &

Re: [PATCH v2] dm writecache: reject asynchronous pmem.

2020-06-30 Thread Mikulas Patocka
On Tue, 30 Jun 2020, Michal Suchanek wrote: > The writecache driver does not handle asynchronous pmem. Reject it when > supplied as cache. > > Link: https://lore.kernel.org/linux-nvdimm/87lfk5hahc@linux.ibm.com/ > Fixes: 6e84200c0a29 ("virtio-pmem: Add virtio pmem driver") > > Signed-off-

[PATCH 1/3 v4] crypto: introduce the flag CRYPTO_ALG_ALLOCATES_MEMORY

2020-06-30 Thread Mikulas Patocka
GFP_KERNEL allocation can recurse into the block layer, causing a deadlock. Pass the flag CRYPTO_ALG_ALLOCATES_MEMORY down through the crypto API. Signed-off-by: Mikulas Patocka --- crypto/adiantum.c |2 +- crypto/authenc.c |7 --- crypto/authencesn.c |7

Re: [dm-devel] [PATCH 1/3 v2] crypto: introduce the flag CRYPTO_ALG_ALLOCATES_MEMORY

2020-06-30 Thread Mikulas Patocka
On Sun, 28 Jun 2020, Eric Biggers wrote: > On Sun, Jun 28, 2020 at 03:07:49PM -0400, Mikulas Patocka wrote: > > > > > Also, "seqiv" instances can be created without > > > CRYPTO_ALG_ALLOCATES_MEMORY set, > > > despite seqiv_aead_encrypt() allo

Re: [dm-devel] [PATCH 1/3 v2] crypto: introduce the flag CRYPTO_ALG_ALLOCATES_MEMORY

2020-06-30 Thread Mikulas Patocka
On Mon, 29 Jun 2020, Mikulas Patocka wrote: > On Sun, 28 Jun 2020, Eric Biggers wrote: > > > On Sun, Jun 28, 2020 at 03:07:49PM -0400, Mikulas Patocka wrote: > > > > > > > > cryptd_create_skcipher(), cryptd_create_hash(), cryptd_create_aead(), > > &

Re: [PATCH] dm writecache: reject asynchronous pmem.

2020-06-30 Thread Mikulas Patocka
On Tue, 30 Jun 2020, Michal Suchanek wrote: > The writecache driver does not handle asynchronous pmem. Reject it when > supplied as cache. > > Link: https://lore.kernel.org/linux-nvdimm/87lfk5hahc@linux.ibm.com/ > Fixes: 6e84200c0a29 ("virtio-pmem: Add virtio pmem driver") > > Signed-off-

Re: [dm-devel] [PATCH 1/3 v2] crypto: introduce the flag CRYPTO_ALG_ALLOCATES_MEMORY

2020-06-29 Thread Mikulas Patocka
On Sun, 28 Jun 2020, Eric Biggers wrote: > On Sun, Jun 28, 2020 at 03:07:49PM -0400, Mikulas Patocka wrote: > > > > > > cryptd_create_skcipher(), cryptd_create_hash(), cryptd_create_aead(), and > > > crypto_rfc4309_create() are also missing setting the mask. &

Re: [PATCH 0/6] Overhaul memalloc_no*

2020-06-29 Thread Mikulas Patocka
On Mon, 29 Jun 2020, Dave Chinner wrote: > On Sat, Jun 27, 2020 at 09:09:09AM -0400, Mikulas Patocka wrote: > > > > > > On Sat, 27 Jun 2020, Dave Chinner wrote: > > > > > On Fri, Jun 26, 2020 at 11:02:19AM -0400, Mikulas Patocka wrote: > >

Re: [dm-devel] [PATCH 1/3 v2] crypto: introduce the flag CRYPTO_ALG_ALLOCATES_MEMORY

2020-06-28 Thread Mikulas Patocka
On Fri, 26 Jun 2020, Eric Biggers wrote: > On Fri, Jun 26, 2020 at 09:46:17AM -0700, Eric Biggers wrote: > > On Fri, Jun 26, 2020 at 12:16:33PM -0400, Mikulas Patocka wrote: > > > +/* > > > + * Pass these flags down through the crypto API. > > > + */ >

[PATCH 1/3 v3] crypto: introduce the flag CRYPTO_ALG_ALLOCATES_MEMORY

2020-06-28 Thread Mikulas Patocka
GFP_KERNEL allocation can recurse into the block layer, causing a deadlock. Pass the flag CRYPTO_ALG_ALLOCATES_MEMORY down through the crypto API. Signed-off-by: Mikulas Patocka --- crypto/adiantum.c |2 +- crypto/authenc.c |4 ++-- crypto/authencesn.c |4

Re: [PATCH 1/3 v2] crypto: introduce the flag CRYPTO_ALG_ALLOCATES_MEMORY

2020-06-28 Thread Mikulas Patocka
On Fri, 26 Jun 2020, Eric Biggers wrote: > On Fri, Jun 26, 2020 at 12:16:33PM -0400, Mikulas Patocka wrote: > > +/* > > + * Pass these flags down through the crypto API. > > + */ > > +#define CRYPTO_ALG_INHERITED_FLAGS (CRYPTO_ALG_ASYNC | > > CRYPTO_ALG_ALLOC

Re: [PATCH 0/6] Overhaul memalloc_no*

2020-06-27 Thread Mikulas Patocka
On Sat, 27 Jun 2020, Dave Chinner wrote: > On Fri, Jun 26, 2020 at 11:02:19AM -0400, Mikulas Patocka wrote: > > Hi > > > > I suggest to join memalloc_noio and memalloc_nofs into just one flag that > > prevents both filesystem recursion and i/o recursion. >

[PATCH 1/3 v2] crypto: introduce the flag CRYPTO_ALG_ALLOCATES_MEMORY

2020-06-26 Thread Mikulas Patocka
GFP_KERNEL allocation can recurse into the block layer, causing a deadlock. Pass the flag CRYPTO_ALG_ALLOCATES_MEMORY down through the crypto API. Signed-off-by: Mikulas Patocka --- crypto/adiantum.c |3 ++- crypto/authenc.c |5 +++-- crypto/authencesn.c |5

Re: [PATCH 1/3] crypto: pass the flag CRYPTO_ALG_ALLOCATES_MEMORY

2020-06-26 Thread Mikulas Patocka
On Fri, 26 Jun 2020, Herbert Xu wrote: > On Wed, Jun 17, 2020 at 11:09:28AM -0400, Mikulas Patocka wrote: > > > > Index: linux-2.6/include/linux/crypto.h > > === > > --- linux-2.6.orig/include/linux

Re: [PATCH 0/6] Overhaul memalloc_no*

2020-06-26 Thread Mikulas Patocka
Hi I suggest to join memalloc_noio and memalloc_nofs into just one flag that prevents both filesystem recursion and i/o recursion. Note that any I/O can recurse into a filesystem via the loop device, thus it doesn't make much sense to have a context where PF_MEMALLOC_NOFS is set and PF_MEMALLO

Re: [RFC PATCH 0/1] dm-crypt excessive overhead

2020-06-20 Thread Mikulas Patocka
On Sat, 20 Jun 2020, Herbert Xu wrote: > On Fri, Jun 19, 2020 at 02:39:39PM -0400, Mikulas Patocka wrote: > > > > I'm looking at this and I'd like to know why does the crypto API fail in > > hard-irq context and why does it work in tasklet context. What'

Re: [RFC PATCH 0/1] dm-crypt excessive overhead

2020-06-19 Thread Mikulas Patocka
On Fri, 19 Jun 2020, Mike Snitzer wrote: > On Fri, Jun 19 2020 at 12:41pm -0400, > Ignat Korchagin wrote: > > > This is a follow up from the long-forgotten [1], but with some more > > convincing > > evidence. Consider the following script: > > > > [1]: https://www.spinics.net/lists/dm-crypt

[PATCH 3/3] dm-crypt: don't use drivers that have CRYPTO_ALG_ALLOCATES_MEMORY

2020-06-17 Thread Mikulas Patocka
Don't use crypto drivers that have the flag CRYPTO_ALG_ALLOCATES_MEMORY set. These drivers allocate memory and thus they are unsuitable for block I/O processing. Signed-off-by: Mikulas Patocka --- drivers/md/dm-crypt.c | 17 +++-- 1 file changed, 11 insertions(+), 6 dele

[PATCH 2/3] crypto: set the flag CRYPTO_ALG_ALLOCATES_MEMORY

2020-06-17 Thread Mikulas Patocka
drivers/crypto/xilinx/zynqmp-aes-gcm.c: zynqmp_aes_aead_cipher Signed-off-by: Mikulas Patocka --- drivers/crypto/allwinner/sun8i-ce/sun8i-ce-core.c |8 +- drivers/crypto/allwinner/sun8i-ss/sun8i-ss-core.c |8 +- drivers/crypto/amlogic/amlogic-gxl-core.c |4 - drivers/crypto/axis

[PATCH 1/3] crypto: pass the flag CRYPTO_ALG_ALLOCATES_MEMORY

2020-06-17 Thread Mikulas Patocka
GFP_KERNEL allocation can recurse into the block layer, causing a deadlock. Signed-off-by: Mikulas Patocka --- crypto/adiantum.c |3 ++- crypto/authenc.c |5 +++-- crypto/authencesn.c |5 +++-- crypto/ccm.c |7 --- crypto/chacha20poly1305.c

Re: [dm-devel] [PATCH 1/4] crypto: introduce CRYPTO_ALG_ALLOCATES_MEMORY

2020-06-17 Thread Mikulas Patocka
I'm resending the patches with your comments resolved... Mikulas On Tue, 16 Jun 2020, Eric Biggers wrote: > On Tue, Jun 16, 2020 at 11:01:31AM -0400, Mikulas Patocka wrote: > > Introduce a new flag CRYPTO_ALG_ALLOCATES_MEMORY and modify dm-crypt, so > > that it uses only

[PATCH 2/2] hisilicon-crypto: don't sleep of CRYPTO_TFM_REQ_MAY_SLEEP was not specified

2020-06-17 Thread Mikulas Patocka
There is this call chain: sec_alg_skcipher_encrypt -> sec_alg_skcipher_crypto -> sec_alg_alloc_and_calc_split_sizes -> kcalloc where we call sleeping allocator function even if CRYPTO_TFM_REQ_MAY_SLEEP was not specified. Signed-off-by: Mikulas Patocka Cc: sta...@vger.kernel.org

[PATCH 1/2] cpt-crypto: don't sleep of CRYPTO_TFM_REQ_MAY_SLEEP was not specified

2020-06-17 Thread Mikulas Patocka
There is this call chain: cvm_encrypt -> cvm_enc_dec -> cptvf_do_request -> process_request -> kzalloc where we call sleeping allocator function even if CRYPTO_TFM_REQ_MAY_SLEEP was not specified. Signed-off-by: Mikulas Patocka Cc: sta...@vger.kernel.org # v4.11+ Fixes:

Re: [dm-devel] [PATCH 4/4] crypto: fix the drivers that don't respect CRYPTO_TFM_REQ_MAY_SLEEP

2020-06-17 Thread Mikulas Patocka
On Tue, 16 Jun 2020, Eric Biggers wrote: > On Tue, Jun 16, 2020 at 02:18:17PM -0400, Mikulas Patocka wrote: > > > > > > On Tue, 16 Jun 2020, Eric Biggers wrote: > > > > > On Tue, Jun 16, 2020 at 11:02:50AM -0400, Mikulas Patocka wrote: > > >

Re: [dm-devel] [PATCH 4/4] crypto: fix the drivers that don't respect CRYPTO_TFM_REQ_MAY_SLEEP

2020-06-16 Thread Mikulas Patocka
On Tue, 16 Jun 2020, Eric Biggers wrote: > On Tue, Jun 16, 2020 at 11:02:50AM -0400, Mikulas Patocka wrote: > > Fix the crypto drivers that don't respect CRYPTO_TFM_REQ_MAY_SLEEP. If > > CRYPTO_TFM_REQ_MAY_SLEEP is not set, the driver must not do allocation > > that s

[PATCH 4/4] crypto: fix the drivers that don't respect CRYPTO_TFM_REQ_MAY_SLEEP

2020-06-16 Thread Mikulas Patocka
Fix the crypto drivers that don't respect CRYPTO_TFM_REQ_MAY_SLEEP. If CRYPTO_TFM_REQ_MAY_SLEEP is not set, the driver must not do allocation that sleeps. Signed-off-by: Mikulas Patocka --- drivers/crypto/amlogic/amlogic-gxl-cipher.c |5 ++- drivers/crypto/cavium/cpt/cptvf_a

[PATCH 3/4] crypto: set the flag CRYPTO_ALG_ALLOCATES_MEMORY

2020-06-16 Thread Mikulas Patocka
Set the flag CRYPTO_ALG_ALLOCATES_MEMORY in the crypto drivers that allocate memory. Signed-off-by: Mikulas Patocka --- drivers/crypto/allwinner/sun8i-ce/sun8i-ce-core.c |8 +- drivers/crypto/allwinner/sun8i-ss/sun8i-ss-core.c |8 +- drivers/crypto/amlogic/amlogic-gxl-core.c

[PATCH 1/4] crypto: introduce CRYPTO_ALG_ALLOCATES_MEMORY

2020-06-16 Thread Mikulas Patocka
anytime (causing random I/O errors) and GFP_KERNEL allocation can recurse into the block layer, causing a deadlock. Signed-off-by: Mikulas Patocka Index: linux-2.6/include/linux/crypto.h === --- linux-2.6.orig/include/linux/crypto.h

[PATCH 2/4] crypto: pass the flag CRYPTO_ALG_ALLOCATES_MEMORY

2020-06-16 Thread Mikulas Patocka
Pass the flag CRYPTO_ALG_ALLOCATES_MEMORY down through the crypto API. Signed-off-by: Mikulas Patocka --- crypto/adiantum.c |3 ++- crypto/authenc.c |5 +++-- crypto/authencesn.c |5 +++-- crypto/ccm.c |7 --- crypto/chacha20poly1305.c

Re: crypto API and GFP_ATOMIC

2020-06-16 Thread Mikulas Patocka
On Wed, 10 Jun 2020, Herbert Xu wrote: > On Wed, Jun 10, 2020 at 08:02:23AM -0400, Mikulas Patocka wrote: > > > > Yes, fixing the drivers would be the best - but you can hardly find any > > person who has all the crypto hardware and who is willing to rewrite all &

Re: [PATCH] dm writecache: skip writecache_wait when using pmem mode

2020-06-13 Thread Mikulas Patocka
On Fri, 12 Jun 2020, Huaisheng Ye wrote: > From: Huaisheng Ye > > The array bio_in_progress is only used with ssd mode. So skip > writecache_wait_for_ios in writecache_discard when pmem mode. > > Signed-off-by: Huaisheng Ye Acked-by: Mikulas Patocka > --- > dr

Re: [PATCH] dm writecache: correct uncommitted_block when discarding uncommitted entry

2020-06-13 Thread Mikulas Patocka
On Fri, 12 Jun 2020, Huaisheng Ye wrote: > From: Huaisheng Ye > > When uncommitted entry has been discarded, correct wc->uncommitted_block > for getting the exact number. > > Signed-off-by: Huaisheng Ye Acked-by: Mikulas Patocka Also, add: Cc: sta...@vger.kernel.org

Re: crypto API and GFP_ATOMIC

2020-06-10 Thread Mikulas Patocka
On Wed, 10 Jun 2020, Herbert Xu wrote: > On Tue, Jun 09, 2020 at 01:11:05PM -0400, Mikulas Patocka wrote: > > > > Do you have another idea how to solve this problem? > > I think the better approach would be to modify the drivers to not > allocate any memory. In gener

crypto API and GFP_ATOMIC

2020-06-09 Thread Mikulas Patocka
Hi I've found out that a lot of hardware crypto drivers use GFP_ATOMIC. Some of them switch between GFP_ATOMIC and GFP_KERNEL based on the flag CRYPTO_TFM_REQ_MAY_SLEEP. dm-crypt and dm-integrity don't use CRYPTO_TFM_REQ_MAY_SLEEP (because GFP_KERNEL allocation requests can recurse back to the

Re: [PATCH] dm writecache: reinitialize lru in writeback instead of endio

2020-06-01 Thread Mikulas Patocka
On Sat, 30 May 2020, Huaisheng Ye wrote: > From: Huaisheng Ye > > When wc_entry has been removed from wbl->list in writeback, it will > be not used again except waiting to be set free in writecache_free_entry. > > That is a little of annoying, it has to reinitialize lru of wc_entry > in endi

Re: [PATCH] tty:vt: Add check the return value of kzalloc to avoid oops

2019-09-19 Thread Mikulas Patocka
On Thu, 19 Sep 2019, Greg KH wrote: > On Thu, Sep 19, 2019 at 05:18:15PM +0800, Xiaoming Ni wrote: > > Using kzalloc() to allocate memory in function con_init(), but not > > checking the return value, there is a risk of null pointer references > > oops. > > > > Signed-off-by: Xiaoming Ni > >

RE: [External] Re: [PATCH] dm writecache: skip writecache_wait for pmem mode

2019-09-04 Thread Mikulas Patocka
On Wed, 4 Sep 2019, Huaisheng HS1 Ye wrote: > > -Original Message- > > From: Mikulas Patocka > > Sent: Wednesday, September 4, 2019 4:49 PM > > On Mon, 2 Sep 2019, Huaisheng Ye wrote: > > > > > From: Huaisheng Ye > > > > >

[PATCH 2/2] dm: make dm_table_find_target return NULL

2019-08-23 Thread Mikulas Patocka
dm_table_find_target returns NULL and its callers test the returned value for NULL. The macro dm_target_is_valid is deleted. In alloc_targets, we no longer allocate an extra zeroed target. Signed-off-by: Mikulas Patocka --- drivers/md/dm-ioctl.c |2 +- drivers/md/dm-table.c |8

[PATCH 1/2] dm table: fix invalid memory accesses with too high sector number

2019-08-23 Thread Mikulas Patocka
. This patch fixes the bug by testing the sector number at the beginning of dm_table_find_target. We add an "inline" keyword to the function dm_table_get_size because this is hot path. Signed-off-by: Mikulas Patocka Reported-by: Zhang Tao Fixes: 512875bd9661 ("dm: table detect i

Re: [dm-devel] [PATCH] dm table: fix a potential array out of bounds

2019-08-23 Thread Mikulas Patocka
Hi I tested it and the bug is real - with some table sizes, dm_table_find_target will access memory out of bounds if the sector argument is beyond limit. Your patch fixes some of these cases, but not all of them. I used this script to test all possible table sizes: #!/bin/bash -e sync dmsetup

Re: [PATCH v3 0/5] Optimize writecache when using pmem as cache

2019-02-04 Thread Mikulas Patocka
On Thu, 31 Jan 2019, Huaisheng Ye wrote: > From: Huaisheng Ye > > This patch set could be used for dm-writecache when use persistent > memory as cache data device. > > Patch 1 and 2 go towards removing unused parameter and codes which > actually doesn't really work. I agree that there is so

Re: Sleeping from invalid context in udlfb

2018-12-31 Thread Mikulas Patocka
On Thu, 2 Aug 2018, David Airlie wrote: > > I'm pretty sure udlkms handles this already. > > Dave. But it crashes on unplug :-) Mikulas > On Wed, Aug 1, 2018 at 11:34 PM, Mikulas Patocka wrote: > > > On Wed, 1 Aug 2018, Geert Uytterhoeven w

Re: [LKP] d50d82faa0 [ 33.671845] WARNING: possible circular locking dependency detected

2018-11-12 Thread Mikulas Patocka
robot got the below dmesg and the first bad commit is > > > > > > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master > > > > > > commit d50d82faa0c964e31f7a946ba8aba7c715ca7ab0 > > > Author: Mikulas Patocka > > > AuthorDate:

[PATCH] vt: fix broken display when running aptitude

2018-10-23 Thread Mikulas Patocka
If you run aptitude on framebuffer console, the display is corrupted. The corruption is caused by the commit d8ae7242. The patch adds "offset" to "start" when calling scr_memsetw, but it forgets to do the same addition on a subsequent call to do_update_region. Signed-off

Re: [PATCHv5 0/7] tty: Hold write ldisc sem in tty_reopen()

2018-09-20 Thread Mikulas Patocka
On Wed, 19 Sep 2018, Dmitry Safonov wrote: > On Wed, 2018-09-19 at 16:03 -0400, Mikulas Patocka wrote: > > > > On Wed, 19 Sep 2018, Dmitry Safonov wrote: > > > Thanks much for the testing, Mikulas. > > > Could you try to bisect which of the patches causes

Re: [PATCHv5 0/7] tty: Hold write ldisc sem in tty_reopen()

2018-09-19 Thread Mikulas Patocka
On Wed, 19 Sep 2018, Dmitry Safonov wrote: > On Wed, 2018-09-19 at 13:35 -0400, Mikulas Patocka wrote: > > > > On Wed, 19 Sep 2018, Mikulas Patocka wrote: > > > > > > > > > > > On Tue, 18 Sep 2018, Dmitry Safonov wrote: > > > > &

Re: [PATCHv5 0/7] tty: Hold write ldisc sem in tty_reopen()

2018-09-19 Thread Mikulas Patocka
On Wed, 19 Sep 2018, Mikulas Patocka wrote: > > > On Tue, 18 Sep 2018, Dmitry Safonov wrote: > > > Hi all, > > > > Three fixes that worth to have in the @stable, as they were hit by > > different people, including Arista on v4.9 stable. > > >

Re: [PATCHv5 0/7] tty: Hold write ldisc sem in tty_reopen()

2018-09-19 Thread Mikulas Patocka
I confirm that this patch series fixes the crash for me. Tested-by: Mikulas Patocka > Changes since v4: > - back to lock ldisc with (5*HZ) timeout in tty_reopen() > (LKP report link: lkml.kernel.org/r/<1536940609.3185.29.ca...@arista.com>) > - reordered 3/7 with 2/7 f

  1   2   3   4   5   6   7   8   9   >