Compare commits
9 Commits
Author | SHA1 | Date | |
---|---|---|---|
83b11b2e33 | |||
b2cc375219 | |||
0be50ed42c | |||
a8555ee769 | |||
94b4128f78 | |||
daed171360 | |||
a118f5d50b | |||
0142e0ea3a | |||
3c0e30c21b |
1
.github/build-canary-v3
vendored
1
.github/build-canary-v3
vendored
@ -1 +0,0 @@
|
||||
1
|
1
.github/build-nest-v3
vendored
1
.github/build-nest-v3
vendored
@ -1 +0,0 @@
|
||||
1
|
1
.github/release-canary-v3
vendored
1
.github/release-canary-v3
vendored
@ -1 +0,0 @@
|
||||
1
|
1
.github/release-nest-v3
vendored
1
.github/release-nest-v3
vendored
@ -1 +0,0 @@
|
||||
1
|
34
.github/workflows/build-canaryv3.yml
vendored
34
.github/workflows/build-canaryv3.yml
vendored
@ -1,34 +0,0 @@
|
||||
name: PikaOS Package Build Only (Canary) (amd64-v3)
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
paths:
|
||||
- '.github/build-canary-v3'
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: ghcr.io/pikaos-linux/pikaos-builder:canaryv3
|
||||
volumes:
|
||||
- /proc:/proc
|
||||
options: --privileged -it
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Install SSH key
|
||||
uses: shimataro/ssh-key-action@v2
|
||||
with:
|
||||
key: ${{ secrets.SSH_KEY }}
|
||||
name: id_rsa
|
||||
known_hosts: ${{ secrets.KNOWN_HOSTS }}
|
||||
if_key_exists: replace
|
||||
|
||||
- name: Update APT Cache
|
||||
run: apt-get update -y
|
||||
|
||||
- name: Build Package
|
||||
run: ./main.sh
|
34
.github/workflows/build-nestv3.yml
vendored
34
.github/workflows/build-nestv3.yml
vendored
@ -1,34 +0,0 @@
|
||||
name: PikaOS Package Build Only (amd64-v3)
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
paths:
|
||||
- '.github/build-nest-v3'
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: ghcr.io/pikaos-linux/pikaos-builder:nestv3
|
||||
volumes:
|
||||
- /proc:/proc
|
||||
options: --privileged -it
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Install SSH key
|
||||
uses: shimataro/ssh-key-action@v2
|
||||
with:
|
||||
key: ${{ secrets.SSH_KEY }}
|
||||
name: id_rsa
|
||||
known_hosts: ${{ secrets.KNOWN_HOSTS }}
|
||||
if_key_exists: replace
|
||||
|
||||
- name: Update APT Cache
|
||||
run: apt-get update -y
|
||||
|
||||
- name: Build Package
|
||||
run: ./main.sh
|
25
.github/workflows/build.yml
vendored
Normal file
25
.github/workflows/build.yml
vendored
Normal file
@ -0,0 +1,25 @@
|
||||
|
||||
name: PikaOS Kernel Build Only
|
||||
|
||||
on:
|
||||
workflow_dispatch
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: self-hosted
|
||||
container:
|
||||
image: ghcr.io/pikaos-linux/pika-kernel-container:f48d8d6ea24049351f74133da4232634c3bcb2ffe66e0ff7e6f2692fdd33d25d
|
||||
volumes:
|
||||
- /proc:/proc
|
||||
options: --privileged -it
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Build Kernel
|
||||
run: ./main.sh
|
||||
|
||||
- uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: PikaOS Kernel
|
||||
path: output/
|
37
.github/workflows/release-canaryv3.yml
vendored
37
.github/workflows/release-canaryv3.yml
vendored
@ -1,37 +0,0 @@
|
||||
name: PikaOS Package Build & Release (Canary) (amd64-v3)
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
paths:
|
||||
- '.github/release-canary-v3'
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: ghcr.io/pikaos-linux/pikaos-builder:canaryv3
|
||||
volumes:
|
||||
- /proc:/proc
|
||||
options: --privileged -it
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Install SSH key
|
||||
uses: shimataro/ssh-key-action@v2
|
||||
with:
|
||||
key: ${{ secrets.SSH_KEY }}
|
||||
name: id_rsa
|
||||
known_hosts: ${{ secrets.KNOWN_HOSTS }}
|
||||
if_key_exists: replace
|
||||
|
||||
- name: Update APT Cache
|
||||
run: apt-get update -y
|
||||
|
||||
- name: Build Package
|
||||
run: ./main.sh
|
||||
|
||||
- name: Release Package
|
||||
run: ./release.sh
|
37
.github/workflows/release-nestv3.yml
vendored
37
.github/workflows/release-nestv3.yml
vendored
@ -1,37 +0,0 @@
|
||||
name: PikaOS Package Build & Release (amd64-v3)
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
paths:
|
||||
- '.github/release-nest-v3'
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: ghcr.io/pikaos-linux/pikaos-builder:nestv3
|
||||
volumes:
|
||||
- /proc:/proc
|
||||
options: --privileged -it
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Install SSH key
|
||||
uses: shimataro/ssh-key-action@v2
|
||||
with:
|
||||
key: ${{ secrets.SSH_KEY }}
|
||||
name: id_rsa
|
||||
known_hosts: ${{ secrets.KNOWN_HOSTS }}
|
||||
if_key_exists: replace
|
||||
|
||||
- name: Update APT Cache
|
||||
run: apt-get update -y
|
||||
|
||||
- name: Build Package
|
||||
run: ./main.sh
|
||||
|
||||
- name: Release Package
|
||||
run: ./release.sh
|
46
.github/workflows/release.yml
vendored
Normal file
46
.github/workflows/release.yml
vendored
Normal file
@ -0,0 +1,46 @@
|
||||
name: PikaOS Kernel Build And Release
|
||||
|
||||
on:
|
||||
workflow_dispatch
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: self-hosted
|
||||
container:
|
||||
image: ghcr.io/pikaos-linux/pika-kernel-container@sha256:f48d8d6ea24049351f74133da4232634c3bcb2ffe66e0ff7e6f2692fdd33d25d
|
||||
volumes:
|
||||
- /proc:/proc
|
||||
options: --privileged -it
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Import GPG key
|
||||
id: import_gpg
|
||||
uses: crazy-max/ghaction-import-gpg@v5
|
||||
with:
|
||||
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
|
||||
passphrase: ${{ secrets.PASSPHRASE }}
|
||||
|
||||
- name: Install SSH key
|
||||
uses: shimataro/ssh-key-action@v2
|
||||
with:
|
||||
key: ${{ secrets.SSH_KEY }}
|
||||
name: id_rsa
|
||||
known_hosts: ${{ secrets.KNOWN_HOSTS }}
|
||||
if_key_exists: replace
|
||||
|
||||
- name: Build Kernel
|
||||
run: ./main.sh
|
||||
|
||||
- name: Release Kernel
|
||||
run: ./release.sh
|
||||
|
||||
- name: Purge cache
|
||||
uses: strrife/cloudflare-chunked-purge-action@master
|
||||
env:
|
||||
# Zone is required by both authentication methods
|
||||
CLOUDFLARE_ZONE: ${{ secrets.CLOUDFLARE_ZONE }}
|
||||
|
||||
CLOUDFLARE_TOKEN: ${{ secrets.CLOUDFLARE_TOKEN }}
|
||||
PURGE_URLS: ${{ vars.PURGE_URLS }}
|
24
LICENSE.md
24
LICENSE.md
@ -1,24 +0,0 @@
|
||||
MIT License (With DPKG packaging compatibility)
|
||||
|
||||
Copyright (c) 2024 PikaOS
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
|
||||
Notes:
|
||||
The files covered by this license are any files and directories in the root of this repository (including but not limited to: `main.sh`, `release.sh`, and `.github`), with the exception of the `debian` directory and its contents if `debian/copyright` exists, and declares any files or directories as a different LICENSE/COPYRIGHT.
|
3
main.sh
3
main.sh
@ -1,8 +1,5 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Move the debs to output
|
||||
mkdir -p ./output
|
||||
|
||||
. ./scripts/source.sh
|
||||
. ../scripts/patch.sh
|
||||
. ../scripts/config.sh
|
||||
|
30
output/key.gpg
Normal file
30
output/key.gpg
Normal file
@ -0,0 +1,30 @@
|
||||
-----BEGIN PGP PUBLIC KEY BLOCK-----
|
||||
|
||||
mQENBGPJoigBCADZ8tDzkO2LlWIzXZLLyRLIaRnaNHG6P9xx0ABSFsqU+X+p9qDS
|
||||
eQW6SmeCN+PauqAHlzrJ7p3XZi07E+h69PEk5R5n7qhVECW35Y1sB9EfC2nqVRxd
|
||||
RcWtwQsipEHQmjvWIsD4hR5uhq62p7grSkQxv13SGLqyJkKIpkic2vZEgqubfZd4
|
||||
KLPFvaQZar6QWa3urfYnUZzc1TNkEYxghr/dQuCFSfYPM+yHT70MXrlPOgfslGgL
|
||||
YtoN1YauF04wzAg1RFfrWX2AdHE792fVHrkHRsvQg1Pvw4KjPnM6jX2V8W8n7C++
|
||||
yxpiMUU2h9FqBWfHrqNLWtKdn6+lgHUq2Oj3ABEBAAG0IWZlcnJlbyA8aGFyZGVy
|
||||
dGhhbmZpcmVAZ21haWwuY29tPokBTgQTAQoAOBYhBIvETfAmQkhf8fPMBKt4xg37
|
||||
WBYDBQJjyaIoAhsDBQsJCAcCBhUKCQgLAgQWAgMBAh4BAheAAAoJEKt4xg37WBYD
|
||||
4/oH/2LRW4FwLHCsWeJfRx5Z7BwKrGqWIF2VujkvEjlFOGYO7aN5HxeX/QKeN+Wy
|
||||
901hv4CO7T7aSye0qjaYz0I6ZUmr9CaINdXTH7fok3CXQYBfluaLiyxMPSm+Fe5o
|
||||
vfiUiSMZ488uaUkFSww/TEP8wi5H02yqGJcx3yB54OTsVb8eUHLPXno0T4tooWvX
|
||||
EOMUKkpj3tEylJoqL5d2iz2ZrkMdX9tVXOkKY3iJD2El0TPITrTIuRuurqzc4CWU
|
||||
laV7bmZ1Mq5r21S7ISOhhzvEMwsiWylIFXmXNPvbU7DC43uT3+nKhBca8VESzvmu
|
||||
r7zC6CcQAR5IVHMjd8weFfrnGXm5AQ0EY8miKAEIALnnC+U4gx0m0yLEVOHBoccb
|
||||
T7CvhmBYer2shxe5o7zUZ5V4y1iJdzSSJksbQkZH4+JDwi7Hp3/lqI2EsxQ9TR+A
|
||||
OdRvETfz88aK/e2vJ0j7Bt3Dr0u0mgoo9kSx6rLq1oH9Nha9ReOljmEfDtuINR86
|
||||
QGEd8PyvNDcUap+6QQa6/RBEDiH1zYBYtxv4rbuciKsh+e6r6C8TJb43nKr3YBGu
|
||||
/GE1aDlGaKvFgUOZmaapgoQVdpXcg7ZtTpI8sNKdnLVEChIKk35n52XfQDZPVvAt
|
||||
bsUIr77B4hi+GsjGli7ihr+JJEiHwOyCMZvV95ZWq2ThrXxRWA8mHqCLhz7oTV8A
|
||||
EQEAAYkBNgQYAQoAIBYhBIvETfAmQkhf8fPMBKt4xg37WBYDBQJjyaIoAhsMAAoJ
|
||||
EKt4xg37WBYDdwAIAI3yJwOa6P6wz3ddLt/4FTlCSnlJ8C904RDwtJEO/C/y9qZv
|
||||
yE0qitUi7mntzYE6G7SES3Zn6b9HhdTS9kQv6VUg75TjD/WGPVju5cB11mte95Z9
|
||||
6iW5u65kxpawxiTUhaO+O4RO6fZ29rZyCQDfa7ESudkVE/yktAA5umnAbGpgxGa6
|
||||
8egCGiZ0LKUqcHxMAsoUUhlOTk3LR4yS6nKE1Q8Dr6E7NYlrWcoGDSQzKvXLqf8e
|
||||
9eJLGckePwHDzhgO9LKGW3meTV6ldLehTsxm/ycHqXL7/wYjYy6ZXj/5Px3CGLPg
|
||||
DH9mVj8ERsz096eQA+53gmcTsNtq/FLWS2MhtCc=
|
||||
=+26V
|
||||
-----END PGP PUBLIC KEY BLOCK-----
|
32341
patches/0001-cachy-all.patch
Normal file
32341
patches/0001-cachy-all.patch
Normal file
File diff suppressed because it is too large
Load Diff
2240
patches/0002-eevdf.patch
Normal file
2240
patches/0002-eevdf.patch
Normal file
File diff suppressed because it is too large
Load Diff
552
patches/0002-eevdfbore.patch
Normal file
552
patches/0002-eevdfbore.patch
Normal file
@ -0,0 +1,552 @@
|
||||
From c92de794ee60ef526ca33cfee59e96f0d95b0697 Mon Sep 17 00:00:00 2001
|
||||
From: Piotr Gorski <lucjan.lucjanov@gmail.com>
|
||||
Date: Sun, 17 Sep 2023 22:51:20 +0200
|
||||
Subject: [PATCH] bore-eevdf
|
||||
|
||||
Signed-off-by: Piotr Gorski <lucjan.lucjanov@gmail.com>
|
||||
---
|
||||
include/linux/sched.h | 31 ++++++++
|
||||
init/Kconfig | 20 +++++
|
||||
kernel/sched/core.c | 160 +++++++++++++++++++++++++++++++++++++++
|
||||
kernel/sched/debug.c | 3 +
|
||||
kernel/sched/fair.c | 169 +++++++++++++++++++++++++++++++++++++++++-
|
||||
5 files changed, 381 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/include/linux/sched.h b/include/linux/sched.h
|
||||
index c940c4dc8..e88251927 100644
|
||||
--- a/include/linux/sched.h
|
||||
+++ b/include/linux/sched.h
|
||||
@@ -545,6 +545,24 @@ struct sched_statistics {
|
||||
#endif /* CONFIG_SCHEDSTATS */
|
||||
} ____cacheline_aligned;
|
||||
|
||||
+#ifdef CONFIG_SCHED_BORE
|
||||
+typedef union {
|
||||
+ u16 u16;
|
||||
+ s16 s16;
|
||||
+ u8 u8[2];
|
||||
+ s8 s8[2];
|
||||
+} x16;
|
||||
+
|
||||
+typedef union {
|
||||
+ u32 u32;
|
||||
+ s32 s32;
|
||||
+ u16 u16[2];
|
||||
+ s16 s16[2];
|
||||
+ u8 u8[4];
|
||||
+ s8 s8[4];
|
||||
+} x32;
|
||||
+#endif // CONFIG_SCHED_BORE
|
||||
+
|
||||
struct sched_entity {
|
||||
/* For load-balancing: */
|
||||
struct load_weight load;
|
||||
@@ -559,6 +577,12 @@ struct sched_entity {
|
||||
u64 sum_exec_runtime;
|
||||
u64 prev_sum_exec_runtime;
|
||||
u64 vruntime;
|
||||
+#ifdef CONFIG_SCHED_BORE
|
||||
+ u64 burst_time;
|
||||
+ u16 prev_burst_penalty;
|
||||
+ u16 curr_burst_penalty;
|
||||
+ u16 burst_penalty;
|
||||
+#endif // CONFIG_SCHED_BORE
|
||||
s64 vlag;
|
||||
u64 slice;
|
||||
|
||||
@@ -990,6 +1014,13 @@ struct task_struct {
|
||||
struct list_head children;
|
||||
struct list_head sibling;
|
||||
struct task_struct *group_leader;
|
||||
+#ifdef CONFIG_SCHED_BORE
|
||||
+ u16 child_burst_cache;
|
||||
+ u16 child_burst_count_cache;
|
||||
+ u64 child_burst_last_cached;
|
||||
+ u16 group_burst_cache;
|
||||
+ u64 group_burst_last_cached;
|
||||
+#endif // CONFIG_SCHED_BORE
|
||||
|
||||
/*
|
||||
* 'ptraced' is the list of tasks this task is using ptrace() on.
|
||||
diff --git a/init/Kconfig b/init/Kconfig
|
||||
index 25193a9d5..acc02af18 100644
|
||||
--- a/init/Kconfig
|
||||
+++ b/init/Kconfig
|
||||
@@ -1278,6 +1278,26 @@ config CHECKPOINT_RESTORE
|
||||
|
||||
If unsure, say N here.
|
||||
|
||||
+config SCHED_BORE
|
||||
+ bool "Burst-Oriented Response Enhancer"
|
||||
+ default y
|
||||
+ help
|
||||
+ In Desktop and Mobile computing, one might prefer interactive
|
||||
+ tasks to keep responsive no matter what they run in the background.
|
||||
+
|
||||
+ Enabling this kernel feature modifies the scheduler to discriminate
|
||||
+ tasks by their burst time (runtime since it last went sleeping or
|
||||
+ yielding state) and prioritize those that run less bursty.
|
||||
+ Such tasks usually include window compositor, widgets backend,
|
||||
+ terminal emulator, video playback, games and so on.
|
||||
+ With a little impact to scheduling fairness, it may improve
|
||||
+ responsiveness especially under heavy background workload.
|
||||
+
|
||||
+ You can turn it off by setting the sysctl kernel.sched_bore = 0.
|
||||
+ Enabling this feature implies NO_GENTLE_FAIR_SLEEPERS by default.
|
||||
+
|
||||
+ If unsure say Y here.
|
||||
+
|
||||
config SCHED_AUTOGROUP
|
||||
bool "Automatic process group scheduling"
|
||||
select CGROUPS
|
||||
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
|
||||
index aff81e124..2cc47b723 100644
|
||||
--- a/kernel/sched/core.c
|
||||
+++ b/kernel/sched/core.c
|
||||
@@ -4491,6 +4491,155 @@ int wake_up_state(struct task_struct *p, unsigned int state)
|
||||
return try_to_wake_up(p, state, 0);
|
||||
}
|
||||
|
||||
+#ifdef CONFIG_SCHED_BORE
|
||||
+extern unsigned int sched_burst_cache_lifetime;
|
||||
+extern unsigned int sched_bore;
|
||||
+extern unsigned int sched_burst_fork_atavistic;
|
||||
+
|
||||
+void __init sched_init_bore(void) {
|
||||
+ init_task.child_burst_cache = 0;
|
||||
+ init_task.child_burst_count_cache = 0;
|
||||
+ init_task.child_burst_last_cached = 0;
|
||||
+ init_task.group_burst_cache = 0;
|
||||
+ init_task.group_burst_last_cached = 0;
|
||||
+ init_task.se.burst_time = 0;
|
||||
+ init_task.se.prev_burst_penalty = 0;
|
||||
+ init_task.se.curr_burst_penalty = 0;
|
||||
+ init_task.se.burst_penalty = 0;
|
||||
+}
|
||||
+
|
||||
+void inline sched_fork_bore(struct task_struct *p) {
|
||||
+ p->child_burst_cache = 0;
|
||||
+ p->child_burst_count_cache = 0;
|
||||
+ p->child_burst_last_cached = 0;
|
||||
+ p->group_burst_cache = 0;
|
||||
+ p->group_burst_last_cached = 0;
|
||||
+ p->se.burst_time = 0;
|
||||
+ p->se.curr_burst_penalty = 0;
|
||||
+}
|
||||
+
|
||||
+static u32 count_child_tasks(struct task_struct *p) {
|
||||
+ struct task_struct *child;
|
||||
+ u32 cnt = 0;
|
||||
+ list_for_each_entry(child, &p->children, sibling) {cnt++;}
|
||||
+ return cnt;
|
||||
+}
|
||||
+
|
||||
+static inline bool child_burst_cache_expired(struct task_struct *p, u64 now) {
|
||||
+ return (p->child_burst_last_cached + sched_burst_cache_lifetime < now);
|
||||
+}
|
||||
+
|
||||
+static inline bool group_burst_cache_expired(struct task_struct *p, u64 now) {
|
||||
+ return (p->group_burst_last_cached + sched_burst_cache_lifetime < now);
|
||||
+}
|
||||
+
|
||||
+static void __update_child_burst_cache(
|
||||
+ struct task_struct *p, u32 cnt, u32 sum, u64 now) {
|
||||
+ u16 avg = 0;
|
||||
+ if (cnt) avg = DIV_ROUND_CLOSEST(sum, cnt);
|
||||
+ p->child_burst_cache = max(avg, p->se.burst_penalty);
|
||||
+ p->child_burst_count_cache = cnt;
|
||||
+ p->child_burst_last_cached = now;
|
||||
+}
|
||||
+
|
||||
+static void update_child_burst_cache(struct task_struct *p, u64 now) {
|
||||
+ struct task_struct *child;
|
||||
+ u32 cnt = 0;
|
||||
+ u32 sum = 0;
|
||||
+
|
||||
+ list_for_each_entry(child, &p->children, sibling) {
|
||||
+ cnt++;
|
||||
+ sum += child->se.burst_penalty;
|
||||
+ }
|
||||
+
|
||||
+ __update_child_burst_cache(p, cnt, sum, now);
|
||||
+}
|
||||
+
|
||||
+static void update_child_burst_cache_atavistic(
|
||||
+ struct task_struct *p, u64 now, u32 depth, u32 *acnt, u32 *asum) {
|
||||
+ struct task_struct *child, *dec;
|
||||
+ u32 cnt = 0, dcnt = 0;
|
||||
+ u32 sum = 0;
|
||||
+
|
||||
+ list_for_each_entry(child, &p->children, sibling) {
|
||||
+ dec = child;
|
||||
+ while ((dcnt = count_child_tasks(dec)) == 1)
|
||||
+ dec = list_first_entry(&dec->children, struct task_struct, sibling);
|
||||
+
|
||||
+ if (!dcnt || !depth) {
|
||||
+ cnt++;
|
||||
+ sum += dec->se.burst_penalty;
|
||||
+ } else {
|
||||
+ if (child_burst_cache_expired(dec, now))
|
||||
+ update_child_burst_cache_atavistic(dec, now, depth - 1, &cnt, &sum);
|
||||
+ else {
|
||||
+ cnt += dec->child_burst_count_cache;
|
||||
+ sum += (u32)dec->child_burst_cache * dec->child_burst_count_cache;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ __update_child_burst_cache(p, cnt, sum, now);
|
||||
+ *acnt += cnt;
|
||||
+ *asum += sum;
|
||||
+}
|
||||
+
|
||||
+static void update_group_burst_cache(struct task_struct *p, u64 now) {
|
||||
+ struct task_struct *member;
|
||||
+ u32 cnt = 0, sum = 0;
|
||||
+ u16 avg = 0;
|
||||
+
|
||||
+ for_each_thread(p, member) {
|
||||
+ cnt++;
|
||||
+ sum += member->se.burst_penalty;
|
||||
+ }
|
||||
+
|
||||
+ if (cnt) avg = DIV_ROUND_CLOSEST(sum, cnt);
|
||||
+ p->group_burst_cache = max(avg, p->se.burst_penalty);
|
||||
+ p->group_burst_last_cached = now;
|
||||
+}
|
||||
+
|
||||
+#define forked_task_is_process(p) (p->pid == p->tgid)
|
||||
+
|
||||
+static void fork_burst_penalty(struct task_struct *p) {
|
||||
+ struct sched_entity *se = &p->se;
|
||||
+ struct task_struct *anc;
|
||||
+ u64 now = ktime_get_ns();
|
||||
+ u32 cnt = 0, sum = 0;
|
||||
+ u16 burst_cache;
|
||||
+
|
||||
+ if (likely(sched_bore)) {
|
||||
+ read_lock(&tasklist_lock);
|
||||
+
|
||||
+ if (forked_task_is_process(p)) {
|
||||
+ anc = p->real_parent;
|
||||
+ if (likely(sched_burst_fork_atavistic)) {
|
||||
+ while ((anc->real_parent != anc) &&
|
||||
+ (count_child_tasks(anc) == 1))
|
||||
+ anc = anc->real_parent;
|
||||
+ if (child_burst_cache_expired(anc, now))
|
||||
+ update_child_burst_cache_atavistic(
|
||||
+ anc, now, sched_burst_fork_atavistic - 1, &cnt, &sum);
|
||||
+ } else
|
||||
+ if (child_burst_cache_expired(anc, now))
|
||||
+ update_child_burst_cache(anc, now);
|
||||
+
|
||||
+ burst_cache = anc->child_burst_cache;
|
||||
+ } else {
|
||||
+ anc = p->group_leader;
|
||||
+ if (group_burst_cache_expired(anc, now))
|
||||
+ update_group_burst_cache(anc, now);
|
||||
+
|
||||
+ burst_cache = anc->group_burst_cache;
|
||||
+ }
|
||||
+
|
||||
+ read_unlock(&tasklist_lock);
|
||||
+ se->prev_burst_penalty = max(se->prev_burst_penalty, burst_cache);
|
||||
+ }
|
||||
+ se->burst_penalty = se->prev_burst_penalty;
|
||||
+}
|
||||
+#endif // CONFIG_SCHED_BORE
|
||||
+
|
||||
/*
|
||||
* Perform scheduler related setup for a newly forked process p.
|
||||
* p is forked by current.
|
||||
@@ -4507,6 +4656,9 @@ static void __sched_fork(unsigned long clone_flags, struct task_struct *p)
|
||||
p->se.prev_sum_exec_runtime = 0;
|
||||
p->se.nr_migrations = 0;
|
||||
p->se.vruntime = 0;
|
||||
+#ifdef CONFIG_SCHED_BORE
|
||||
+ sched_fork_bore(p);
|
||||
+#endif // CONFIG_SCHED_BORE
|
||||
p->se.vlag = 0;
|
||||
INIT_LIST_HEAD(&p->se.group_node);
|
||||
|
||||
@@ -4828,6 +4980,9 @@ void sched_cgroup_fork(struct task_struct *p, struct kernel_clone_args *kargs)
|
||||
|
||||
void sched_post_fork(struct task_struct *p)
|
||||
{
|
||||
+#ifdef CONFIG_SCHED_BORE
|
||||
+ fork_burst_penalty(p);
|
||||
+#endif // CONFIG_SCHED_BORE
|
||||
uclamp_post_fork(p);
|
||||
}
|
||||
|
||||
@@ -9954,6 +10109,11 @@ void __init sched_init(void)
|
||||
BUG_ON(&dl_sched_class != &stop_sched_class + 1);
|
||||
#endif
|
||||
|
||||
+#ifdef CONFIG_SCHED_BORE
|
||||
+ sched_init_bore();
|
||||
+ printk(KERN_INFO "BORE (Burst-Oriented Response Enhancer) CPU Scheduler modification 3.1.4 by Masahito Suzuki");
|
||||
+#endif // CONFIG_SCHED_BORE
|
||||
+
|
||||
wait_bit_init();
|
||||
|
||||
#ifdef CONFIG_FAIR_GROUP_SCHED
|
||||
diff --git a/kernel/sched/debug.c b/kernel/sched/debug.c
|
||||
index e7e83181f..6ebd52247 100644
|
||||
--- a/kernel/sched/debug.c
|
||||
+++ b/kernel/sched/debug.c
|
||||
@@ -594,6 +594,9 @@ print_task(struct seq_file *m, struct rq *rq, struct task_struct *p)
|
||||
SPLIT_NS(schedstat_val_or_zero(p->stats.sum_sleep_runtime)),
|
||||
SPLIT_NS(schedstat_val_or_zero(p->stats.sum_block_runtime)));
|
||||
|
||||
+#ifdef CONFIG_SCHED_BORE
|
||||
+ SEQ_printf(m, " %2d", ((x16*)&p->se.burst_penalty)->u8[1]);
|
||||
+#endif
|
||||
#ifdef CONFIG_NUMA_BALANCING
|
||||
SEQ_printf(m, " %d %d", task_node(p), task_numa_group_id(p));
|
||||
#endif
|
||||
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
|
||||
index d49c0f979..dffee0766 100644
|
||||
--- a/kernel/sched/fair.c
|
||||
+++ b/kernel/sched/fair.c
|
||||
@@ -19,6 +19,9 @@
|
||||
*
|
||||
* Adaptive scheduling granularity, math enhancements by Peter Zijlstra
|
||||
* Copyright (C) 2007 Red Hat, Inc., Peter Zijlstra
|
||||
+ *
|
||||
+ * Burst-Oriented Response Enhancer (BORE) CPU Scheduler
|
||||
+ * Copyright (C) 2021-2023 Masahito Suzuki <firelzrd@gmail.com>
|
||||
*/
|
||||
#include <linux/energy_model.h>
|
||||
#include <linux/mmap_lock.h>
|
||||
@@ -86,6 +89,67 @@ unsigned int sysctl_sched_child_runs_first __read_mostly;
|
||||
|
||||
const_debug unsigned int sysctl_sched_migration_cost = 500000UL;
|
||||
|
||||
+#ifdef CONFIG_SCHED_BORE
|
||||
+unsigned int __read_mostly sched_bore = 1;
|
||||
+unsigned int __read_mostly sched_bore_extra_flags = 0;
|
||||
+unsigned int __read_mostly sched_burst_cache_lifetime = 60000000;
|
||||
+unsigned int __read_mostly sched_burst_penalty_offset = 22;
|
||||
+unsigned int __read_mostly sched_burst_penalty_scale = 1366;
|
||||
+unsigned int __read_mostly sched_burst_smoothness_up = 1;
|
||||
+unsigned int __read_mostly sched_burst_smoothness_down = 0;
|
||||
+unsigned int __read_mostly sched_burst_fork_atavistic = 2;
|
||||
+static int three = 3;
|
||||
+static int sixty_four = 64;
|
||||
+static int maxval_12_bits = 4095;
|
||||
+
|
||||
+#define MAX_BURST_PENALTY ((40U << 8) - 1)
|
||||
+
|
||||
+static inline u32 log2plus1_u64_u32f8(u64 v) {
|
||||
+ x32 result;
|
||||
+ int msb = fls64(v);
|
||||
+ int excess_bits = msb - 9;
|
||||
+ result.u8[0] = (0 <= excess_bits)? v >> excess_bits: v << -excess_bits;
|
||||
+ result.u8[1] = msb;
|
||||
+ return result.u32;
|
||||
+}
|
||||
+
|
||||
+static inline u32 calc_burst_penalty(u64 burst_time) {
|
||||
+ u32 greed, tolerance, penalty, scaled_penalty;
|
||||
+
|
||||
+ greed = log2plus1_u64_u32f8(burst_time);
|
||||
+ tolerance = sched_burst_penalty_offset << 8;
|
||||
+ penalty = max(0, (s32)greed - (s32)tolerance);
|
||||
+ scaled_penalty = penalty * sched_burst_penalty_scale >> 10;
|
||||
+
|
||||
+ return min(MAX_BURST_PENALTY, scaled_penalty);
|
||||
+}
|
||||
+
|
||||
+static void update_burst_penalty(struct sched_entity *se) {
|
||||
+ se->curr_burst_penalty = calc_burst_penalty(se->burst_time);
|
||||
+ se->burst_penalty = max(se->prev_burst_penalty, se->curr_burst_penalty);
|
||||
+}
|
||||
+
|
||||
+static inline u64 penalty_scale(u64 delta, struct sched_entity *se, bool half) {
|
||||
+ u32 score = ((x16*)&se->burst_penalty)->u8[1];
|
||||
+ if (half) score >>= 1;
|
||||
+ return mul_u64_u32_shr(delta, sched_prio_to_wmult[score], 22);
|
||||
+}
|
||||
+
|
||||
+static inline u32 binary_smooth(u32 new, u32 old) {
|
||||
+ int increment = new - old;
|
||||
+ return (0 <= increment)?
|
||||
+ old + ( increment >> sched_burst_smoothness_up):
|
||||
+ old - (-increment >> sched_burst_smoothness_down);
|
||||
+}
|
||||
+
|
||||
+static void restart_burst(struct sched_entity *se) {
|
||||
+ se->burst_penalty = se->prev_burst_penalty =
|
||||
+ binary_smooth(se->curr_burst_penalty, se->prev_burst_penalty);
|
||||
+ se->curr_burst_penalty = 0;
|
||||
+ se->burst_time = 0;
|
||||
+}
|
||||
+#endif // CONFIG_SCHED_BORE
|
||||
+
|
||||
int sched_thermal_decay_shift;
|
||||
static int __init setup_sched_thermal_decay_shift(char *str)
|
||||
{
|
||||
@@ -145,6 +209,78 @@ static unsigned int sysctl_numa_balancing_promote_rate_limit = 65536;
|
||||
|
||||
#ifdef CONFIG_SYSCTL
|
||||
static struct ctl_table sched_fair_sysctls[] = {
|
||||
+#ifdef CONFIG_SCHED_BORE
|
||||
+ {
|
||||
+ .procname = "sched_bore",
|
||||
+ .data = &sched_bore,
|
||||
+ .maxlen = sizeof(unsigned int),
|
||||
+ .mode = 0644,
|
||||
+ .proc_handler = &proc_dointvec_minmax,
|
||||
+ .extra1 = SYSCTL_ZERO,
|
||||
+ .extra2 = SYSCTL_ONE,
|
||||
+ },
|
||||
+ {
|
||||
+ .procname = "sched_bore_extra_flags",
|
||||
+ .data = &sched_bore_extra_flags,
|
||||
+ .maxlen = sizeof(unsigned int),
|
||||
+ .mode = 0644,
|
||||
+ .proc_handler = &proc_dointvec_minmax,
|
||||
+ .extra1 = SYSCTL_ZERO,
|
||||
+ .extra2 = SYSCTL_ONE,
|
||||
+ },
|
||||
+ {
|
||||
+ .procname = "sched_burst_cache_lifetime",
|
||||
+ .data = &sched_burst_cache_lifetime,
|
||||
+ .maxlen = sizeof(unsigned int),
|
||||
+ .mode = 0644,
|
||||
+ .proc_handler = proc_dointvec,
|
||||
+ },
|
||||
+ {
|
||||
+ .procname = "sched_burst_fork_atavistic",
|
||||
+ .data = &sched_burst_fork_atavistic,
|
||||
+ .maxlen = sizeof(unsigned int),
|
||||
+ .mode = 0644,
|
||||
+ .proc_handler = &proc_dointvec_minmax,
|
||||
+ .extra1 = SYSCTL_ZERO,
|
||||
+ .extra2 = &three,
|
||||
+ },
|
||||
+ {
|
||||
+ .procname = "sched_burst_penalty_offset",
|
||||
+ .data = &sched_burst_penalty_offset,
|
||||
+ .maxlen = sizeof(unsigned int),
|
||||
+ .mode = 0644,
|
||||
+ .proc_handler = &proc_dointvec_minmax,
|
||||
+ .extra1 = SYSCTL_ZERO,
|
||||
+ .extra2 = &sixty_four,
|
||||
+ },
|
||||
+ {
|
||||
+ .procname = "sched_burst_penalty_scale",
|
||||
+ .data = &sched_burst_penalty_scale,
|
||||
+ .maxlen = sizeof(unsigned int),
|
||||
+ .mode = 0644,
|
||||
+ .proc_handler = &proc_dointvec_minmax,
|
||||
+ .extra1 = SYSCTL_ZERO,
|
||||
+ .extra2 = &maxval_12_bits,
|
||||
+ },
|
||||
+ {
|
||||
+ .procname = "sched_burst_smoothness_down",
|
||||
+ .data = &sched_burst_smoothness_down,
|
||||
+ .maxlen = sizeof(unsigned int),
|
||||
+ .mode = 0644,
|
||||
+ .proc_handler = &proc_dointvec_minmax,
|
||||
+ .extra1 = SYSCTL_ZERO,
|
||||
+ .extra2 = &three,
|
||||
+ },
|
||||
+ {
|
||||
+ .procname = "sched_burst_smoothness_up",
|
||||
+ .data = &sched_burst_smoothness_up,
|
||||
+ .maxlen = sizeof(unsigned int),
|
||||
+ .mode = 0644,
|
||||
+ .proc_handler = &proc_dointvec_minmax,
|
||||
+ .extra1 = SYSCTL_ZERO,
|
||||
+ .extra2 = &three,
|
||||
+ },
|
||||
+#endif // CONFIG_SCHED_BORE
|
||||
{
|
||||
.procname = "sched_child_runs_first",
|
||||
.data = &sysctl_sched_child_runs_first,
|
||||
@@ -308,11 +444,22 @@ static u64 __calc_delta(u64 delta_exec, unsigned long weight, struct load_weight
|
||||
/*
|
||||
* delta /= w
|
||||
*/
|
||||
+#ifdef CONFIG_SCHED_BORE
|
||||
+#define bore_start_debit_full_penalty (sched_bore_extra_flags)
|
||||
+#define calc_delta_fair_debit(delta, se) \
|
||||
+ __calc_delta_fair(delta, se, !bore_start_debit_full_penalty)
|
||||
+#define calc_delta_fair(delta, se) __calc_delta_fair(delta, se, false)
|
||||
+static inline u64 __calc_delta_fair(u64 delta, struct sched_entity *se, bool half)
|
||||
+#else // CONFIG_SCHED_BORE
|
||||
static inline u64 calc_delta_fair(u64 delta, struct sched_entity *se)
|
||||
+#endif // CONFIG_SCHED_BORE
|
||||
{
|
||||
if (unlikely(se->load.weight != NICE_0_LOAD))
|
||||
delta = __calc_delta(delta, NICE_0_LOAD, &se->load);
|
||||
|
||||
+#ifdef CONFIG_SCHED_BORE
|
||||
+ if (likely(sched_bore)) delta = penalty_scale(delta, se, half);
|
||||
+#endif // CONFIG_SCHED_BORE
|
||||
return delta;
|
||||
}
|
||||
|
||||
@@ -1128,7 +1275,11 @@ static void update_curr(struct cfs_rq *cfs_rq)
|
||||
curr->sum_exec_runtime += delta_exec;
|
||||
schedstat_add(cfs_rq->exec_clock, delta_exec);
|
||||
|
||||
- curr->vruntime += calc_delta_fair(delta_exec, curr);
|
||||
+#ifdef CONFIG_SCHED_BORE
|
||||
+ curr->burst_time += delta_exec;
|
||||
+ update_burst_penalty(curr);
|
||||
+#endif // CONFIG_SCHED_BORE
|
||||
+ curr->vruntime += max(1ULL, calc_delta_fair(delta_exec, curr));
|
||||
update_deadline(cfs_rq, curr);
|
||||
update_min_vruntime(cfs_rq);
|
||||
|
||||
@@ -4926,7 +5077,11 @@ static inline void update_misfit_status(struct task_struct *p, struct rq *rq) {}
|
||||
static void
|
||||
place_entity(struct cfs_rq *cfs_rq, struct sched_entity *se, int flags)
|
||||
{
|
||||
+#ifdef CONFIG_SCHED_BORE
|
||||
+ u64 vslice = calc_delta_fair_debit(se->slice, se);
|
||||
+#else // CONFIG_SCHED_BORE
|
||||
u64 vslice = calc_delta_fair(se->slice, se);
|
||||
+#endif // CONFIG_SCHED_BORE
|
||||
u64 vruntime = avg_vruntime(cfs_rq);
|
||||
s64 lag = 0;
|
||||
|
||||
@@ -6482,6 +6637,9 @@ static void dequeue_task_fair(struct rq *rq, struct task_struct *p, int flags)
|
||||
util_est_dequeue(&rq->cfs, p);
|
||||
|
||||
for_each_sched_entity(se) {
|
||||
+#ifdef CONFIG_SCHED_BORE
|
||||
+ if (task_sleep) restart_burst(se);
|
||||
+#endif // CONFIG_SCHED_BORE
|
||||
cfs_rq = cfs_rq_of(se);
|
||||
dequeue_entity(cfs_rq, se, flags);
|
||||
|
||||
@@ -8206,8 +8364,12 @@ static void yield_task_fair(struct rq *rq)
|
||||
/*
|
||||
* Are we the only task in the tree?
|
||||
*/
|
||||
- if (unlikely(rq->nr_running == 1))
|
||||
+ if (unlikely(rq->nr_running == 1)) {
|
||||
+#ifdef CONFIG_SCHED_BORE
|
||||
+ restart_burst(se);
|
||||
+#endif // CONFIG_SCHED_BORE
|
||||
return;
|
||||
+ }
|
||||
|
||||
clear_buddies(cfs_rq, se);
|
||||
|
||||
@@ -8216,6 +8378,9 @@ static void yield_task_fair(struct rq *rq)
|
||||
* Update run-time statistics of the 'current'.
|
||||
*/
|
||||
update_curr(cfs_rq);
|
||||
+#ifdef CONFIG_SCHED_BORE
|
||||
+ restart_burst(se);
|
||||
+#endif // CONFIG_SCHED_BORE
|
||||
/*
|
||||
* Tell update_rq_clock() that we've just updated,
|
||||
* so we don't do microscopic update in schedule()
|
||||
--
|
||||
2.42.0
|
@ -0,0 +1,257 @@
|
||||
From 498e88ae626be4f523063c8a7027b4b02eca31d2 Mon Sep 17 00:00:00 2001
|
||||
From: GloriousEggroll <gloriouseggroll@gmail.com>
|
||||
Date: Tue, 17 Jan 2023 12:08:46 -0700
|
||||
Subject: [PATCH] Allow to set custom USB pollrate for specific devices like
|
||||
so: usbcore.interrupt_interval_override=045e:00db:16,1bcf:0005:1
|
||||
|
||||
---
|
||||
.../admin-guide/kernel-parameters.txt | 8 +
|
||||
drivers/usb/core/config.c | 170 +++++++++++++++++-
|
||||
drivers/usb/core/usb.c | 1 +
|
||||
drivers/usb/core/usb.h | 1 +
|
||||
4 files changed, 179 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt
|
||||
index dbd26fde4..c9b8b80af 100644
|
||||
--- a/Documentation/admin-guide/kernel-parameters.txt
|
||||
+++ b/Documentation/admin-guide/kernel-parameters.txt
|
||||
@@ -6552,6 +6552,14 @@
|
||||
delay after resetting its port);
|
||||
Example: quirks=0781:5580:bk,0a5c:5834:gij
|
||||
|
||||
+ usbcore.interrupt_interval_override=
|
||||
+ [USB] A list of USB devices for which a different polling
|
||||
+ interval than the default shall be used on all interrupt-type
|
||||
+ endpoints. The format is VendorID:ProductID:interval, with
|
||||
+ the vendor and product ids specified hexadecimally, and the
|
||||
+ interval decimally in milliseconds.
|
||||
+ Example: interrupt_interval_override=045e:00db:16,1bcf:0005:2
|
||||
+
|
||||
usbhid.mousepoll=
|
||||
[USBHID] The interval which mice are to be polled at.
|
||||
|
||||
diff --git a/drivers/usb/core/config.c b/drivers/usb/core/config.c
|
||||
index 48bc8a481..84bd550ad 100644
|
||||
--- a/drivers/usb/core/config.c
|
||||
+++ b/drivers/usb/core/config.c
|
||||
@@ -19,6 +19,149 @@
|
||||
#define USB_MAXCONFIG 8 /* Arbitrary limit */
|
||||
|
||||
|
||||
+/* A struct associated with the interrupt_interval_override module parameter, representing
|
||||
+ an user's choice to force a specific interrupt interval upon all interrupt endpoints of
|
||||
+ a certain device. */
|
||||
+struct interrupt_interval_override {
|
||||
+ /* The vendor ID of the device of which the interrupt interval shall be overridden */
|
||||
+ u16 vendor;
|
||||
+ /* The product ID of the device of which the interrupt interval shall be overridden */
|
||||
+ u16 product;
|
||||
+ /* The new interval measured in milliseconds that shall be given to all endpoints of type interrupt on said device */
|
||||
+ unsigned int interval;
|
||||
+};
|
||||
+
|
||||
+static DEFINE_MUTEX(interrupt_interval_override_mutex);
|
||||
+static char interrupt_interval_override_param[128];
|
||||
+static struct interrupt_interval_override *interrupt_interval_override_list = NULL;
|
||||
+static size_t interrupt_interval_override_count = 0;
|
||||
+
|
||||
+static int interrupt_interval_override_param_set(const char *value, const struct kernel_param *kp)
|
||||
+{
|
||||
+ const char *p;
|
||||
+ unsigned short vendor, product;
|
||||
+ unsigned int interval;
|
||||
+ struct interrupt_interval_override* list;
|
||||
+ struct interrupt_interval_override param;
|
||||
+ size_t count, max_count, i, len;
|
||||
+ int err, res;
|
||||
+
|
||||
+ mutex_lock(&interrupt_interval_override_mutex);
|
||||
+
|
||||
+ if (!value || !*value) {
|
||||
+ /* Unset the current variable. */
|
||||
+ kfree(interrupt_interval_override_list);
|
||||
+ interrupt_interval_override_list = NULL;
|
||||
+ interrupt_interval_override_count = 0;
|
||||
+ param_set_copystring(value, kp); /* Does not fail: the empty string is short enough to fit. */
|
||||
+ mutex_unlock(&interrupt_interval_override_mutex);
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ /* Compute an upper bound on the amount of entries we need. */
|
||||
+ for (max_count = 1, i = 0; value[i]; i++) {
|
||||
+ if (value[i] == ',')
|
||||
+ max_count++;
|
||||
+ }
|
||||
+
|
||||
+ /* Ensure we can allocate enough memory before overwriting the global variables. */
|
||||
+ list = kcalloc(max_count,
|
||||
+ sizeof(struct interrupt_interval_override),
|
||||
+ GFP_KERNEL);
|
||||
+
|
||||
+ if (!list) {
|
||||
+ mutex_unlock(&interrupt_interval_override_mutex);
|
||||
+ return -ENOMEM;
|
||||
+ }
|
||||
+
|
||||
+ err = param_set_copystring(value, kp);
|
||||
+ if (err) {
|
||||
+ kfree(list);
|
||||
+ mutex_unlock(&interrupt_interval_override_mutex);
|
||||
+ return err;
|
||||
+ }
|
||||
+
|
||||
+ /* Parse the parameter. Example of a valid parameter: 045e:00db:16,1bcf:0005:2 */
|
||||
+ for (count = 0, p = (const char*)value; p && *p;) {
|
||||
+ res = sscanf(p, "%hx:%hx:%d%zn", &vendor, &product, &interval, &len);
|
||||
+
|
||||
+ /* Check whether all variables (vendor, product, interval, len) were assigned.
|
||||
+ %zn does not increase the assignment count, so we need to check for value 3 instead of 4.
|
||||
+ %zn does not consume input either, so setting len shouldn't fail if interval has been properly set. */
|
||||
+ if (res != 3) {
|
||||
+ pr_warn("Error while parsing USB interrupt interval override parameter %s.\n", value);
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ param.vendor = (u16)vendor;
|
||||
+ param.product = (u16)product;
|
||||
+ param.interval = interval;
|
||||
+ list[count++] = param;
|
||||
+
|
||||
+ p += len;
|
||||
+ if (*p == ',' && *(p+1) != '\0') {
|
||||
+ p++;
|
||||
+ continue;
|
||||
+ } else if(*p == '\0' || (*p == '\n' && *(p+1) == '\0')) {
|
||||
+ break;
|
||||
+ } else {
|
||||
+ pr_warn("Error while parsing USB interrupt interval override parameter %s.\n", value);
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ /* Overwrite the global variables with the local ones. */
|
||||
+ kfree(interrupt_interval_override_list);
|
||||
+ interrupt_interval_override_list = list;
|
||||
+ interrupt_interval_override_count = count;
|
||||
+ mutex_unlock(&interrupt_interval_override_mutex);
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static const struct kernel_param_ops interrupt_interval_override_param_ops = {
|
||||
+ .set = interrupt_interval_override_param_set,
|
||||
+ .get = param_get_string,
|
||||
+};
|
||||
+
|
||||
+static struct kparam_string interrupt_interval_override_param_string = {
|
||||
+ .maxlen = sizeof(interrupt_interval_override_param),
|
||||
+ .string = interrupt_interval_override_param,
|
||||
+};
|
||||
+
|
||||
+device_param_cb(interrupt_interval_override,
|
||||
+ &interrupt_interval_override_param_ops,
|
||||
+ &interrupt_interval_override_param_string,
|
||||
+ 0644);
|
||||
+MODULE_PARM_DESC(interrupt_interval_override,
|
||||
+ "Override the polling interval of all interrupt-type endpoints of a specific USB"
|
||||
+ " device by specifying interrupt_interval_override=vendorID:productID:interval.");
|
||||
+
|
||||
+/* Given an USB device, this checks whether the user has specified they want to override the interrupt
|
||||
+ polling interval on all interrupt-type endpoints of said device.
|
||||
+
|
||||
+ This function returns the user-desired amount of milliseconds between interrupts on said endpoint.
|
||||
+ If this function returns zero, the device-requested interrupt interval should be used. */
|
||||
+static unsigned int usb_check_interrupt_interval_override(struct usb_device* udev)
|
||||
+{
|
||||
+ size_t i;
|
||||
+ unsigned int res;
|
||||
+ u16 vendor = le16_to_cpu(udev->descriptor.idVendor);
|
||||
+ u16 product = le16_to_cpu(udev->descriptor.idProduct);
|
||||
+
|
||||
+ mutex_lock(&interrupt_interval_override_mutex);
|
||||
+ for (i = 0; i < interrupt_interval_override_count; i++) {
|
||||
+ if (interrupt_interval_override_list[i].vendor == vendor
|
||||
+ && interrupt_interval_override_list[i].product == product) {
|
||||
+
|
||||
+ res = interrupt_interval_override_list[i].interval;
|
||||
+ mutex_unlock(&interrupt_interval_override_mutex);
|
||||
+ return res;
|
||||
+ }
|
||||
+ }
|
||||
+ mutex_unlock(&interrupt_interval_override_mutex);
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
static inline const char *plural(int n)
|
||||
{
|
||||
return (n == 1 ? "" : "s");
|
||||
@@ -261,7 +404,7 @@ static int usb_parse_endpoint(struct device *ddev, int cfgno,
|
||||
struct usb_endpoint_descriptor *d;
|
||||
struct usb_host_endpoint *endpoint;
|
||||
int n, i, j, retval;
|
||||
- unsigned int maxp;
|
||||
+ unsigned int maxp, ival;
|
||||
const unsigned short *maxpacket_maxes;
|
||||
|
||||
d = (struct usb_endpoint_descriptor *) buffer;
|
||||
@@ -386,6 +529,23 @@ static int usb_parse_endpoint(struct device *ddev, int cfgno,
|
||||
endpoint->desc.bInterval = n;
|
||||
}
|
||||
|
||||
+ /* Override the interrupt polling interval if a module parameter tells us to do so. */
|
||||
+ if (usb_endpoint_xfer_int(d)) {
|
||||
+ ival = usb_check_interrupt_interval_override(udev);
|
||||
+ if (ival > 0) {
|
||||
+ switch (udev->speed) {
|
||||
+ case USB_SPEED_SUPER_PLUS:
|
||||
+ case USB_SPEED_SUPER:
|
||||
+ case USB_SPEED_HIGH:
|
||||
+ endpoint->desc.bInterval = fls(ival) + 3;
|
||||
+ break;
|
||||
+ default: /* USB_SPEED_FULL or _LOW */
|
||||
+ endpoint->desc.bInterval = ival;
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
/* Some buggy low-speed devices have Bulk endpoints, which is
|
||||
* explicitly forbidden by the USB spec. In an attempt to make
|
||||
* them usable, we will try treating them as Interrupt endpoints.
|
||||
@@ -1092,3 +1252,11 @@ int usb_get_bos_descriptor(struct usb_device *dev)
|
||||
usb_release_bos_descriptor(dev);
|
||||
return ret;
|
||||
}
|
||||
+
|
||||
+void usb_release_interrupt_interval_override_list(void)
|
||||
+{
|
||||
+ mutex_lock(&interrupt_interval_override_mutex);
|
||||
+ kfree(interrupt_interval_override_list);
|
||||
+ interrupt_interval_override_list = NULL;
|
||||
+ mutex_unlock(&interrupt_interval_override_mutex);
|
||||
+}
|
||||
diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c
|
||||
index 11b15d7b3..ec52c6322 100644
|
||||
--- a/drivers/usb/core/usb.c
|
||||
+++ b/drivers/usb/core/usb.c
|
||||
@@ -1066,6 +1066,7 @@ static void __exit usb_exit(void)
|
||||
return;
|
||||
|
||||
usb_release_quirk_list();
|
||||
+ usb_release_interrupt_interval_override_list();
|
||||
usb_deregister_device_driver(&usb_generic_driver);
|
||||
usb_major_cleanup();
|
||||
usb_deregister(&usbfs_driver);
|
||||
diff --git a/drivers/usb/core/usb.h b/drivers/usb/core/usb.h
|
||||
index 82538daac..b6faa897c 100644
|
||||
--- a/drivers/usb/core/usb.h
|
||||
+++ b/drivers/usb/core/usb.h
|
||||
@@ -37,6 +37,7 @@ extern void usb_authorize_interface(struct usb_interface *);
|
||||
extern void usb_detect_quirks(struct usb_device *udev);
|
||||
extern void usb_detect_interface_quirks(struct usb_device *udev);
|
||||
extern void usb_release_quirk_list(void);
|
||||
+extern void usb_release_interrupt_interval_override_list(void);
|
||||
extern bool usb_endpoint_is_ignored(struct usb_device *udev,
|
||||
struct usb_host_interface *intf,
|
||||
struct usb_endpoint_descriptor *epd);
|
||||
--
|
||||
2.39.0
|
78
patches/0005-amdgpu-si-cik-default.patch
Normal file
78
patches/0005-amdgpu-si-cik-default.patch
Normal file
@ -0,0 +1,78 @@
|
||||
From e55f6f53ab572901f826fb66d385eaa7d1210bb5 Mon Sep 17 00:00:00 2001
|
||||
From: Jan200101 <sentrycraft123@gmail.com>
|
||||
Date: Tue, 22 Mar 2022 17:52:14 +0100
|
||||
Subject: [PATCH] drm/amdgpu: enable SI and CIK support by default
|
||||
|
||||
Signed-off-by: Jan200101 <sentrycraft123@gmail.com>
|
||||
---
|
||||
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 14 ++------------
|
||||
drivers/gpu/drm/radeon/radeon_drv.c | 10 ++++++++++
|
||||
2 files changed, 12 insertions(+), 12 deletions(-)
|
||||
|
||||
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
|
||||
index 0ead08ba58c2..95a59d203922 100644
|
||||
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
|
||||
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
|
||||
@@ -575,15 +575,10 @@ module_param_named(timeout_period, amdgpu_watchdog_timer.period, uint, 0644);
|
||||
*/
|
||||
#ifdef CONFIG_DRM_AMDGPU_SI
|
||||
|
||||
-#if defined(CONFIG_DRM_RADEON) || defined(CONFIG_DRM_RADEON_MODULE)
|
||||
-int amdgpu_si_support = 0;
|
||||
-MODULE_PARM_DESC(si_support, "SI support (1 = enabled, 0 = disabled (default))");
|
||||
-#else
|
||||
int amdgpu_si_support = 1;
|
||||
MODULE_PARM_DESC(si_support, "SI support (1 = enabled (default), 0 = disabled)");
|
||||
-#endif
|
||||
-
|
||||
module_param_named(si_support, amdgpu_si_support, int, 0444);
|
||||
+
|
||||
#endif
|
||||
|
||||
/**
|
||||
@@ -594,15 +589,10 @@ module_param_named(si_support, amdgpu_si_support, int, 0444);
|
||||
*/
|
||||
#ifdef CONFIG_DRM_AMDGPU_CIK
|
||||
|
||||
-#if defined(CONFIG_DRM_RADEON) || defined(CONFIG_DRM_RADEON_MODULE)
|
||||
-int amdgpu_cik_support = 0;
|
||||
-MODULE_PARM_DESC(cik_support, "CIK support (1 = enabled, 0 = disabled (default))");
|
||||
-#else
|
||||
int amdgpu_cik_support = 1;
|
||||
MODULE_PARM_DESC(cik_support, "CIK support (1 = enabled (default), 0 = disabled)");
|
||||
-#endif
|
||||
-
|
||||
module_param_named(cik_support, amdgpu_cik_support, int, 0444);
|
||||
+
|
||||
#endif
|
||||
|
||||
/**
|
||||
diff --git a/drivers/gpu/drm/radeon/radeon_drv.c b/drivers/gpu/drm/radeon/radeon_drv.c
|
||||
index 956c72b5aa33..5102711ece53 100644
|
||||
--- a/drivers/gpu/drm/radeon/radeon_drv.c
|
||||
+++ b/drivers/gpu/drm/radeon/radeon_drv.c
|
||||
@@ -272,12 +272,22 @@ module_param_named(uvd, radeon_uvd, int, 0444);
|
||||
MODULE_PARM_DESC(vce, "vce enable/disable vce support (1 = enable, 0 = disable)");
|
||||
module_param_named(vce, radeon_vce, int, 0444);
|
||||
|
||||
+#ifdef CONFIG_DRM_AMDGPU_SI
|
||||
+int radeon_si_support = 0;
|
||||
+MODULE_PARM_DESC(si_support, "SI support (1 = enabled, 0 = disabled (default))");
|
||||
+#else
|
||||
int radeon_si_support = 1;
|
||||
MODULE_PARM_DESC(si_support, "SI support (1 = enabled (default), 0 = disabled)");
|
||||
+#endif
|
||||
module_param_named(si_support, radeon_si_support, int, 0444);
|
||||
|
||||
+#ifdef CONFIG_DRM_AMDGPU_CIK
|
||||
+int radeon_cik_support = 0;
|
||||
+MODULE_PARM_DESC(cik_support, "CIK support (1 = enabled, 0 = disabled (default))");
|
||||
+#else
|
||||
int radeon_cik_support = 1;
|
||||
MODULE_PARM_DESC(cik_support, "CIK support (1 = enabled (default), 0 = disabled)");
|
||||
+#endif
|
||||
module_param_named(cik_support, radeon_cik_support, int, 0444);
|
||||
|
||||
static struct pci_device_id pciidlist[] = {
|
||||
--
|
||||
2.35.1
|
@ -1,2 +1,8 @@
|
||||
# send debs to server
|
||||
rsync -azP --include './' --include '*.deb' --exclude '*' ./output/ ferreo@direct.pika-os.com:/srv/www/cockatiel-incoming/
|
||||
rsync -azP --include './' --include '*.deb' --exclude '*' ./output/ ferreo@direct.pika-os.com:/srv/www/incoming/
|
||||
|
||||
# add debs to repo
|
||||
ssh ferreo@direct.pika-os.com 'aptly repo add -force-replace -remove-files pika-main /srv/www/incoming/'
|
||||
|
||||
# publish the repo
|
||||
ssh ferreo@direct.pika-os.com 'aptly publish update -batch -skip-contents -force-overwrite lunar filesystem:pikarepo:'
|
||||
|
@ -2,4 +2,4 @@
|
||||
|
||||
echo "Pika Kernel - Building"
|
||||
|
||||
make -j`nproc` bindeb-pkg LOCALVERSION=-pikaos KDEB_PKGVERSION=$(make kernelversion)-101pika2
|
||||
make -j`nproc` bindeb-pkg LOCALVERSION=-pikaos KDEB_PKGVERSION=$(make kernelversion)-4
|
||||
|
@ -4,12 +4,11 @@ echo "Pika Kernel - Applying configuration"
|
||||
|
||||
cp ../config .config
|
||||
|
||||
scripts/config -k -d CONFIG_GENERIC_CPU
|
||||
scripts/config -k -e CONFIG_GENERIC_CPU3
|
||||
scripts/config -k -e CONFIG_GENERIC_CPU
|
||||
scripts/config -e CACHY
|
||||
scripts/config -e SCHED_BORE
|
||||
|
||||
scripts/config -e HZ_300 --set-val HZ 750
|
||||
scripts/config -e HZ_300 --set-val HZ 500
|
||||
scripts/config -d HZ_PERIODIC -d NO_HZ_IDLE -d CONTEXT_TRACKING_FORCE -e NO_HZ_FULL_NODEF -e NO_HZ_FULL -e NO_HZ -e NO_HZ_COMMON -e CONTEXT_TRACKING
|
||||
scripts/config -e PREEMPT_BUILD -d PREEMPT_NONE -d PREEMPT_VOLUNTARY -e PREEMPT -e PREEMPT_COUNT -e PREEMPTION -e PREEMPT_DYNAMIC
|
||||
|
||||
@ -28,8 +27,6 @@ scripts/config -m NET_SCH_FQ_CODEL \
|
||||
-e DEFAULT_FQ \
|
||||
--set-str DEFAULT_NET_SCH fq
|
||||
|
||||
scripts/config -e SCHED_CLASS_EXT
|
||||
|
||||
scripts/config -e LRU_GEN -e LRU_GEN_ENABLED -d LRU_GEN_STATS
|
||||
|
||||
scripts/config -d TRANSPARENT_HUGEPAGE_MADVISE -e TRANSPARENT_HUGEPAGE_ALWAYS
|
||||
@ -50,4 +47,19 @@ scripts/config -e EFI_HANDOVER_PROTOCOL
|
||||
|
||||
scripts/config -e USER_NS
|
||||
|
||||
scripts/config -d DEBUG_INFO \
|
||||
-d DEBUG_INFO_BTF \
|
||||
-d DEBUG_INFO_DWARF4 \
|
||||
-d DEBUG_INFO_DWARF5 \
|
||||
-d PAHOLE_HAS_SPLIT_BTF \
|
||||
-d DEBUG_INFO_BTF_MODULES \
|
||||
-d SLUB_DEBUG \
|
||||
-d PM_DEBUG \
|
||||
-d PM_ADVANCED_DEBUG \
|
||||
-d PM_SLEEP_DEBUG \
|
||||
-d ACPI_DEBUG \
|
||||
-d SCHED_DEBUG \
|
||||
-d LATENCYTOP \
|
||||
-d DEBUG_PREEMPT
|
||||
|
||||
make prepare
|
||||
|
@ -7,5 +7,5 @@ rm ./linux-libc*.deb
|
||||
|
||||
for f in *.deb;
|
||||
do
|
||||
cp $f ./output/$f
|
||||
cp $f ./output/lunar_$f
|
||||
done
|
||||
|
@ -2,7 +2,15 @@
|
||||
|
||||
echo "Pika Kernel - Applying patches"
|
||||
|
||||
if [ -f ../patches/series ]
|
||||
then
|
||||
for i in $(cat ../patches/series | grep -v '^#') ; do echo "Applying Patch: $i" && patch -Np1 -i ../patches/$i || bash -c "echo "Applying Patch $i Failed!" && exit 2"; done
|
||||
fi
|
||||
# Cachy patches are here: https://github.com/CachyOS/kernel-patches/
|
||||
# orig patch from cachy - 0001-cachyos-base-all.patch
|
||||
patch -Np1 < "../patches/0001-cachy-all.patch"
|
||||
# orig patch from cachy
|
||||
patch -Np1 < "../patches/0002-eevdf.patch"
|
||||
# orig patch from cachy
|
||||
patch -Np1 < "../patches/0002-eevdfbore.patch"
|
||||
# Nobara patches are here: https://github.com/sammilucia/nobara-kernel-fork
|
||||
# Allow setting custom pollrates for usb devices
|
||||
patch -Np1 < "../patches/0004-Allow-to-set-custom-USB-pollrate-for-specific-device.patch"
|
||||
# Allow pre polaris cards to use the amdgpu kernel module
|
||||
patch -Np1 < "../patches/0005-amdgpu-si-cik-default.patch"
|
@ -2,7 +2,7 @@
|
||||
|
||||
echo "Pika Kernel - Getting source"
|
||||
|
||||
wget -nv https://cdn.kernel.org/pub/linux/kernel/v"$(echo $(cat ./VERSION) | cut -f1 -d".")".x/linux-"$(cat ./VERSION)".tar.gz
|
||||
tar -xf ./linux-"$(cat ./VERSION)".tar.gz
|
||||
wget -nv https://cdn.kernel.org/pub/linux/kernel/v6.x/linux-6.5.5.tar.gz
|
||||
tar -xf ./linux-6.5.5.tar.gz
|
||||
|
||||
cd linux-"$(cat ./VERSION)"
|
||||
cd linux-6.5.5
|
||||
|
Loading…
Reference in New Issue
Block a user