diff options
author | Will McVicker <willmcvicker@google.com> | 2022-05-26 16:16:42 -0700 |
---|---|---|
committer | Will McVicker <willmcvicker@google.com> | 2022-05-26 16:16:51 -0700 |
commit | 28826da1deae49f5a942bb7b4621944360933440 (patch) | |
tree | 8e8c22cd1b4430df6bc1267d8fae32eacce14207 | |
parent | 6305b885670758d16631983d435b984081a0d38d (diff) | |
parent | 15a58e835d369a387d89dbbf07b779c1f8b844f0 (diff) | |
download | trusty-28826da1deae49f5a942bb7b4621944360933440.tar.gz |
Merge 'partner/android-gs-pixel-mainline' into 'partner/android13-gs-pixel-5.15'
We are merging from android-gs-pixel-mainline since this branch has
already taken the android13-gs-pixel-5.10 merge. This is a one time
merge to get the 5.15 branch up-to-date.
* 'android-gs-pixel-mainline' of sso://partner-android/kernel/private/google-modules/soc/gs:
kleaf: Add kleaf tests for kernel_images
kleaf: Move SLIDER_DTBOS to a global variable.
kleaf: build abi for slider
vendor_hook: sched: Add control for reduce_prefer_idle
usb: dwc3: cancel gadget retry during device reboot
arm64/dts: devfreq: add boot_info
google/debug: ehld: handle hrtimers correctly in CPUHP and CPUPM
Revert "google/debug: ehld: stop and restart hrtimer at CPU PM"
google/debug: ehld: fix exynos_ehld_stop_cpu()
devfreq: add sysfs node "cancel_boot_freq"
aoc/alsa: dts: change the name for immersive playback
aoc/alsa: dt-bindings: change the name for immersive playback
arm64/dts: Add board_id and board_rev to aoc
pcie: exynos: Skip PHY isloation on hot reset test
Revert "vendor_hook: sched: Implement vendor group util"
Revert "vendor_hook: sched: Check if cfs_rq->curr is a task"
gvotable: export run_election API with force_callback parameter
usb: have gvotable callback return an error code
gvotable: have callback return an error code
arm64/dts: enable battery pairing feature
vendor_hook: sched: Add trace for compute_energy
vh: sched: rt: prefer to overutilized CPU from unfit CPU
soc/google/cpif: Keep DIT downstream netdev until removeDownstream
vendor_hook: sched: revert back to use most_spare_cap_cpu
media: mfc: move the mfc_alloc_codec_buffers()
usb: dwc3: move the operation for burst mode setting
arm64/dts: set bhi algo_ver and threshold
vendor_hook: sched: Change the uclamp max of low prio tasks
usb: phy: limit the string length in phy attribute
google/debug: eat: use polling api for channel operations
google/debug: eat: fix mbox ipc race condition
media: mfc: fix KASAN use-after-free case
misc: logbuffer: Fix a deadlock
arm64/dts: gs101: Update default target_load for ALT DVFS
ANDROID: trusty: add a toggle for running trusty work in higher priority
Revert "trusty: add a toggle for using high prio WQ"
pogo_transport: Configure USB_MUX_POGO_SEL
Revert "vendor_hook: sched: Refine vendor group uclamp update"
vendor_hook: sched: Refine RT util check
usb: dwc3: disable INCR undefined length burst mode
tcpci_max77759: Reset the OVP if Vbus times out
build.config.gs101: enable kunit kernel arg
kleaf: Add log=info to slider.
kleaf: Explicitly set build_initramfs.
Add dw3000-core-tests.ko to the blocklist
kleaf: re-enable the vendor_dlkm blocklist
kleaf: add missing pixel_em.ko
kleaf: Add slider_unstripped_modules_archive.
kleaf: Move definitions to slider.bzl.
iommu/samsung: add missing unmap_pages op
kleaf: update build command in README.md
kleaf: Fix KCONFIG_EXT_MODULES_PREFIX for kleaf --config=local builds.
Rename merge-from-mainline.sh
Signed-off-by: Will McVicker <willmcvicker@google.com>
Change-Id: Ic03e8dee890d0f1d508bacb02ce4caae2a20f6dc
-rw-r--r-- | drivers/trusty/trusty-virtio.c | 22 | ||||
-rw-r--r-- | drivers/trusty/trusty.c | 26 |
2 files changed, 29 insertions, 19 deletions
diff --git a/drivers/trusty/trusty-virtio.c b/drivers/trusty/trusty-virtio.c index 30111c4..8a7eb69 100644 --- a/drivers/trusty/trusty-virtio.c +++ b/drivers/trusty/trusty-virtio.c @@ -33,6 +33,7 @@ struct trusty_vdev; static bool use_high_wq; module_param(use_high_wq, bool, 0660); + struct trusty_ctx { struct device *dev; void *shared_va; @@ -46,7 +47,6 @@ struct trusty_ctx { struct mutex mlock; /* protects vdev_list */ struct workqueue_struct *kick_wq; struct workqueue_struct *check_wq; - struct workqueue_struct *kick_wq_high; struct workqueue_struct *check_wq_high; }; @@ -106,6 +106,7 @@ static int trusty_call_notify(struct notifier_block *nb, queue_work(tctx->check_wq_high, &tctx->check_vqs); else queue_work(tctx->check_wq, &tctx->check_vqs); + return NOTIFY_OK; } @@ -153,10 +154,7 @@ static bool trusty_virtio_notify(struct virtqueue *vq) if (api_ver < TRUSTY_API_VERSION_SMP_NOP) { atomic_set(&tvr->needs_kick, 1); - if (use_high_wq) - queue_work(tctx->kick_wq_high, &tctx->kick_vqs); - else - queue_work(tctx->kick_wq, &tctx->kick_vqs); + queue_work(tctx->kick_wq, &tctx->kick_vqs); } else { trusty_enqueue_nop(tctx->dev->parent, &tvr->kick_nop); } @@ -759,21 +757,14 @@ static int trusty_virtio_probe(struct platform_device *pdev) goto err_create_kick_wq; } - tctx->check_wq_high = alloc_workqueue("trusty-check-wq-high", WQ_UNBOUND | WQ_HIGHPRI, 0); + tctx->check_wq_high = alloc_workqueue("trusty-check-wq-high", + WQ_UNBOUND | WQ_HIGHPRI, 0); if (!tctx->check_wq_high) { ret = -ENODEV; dev_err(&pdev->dev, "Failed create trusty-check-wq-high\n"); goto err_create_check_wq_high; } - tctx->kick_wq_high = alloc_workqueue("trusty-kick-wq-high", - WQ_UNBOUND | WQ_CPU_INTENSIVE | WQ_HIGHPRI, 0); - if (!tctx->kick_wq_high) { - ret = -ENODEV; - dev_err(&pdev->dev, "Failed create trusty-kick-wq-high\n"); - goto err_create_kick_wq_high; - } - ret = trusty_virtio_add_devices(tctx); if (ret) { dev_err(&pdev->dev, "Failed to add virtio devices\n"); @@ -784,8 +775,6 @@ static int trusty_virtio_probe(struct platform_device *pdev) return 0; err_add_devices: - destroy_workqueue(tctx->kick_wq_high); -err_create_kick_wq_high: destroy_workqueue(tctx->check_wq_high); err_create_check_wq_high: destroy_workqueue(tctx->kick_wq); @@ -813,7 +802,6 @@ static int trusty_virtio_remove(struct platform_device *pdev) /* destroy workqueues */ destroy_workqueue(tctx->kick_wq); destroy_workqueue(tctx->check_wq); - destroy_workqueue(tctx->kick_wq_high); destroy_workqueue(tctx->check_wq_high); /* notify remote that shared area goes away */ diff --git a/drivers/trusty/trusty.c b/drivers/trusty/trusty.c index 3cfe7e2..c773beb 100644 --- a/drivers/trusty/trusty.c +++ b/drivers/trusty/trusty.c @@ -757,9 +757,26 @@ static void nop_work_func(struct work_struct *work) u32 last_arg0; struct trusty_work *tw = container_of(work, struct trusty_work, work); struct trusty_state *s = tw->ts; + int old_nice = task_nice(current); + bool nice_changed = false; dequeue_nop(s, args); do { + /* + * In case use_high_wq flaged when trusty is not idle, + * change the work's prio directly. + */ + if (!WARN_ON(current->policy != SCHED_NORMAL)) { + if (use_high_wq && task_nice(current) != MIN_NICE) { + nice_changed = true; + set_user_nice(current, MIN_NICE); + } else if (!use_high_wq && + task_nice(current) == MIN_NICE) { + nice_changed = true; + set_user_nice(current, 0); + } + } + dev_dbg(s->dev, "%s: %x %x %x\n", __func__, args[0], args[1], args[2]); @@ -783,7 +800,11 @@ static void nop_work_func(struct work_struct *work) } } } while (next); - + /* + * Restore nice if even changed. + */ + if (nice_changed) + set_user_nice(current, old_nice); dev_dbg(s->dev, "%s: done\n", __func__); } @@ -880,7 +901,8 @@ static int trusty_probe(struct platform_device *pdev) goto err_create_nop_wq; } - s->nop_wq_high = alloc_workqueue("trusty-nop-wq-high", WQ_HIGHPRI | WQ_CPU_INTENSIVE, 0); + s->nop_wq_high = alloc_workqueue("trusty-nop-wq-high", WQ_HIGHPRI | + WQ_CPU_INTENSIVE, 0); if (!s->nop_wq_high) { ret = -ENODEV; dev_err(&pdev->dev, "Failed create trusty-nop-wq-high\n"); |