From: Dave Martin <Dave.Martin@arm.com>
To: Catalin Marinas <catalin.marinas@arm.com>
Cc: 'Mark Rutland' <mark.rutland@arm.com>,
'Bhupesh Sharma' <bhsharma@redhat.com>,
'Julien Grall' <julien.grall@arm.com>,
'Vincenzo Frascino' <vincenzo.frascino@arm.com>,
'Will Deacon' <will@kernel.org>,
yhwan.joo@samsung.com, 'Anisse Astier' <aastier@freebox.fr>,
'Marc Zyngier' <maz@kernel.org>,
'Allison Randal' <allison@lohutok.net>,
'Sanghoon Lee' <shoon114.lee@samsung.com>,
jihun.kim@samsung.com, 'Kees Cook' <keescook@chromium.org>,
'Suzuki K Poulose' <suzuki.poulose@arm.com>,
'Wooki Min' <wooki.min@samsung.com>,
'Kristina Martsenko' <kristina.martsenko@arm.com>,
'Jeongtae Park' <jtp.park@samsung.com>,
Wooyeon Kim <wooy88.kim@samsung.com>,
'Thomas Gleixner' <tglx@linutronix.de>,
linux-arm-kernel@lists.infradead.org,
'Steve Capper' <steve.capper@arm.com>,
'Greg Kroah-Hartman' <gregkh@linuxfoundation.org>,
linux-kernel@vger.kernel.org, 'James Morse' <james.morse@arm.com>,
'Sudeep Holla' <sudeep.holla@arm.com>,
dh.han@samsung.com
Subject: Re: [PATCH] arm64: fpsimd: Added API to manage fpsimd state inside kernel
Date: Mon, 15 Jun 2020 11:30:27 +0100 [thread overview]
Message-ID: <20200615103024.GI25945@arm.com> (raw)
In-Reply-To: <20200611141101.GA31408@gaia>
On Thu, Jun 11, 2020 at 03:11:02PM +0100, Catalin Marinas wrote:
> On Thu, Jun 11, 2020 at 06:42:12PM +0900, Wooyeon Kim wrote:
> > I am in charge of camera driver development in Samsung S.LSI division.
> >
> > In order to guarantee real time processing such as Camera 3A algorithm in
> > current or ongoing projects, prebuilt binary is loaded and used in kernel
> > space, rather than user space.
>
> Thanks for the additional details.
I have to ask: there are other camera drivers in existence already.
What makes your hardware so different that it requires all this data
processing to be done inside the kernel?
> If you do such intensive processing in an IRQ context you'd probably
> introduce additional IRQ latency. Wouldn't offloading such work to a
> real-time (user) thread help? In a non-preempt-rt kernel, I don't think
> you can get much in terms of (soft) guarantees for IRQ latency anyway.
>
> > Because the binary is built with other standard library which could use
> > FPSIMD register, kernel API should keep the original FPSIMD state for other
> > user tasks.
>
> Can you not recompile those libraries not to use FP?
>
> As Mark said, for a kernel API we require at least an in-kernel,
> upstreamed, user of that functionality.
>
> > In the case of the kernel_neon_begin / kernel_neon_end that you mentioned,
> > there is a limitation that cannot be used in hardirq context.
> > Also, if another kernel task switching occurs while kernel API is being
> > used, fpsimd register corruption may occur.
>
> kernel_neon_begin/end disable preemption, so you can't have a task
> switch (you can have interrupts though but we don't allow FPSIMD in IRQ
> context).
Note, the decision not to support kernel_neon_begin / kernel_neon_end in
hardirq context was deliberate. hardirq handlers shouldn't usually do
anything at all except ensure that something responds to the hardware
event, by waking some other thread or scheduling a workqueue item for
example. An IRQ handler that only does that has no need to do any data
processing, and gains no advantage from using FPSIMD.
Doing additional work in hardirq context will harm interrupt latency for
the rest of the system.
So, you should move the data processing work out of the hardirq handler.
Is there a reason why this is not possible?
Secondly, there is the question of whether FPSIMD can be used by kernel
threads. Currently this is only supported in a limited way. Again,
this a deliberate decision, for now.
Can you split the processing work into small blocks using
kernel_neon_begin/kernel_neon_end, similarly to the arm64 crypto
drivers?
This is the current accepted way of doing number crunching inside the
kernel without harming preemption latency too much. Even so, it's
primarily intended for things that affect critical paths inside the
kernel, such as crypto or checksumming in the filesysem and network
subsystems.
Cheers
---Dave
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
prev parent reply other threads:[~2020-06-15 10:30 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20200605073214epcas2p1576f3f90dbcefaad6180f2559ca5980d@epcas2p1.samsung.com>
2020-06-05 7:30 ` [PATCH] arm64: fpsimd: Added API to manage fpsimd state inside kernel Wooyeon Kim
2020-06-05 10:37 ` Mark Rutland
2020-06-08 10:34 ` Dave Martin
2020-06-11 9:17 ` ???
2020-06-11 12:47 ` Mark Rutland
2020-06-11 9:42 ` Wooyeon Kim
2020-06-11 14:11 ` Catalin Marinas
2020-06-15 10:30 ` Dave Martin [this message]
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=20200615103024.GI25945@arm.com \
--to=dave.martin@arm.com \
--cc=aastier@freebox.fr \
--cc=allison@lohutok.net \
--cc=bhsharma@redhat.com \
--cc=catalin.marinas@arm.com \
--cc=dh.han@samsung.com \
--cc=gregkh@linuxfoundation.org \
--cc=james.morse@arm.com \
--cc=jihun.kim@samsung.com \
--cc=jtp.park@samsung.com \
--cc=julien.grall@arm.com \
--cc=keescook@chromium.org \
--cc=kristina.martsenko@arm.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=maz@kernel.org \
--cc=shoon114.lee@samsung.com \
--cc=steve.capper@arm.com \
--cc=sudeep.holla@arm.com \
--cc=suzuki.poulose@arm.com \
--cc=tglx@linutronix.de \
--cc=vincenzo.frascino@arm.com \
--cc=will@kernel.org \
--cc=wooki.min@samsung.com \
--cc=wooy88.kim@samsung.com \
--cc=yhwan.joo@samsung.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).