Re: [PATCH] crypto: lib/chacha20poly1305 - Set SG_MITER_ATOMIC unconditionally

2020-09-15 Thread Thomas Gleixner
On Tue, Sep 15 2020 at 20:10, Herbert Xu wrote: > On Tue, Sep 15, 2020 at 01:08:31PM +0300, Ard Biesheuvel wrote: >> >> But making atomic kmap preemptible/sleepable creates the exact same >> problem, i.e., that we have no idea which existing callers are >> currently relying on those preemption

Re: [PATCH] crypto: lib/chacha20poly1305 - Set SG_MITER_ATOMIC unconditionally

2020-09-15 Thread Herbert Xu
On Tue, Sep 15, 2020 at 01:08:31PM +0300, Ard Biesheuvel wrote: > > But making atomic kmap preemptible/sleepable creates the exact same > problem, i.e., that we have no idea which existing callers are > currently relying on those preemption disabling semantics, so we can't > just take them away.

Re: [PATCH] crypto: lib/chacha20poly1305 - Set SG_MITER_ATOMIC unconditionally

2020-09-15 Thread Ard Biesheuvel
On Tue, 15 Sep 2020 at 13:05, Herbert Xu wrote: > > On Tue, Sep 15, 2020 at 01:02:10PM +0300, Ard Biesheuvel wrote: > > > > > I'd rather go for a preemptible/sleepable version of highmem mapping > > > which is in itself consistent for both highmen and not highmem. > > > > I don't think we need to

Re: [PATCH] crypto: lib/chacha20poly1305 - Set SG_MITER_ATOMIC unconditionally

2020-09-15 Thread Herbert Xu
On Tue, Sep 15, 2020 at 01:02:10PM +0300, Ard Biesheuvel wrote: > > > I'd rather go for a preemptible/sleepable version of highmem mapping > > which is in itself consistent for both highmen and not highmem. > > I don't think we need to obsess about highmem, although we should > obviously take

Re: [PATCH] crypto: lib/chacha20poly1305 - Set SG_MITER_ATOMIC unconditionally

2020-09-15 Thread Ard Biesheuvel
On Tue, 15 Sep 2020 at 12:34, Thomas Gleixner wrote: > > On Tue, Sep 15 2020 at 17:05, Herbert Xu wrote: > > On Mon, Sep 14, 2020 at 11:55:53PM -0700, Linus Torvalds wrote: > >> > >> Maybe we could hide it behind a debug option, at least. > >> > >> Or, alterantively, introduce a new

Re: [PATCH] crypto: lib/chacha20poly1305 - Set SG_MITER_ATOMIC unconditionally

2020-09-15 Thread Thomas Gleixner
On Tue, Sep 15 2020 at 17:05, Herbert Xu wrote: > On Mon, Sep 14, 2020 at 11:55:53PM -0700, Linus Torvalds wrote: >> >> Maybe we could hide it behind a debug option, at least. >> >> Or, alterantively, introduce a new "debug_preempt_count" that doesn't >> actually disable preemption, but warns

Re: [PATCH] crypto: lib/chacha20poly1305 - Set SG_MITER_ATOMIC unconditionally

2020-09-15 Thread Ard Biesheuvel
On Tue, 15 Sep 2020 at 10:05, Herbert Xu wrote: > > On Mon, Sep 14, 2020 at 11:55:53PM -0700, Linus Torvalds wrote: > > > > Maybe we could hide it behind a debug option, at least. > > > > Or, alterantively, introduce a new "debug_preempt_count" that doesn't > > actually disable preemption, but

Re: [PATCH] crypto: lib/chacha20poly1305 - Set SG_MITER_ATOMIC unconditionally

2020-09-15 Thread Ard Biesheuvel
On Tue, 15 Sep 2020 at 09:56, Linus Torvalds wrote: > > On Mon, Sep 14, 2020 at 11:45 PM Linus Torvalds > wrote: > > > > I mean, I did find one case that didn't set it (cb710-mmc.c), but > > pattern-matching to the other mmc cases, that one looks like it > > _should_ have set the atomic flag

Re: [PATCH] crypto: lib/chacha20poly1305 - Set SG_MITER_ATOMIC unconditionally

2020-09-15 Thread Herbert Xu
On Mon, Sep 14, 2020 at 11:55:53PM -0700, Linus Torvalds wrote: > > Maybe we could hide it behind a debug option, at least. > > Or, alterantively, introduce a new "debug_preempt_count" that doesn't > actually disable preemption, but warns about actual sleeping > operations.. I'm more worried

Re: [PATCH] crypto: lib/chacha20poly1305 - Set SG_MITER_ATOMIC unconditionally

2020-09-15 Thread Linus Torvalds
On Mon, Sep 14, 2020 at 11:45 PM Linus Torvalds wrote: > > I mean, I did find one case that didn't set it (cb710-mmc.c), but > pattern-matching to the other mmc cases, that one looks like it > _should_ have set the atomic flag like everybody else did. Oh, and immediately after sending that out I

Re: [PATCH] crypto: lib/chacha20poly1305 - Set SG_MITER_ATOMIC unconditionally

2020-09-15 Thread Linus Torvalds
On Mon, Sep 14, 2020 at 8:30 PM Herbert Xu wrote: > > There is no reason for the chacha20poly1305 SG miter code to use > kmap instead of kmap_atomic as the critical section doesn't sleep > anyway. So we can simply get rid of the preemptible check and > set SG_MITER_ATOMIC unconditionally. So

Re: [PATCH] crypto: lib/chacha20poly1305 - Set SG_MITER_ATOMIC unconditionally

2020-09-15 Thread Herbert Xu
On Tue, Sep 15, 2020 at 09:03:46AM +0300, Ard Biesheuvel wrote: > > The problem is really that kmap_atomic() is not simply a no-op on > !HIGHMEM architectures. If we can fix that, I have no objections to > this patch. Yes we should definitely fix that. However, doing so will involve manually

Re: [PATCH] crypto: lib/chacha20poly1305 - Set SG_MITER_ATOMIC unconditionally

2020-09-15 Thread Ard Biesheuvel
(+ Jason) On Tue, 15 Sep 2020 at 06:30, Herbert Xu wrote: > > I trimmed the cc as the mailing lists appear to be blocking this > email because of it. > > On Mon, Sep 14, 2020 at 03:37:49PM -0700, Linus Torvalds wrote: > > > > So it _looks_ like this code started using kmap() - probably back when

[PATCH] crypto: lib/chacha20poly1305 - Set SG_MITER_ATOMIC unconditionally

2020-09-14 Thread Herbert Xu
I trimmed the cc as the mailing lists appear to be blocking this email because of it. On Mon, Sep 14, 2020 at 03:37:49PM -0700, Linus Torvalds wrote: > > So it _looks_ like this code started using kmap() - probably back when > kmap_atomic() was so cumbersome to use - and was then converted >