All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dave.Martin@arm.com (Dave Martin)
To: linux-arm-kernel@lists.infradead.org
Subject: [RFC PATCH v2 0/2] Simplify kernel-mode NEON
Date: Wed, 24 May 2017 16:54:32 +0100	[thread overview]
Message-ID: <20170524155431.GN3559@e103592.cambridge.arm.com> (raw)
In-Reply-To: <CAKv+Gu-QoRkJysYpnzw-=fmEkuajDcFY77T28CLE0JjwogQWnA@mail.gmail.com>

On Wed, May 24, 2017 at 08:29:06AM -0700, Ard Biesheuvel wrote:
> On 24 May 2017 at 07:42, Dave Martin <Dave.Martin@arm.com> wrote:
> > This series aims to simplify kernel-mode NEON.
> >
> > The main motivation for these changes is that supporting kernel-mode
> > NEON alongside SVE is tricky with the current framework: the current
> > partial save/restore mechanisms would need additional porting to
> > save/restore the extended SVE vector bits, and this renders the cost
> > saving of partial save/restore rather doubtful -- even if not all vector
> > registers are saved, the save/restore cost will still grow with
> > increasing vector length.  We could get the mechanics of this to work in
> > principle, but it doesn't feel like the right thing to do.
> >
> > If we withdraw kernel-mode NEON support for hardirq context, accept some
> > extra softirq latency and disable nesting, then we can simplify the code
> > by always saving the task context directly into task_struct and
> > deferring all restore to ret_to_user.  Previous discussions with Ard
> > Biesheuvel suggest that this is a feasible approach and reasonably
> > aligned with other architectures.
> >
> > The main impact on client code is that callers must check that
> > kernel-mode NEON is usable in the current context and fall back to a
> > non-NEON when necessary.  Ard has already done some work on this. [1]
> >
> > The interesting changes are all in patch 2: the first patch just adds a
> > header inclusion guard that I noted was missing.
> >
> > [1] git://git.kernel.org/pub/scm/linux/kernel/git/ardb/linux.git kernel-mode-neon
> >
> >
> > I've only build-tested so far.
> >
> > Ard, do you have any suggestions for how to test these changes
> > effectively?
> >
> 
> IIRC, a zd1211 based USB wifi stick will use the mac80211 crypto

Do you have one of those?

> routines that execute in softirq context (and I am sure there are
> others). If you run a VPN over that, and only enable a single CPU, I
> would expect most code paths to get exercised when pushing a lot of
> data over that. In userland, you can run something like 'openssl speed
> -evp aes-128-ctr' in a loop to exercise the userland part, although it
> would be better to check the correctness as well (which 'speed' will
> not do for you)

Another approach would be to hack up a softirq irritator that just does

	kernel_neon_begin()

	/* write garbage to FPSIMD regs */

	kernel_neon_end()

alongside some userspace test that will spot corruption.


Writing softirq handlers seems to be a bit of a black art though...
I was wondering whether it would make sense to hack something into
the timer softirq code, but I'm not well clued-up on how that stuff
works.

[...]

Cheers
---Dave

  reply	other threads:[~2017-05-24 15:54 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-24 14:42 [RFC PATCH v2 0/2] Simplify kernel-mode NEON Dave Martin
2017-05-24 14:42 ` [RFC PATCH v2 1/2] arm64: neon: Add missing header guard in <asm/neon.h> Dave Martin
2017-05-24 14:42 ` [RFC PATCH v2 2/2] arm64: neon: Remove support for nested or hardirq kernel-mode NEON Dave Martin
2017-05-24 15:22   ` Ard Biesheuvel
2017-05-24 15:35     ` Dave Martin
2017-05-24 15:42       ` Ard Biesheuvel
2017-05-24 15:29 ` [RFC PATCH v2 0/2] Simplify " Ard Biesheuvel
2017-05-24 15:54   ` Dave Martin [this message]
2017-05-24 16:07     ` Ard Biesheuvel

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=20170524155431.GN3559@e103592.cambridge.arm.com \
    --to=dave.martin@arm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /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.