linux/drivers/platform/chrome
Douglas Anderson 7dadf88f8d platform/chrome: cros_ec_spi: Move to real time priority for transfers
In commit 37a186225a ("platform/chrome: cros_ec_spi: Transfer
messages at high priority") we moved transfers to a high priority
workqueue.  This helped make them much more reliable.

...but, we still saw failures.

We were actually finding ourselves competing for time with dm-crypt
which also scheduled work on HIGHPRI workqueues.  While we can
consider reverting the change that made dm-crypt run its work at
HIGHPRI, the argument in commit a1b89132dc ("dm crypt: use
WQ_HIGHPRI for the IO and crypt workqueues") is somewhat compelling.
It does make sense for IO to be scheduled at a priority that's higher
than the default user priority.  It also turns out that dm-crypt isn't
alone in using high priority like this.  loop_prepare_queue() does
something similar for loopback devices.

Looking in more detail, it can be seen that the high priority
workqueue isn't actually that high of a priority.  It runs at MIN_NICE
which is _fairly_ high priority but still below all real time
priority.

Should we move cros_ec_spi to real time priority to fix our problems,
or is this just escalating a priority war?  I'll argue here that
cros_ec_spi _does_ belong at real time priority.  Specifically
cros_ec_spi actually needs to run quickly for correctness.  As I
understand this is exactly what real time priority is for.

There currently doesn't appear to be any way to use the standard
workqueue APIs with a real time priority, so we'll switch over to
using using a kthread worker.  We'll match the priority that the SPI
core uses when it wants to do things on a realtime thread and just use
"MAX_RT_PRIO - 1".

This commit plus the patch ("platform/chrome: cros_ec_spi: Request the
SPI thread be realtime") are enough to get communications very close
to 100% reliable (the only known problem left is when serial console
is turned on, which isn't something that happens in shipping devices).
Specifically this test case now passes (tested on rk3288-veyron-jerry):

  dd if=/dev/zero of=/var/log/foo.txt bs=4M count=512&
  while true; do
    ectool version > /dev/null;
  done

It should be noted that "/var/log" is encrypted (and goes through
dm-crypt) and also passes through a loopback device.

Signed-off-by: Douglas Anderson <dianders@chromium.org>
Reviewed-by: Guenter Roeck <groeck@chromium.org>
Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
2019-05-20 23:45:24 +02:00
..
wilco_ec platform/chrome: wilco_ec: Remove 256 byte transfers 2019-05-20 10:18:10 +02:00
chromeos_laptop.c platform/chrome: chromeos_laptop: use pci_dev_id() helper 2019-04-29 16:13:06 -05:00
chromeos_pstore.c platform/chrome: cromeos_pstore: switch to SPDX identifier 2019-02-01 10:13:05 +01:00
chromeos_tbmc.c platform/chrome: chromeos_tbmc - Remove unneeded const 2018-10-09 22:40:12 -07:00
cros_ec_debugfs.c chrome platform changes for v5.2 2019-05-12 07:00:21 -04:00
cros_ec_i2c.c platform/chrome: cros_ec_i2c: switch to SPDX identifier 2019-02-01 10:13:06 +01:00
cros_ec_ishtp.c platform/chrome: Add ChromeOS EC ISHTP driver 2019-05-20 10:18:10 +02:00
cros_ec_lightbar.c platform/chrome: cros_ec_lightbar: remove pr_fmt() define 2019-02-01 10:13:06 +01:00
cros_ec_lpc_mec.c platform/chrome: cros_ec: Remove cros_ec dependency in lpc_mec 2019-02-11 10:07:40 +01:00
cros_ec_lpc_mec.h platform/chrome: cros_ec: Remove cros_ec dependency in lpc_mec 2019-02-11 10:07:40 +01:00
cros_ec_lpc_reg.c platform/chrome: cros_ec: Remove cros_ec dependency in lpc_mec 2019-02-11 10:07:40 +01:00
cros_ec_lpc_reg.h platform/chrome: cros_ec_lpc: switch to SPDX identifier 2019-02-01 10:13:06 +01:00
cros_ec_lpc.c platform/chrome: cros_ec_lpc: switch to SPDX identifier 2019-02-01 10:13:06 +01:00
cros_ec_proto.c - Core Frameworks 2019-05-14 10:39:08 -07:00
cros_ec_rpmsg.c platform/chrome: cros_ec: Add EC host command support using rpmsg 2019-04-16 11:00:36 +02:00
cros_ec_spi.c platform/chrome: cros_ec_spi: Move to real time priority for transfers 2019-05-20 23:45:24 +02:00
cros_ec_sysfs.c platform/chrome: cros_ec_sysfs: remove pr_fmt() define 2019-02-01 10:13:06 +01:00
cros_ec_trace.c platform/chrome: cros_ec_proto: Add trace event to trace EC commands 2019-04-17 10:29:34 +02:00
cros_ec_trace.h platform/chrome: cros_ec_proto: Add trace event to trace EC commands 2019-04-17 10:29:34 +02:00
cros_ec_vbc.c platform/chrome: cros_ec_vbc: switch to SPDX identifier 2019-02-01 10:13:06 +01:00
cros_kbd_led_backlight.c platform/chrome: cros_kbd_led_backlight: switch to SPDX identifier 2019-02-01 10:13:06 +01:00
cros_usbpd_logger.c platform/chrome: Add CrOS USB PD logging driver 2019-04-15 12:13:24 +02:00
Kconfig platform/chrome: Add ChromeOS EC ISHTP driver 2019-05-20 10:18:10 +02:00
Makefile platform/chrome: Add ChromeOS EC ISHTP driver 2019-05-20 10:18:10 +02:00