Re: [linux-yocto][v5.10/standard/base && v5.10/standard/preempt-rt/base][PATCH 1/2] blk-mq: Introduce the BLK_MQ_F_NO_SCHED_BY_DEFAULT flag

2024-03-13 Thread Wentao Zhang via lists.yoctoproject.org
832a4d4cdb3f612d5079aadcc67a44f18fa7b5b7 
 
in 5.10 did the patch back from 2112f5c1330a671fa852051d85cb9eadc05d7eb7 
 
in upstream.


2112f5c1330a671fa852051d85cb9eadc05d7eb7 
 
add BLK_MQ_F_NO_SCHED_BY_DEFAULT to tag_set.flags in loop device in the 
upstream, but


832a4d4cdb3f612d5079aadcc67a44f18fa7b5b7 
 
add  BLK_MQ_F_NO_SCHED  to tag_set.flags in loop 
device in the 5.10.


this backport cause elv_support_iosched return false, then loop device 
get no scheduler. As shown in the following record:


   root@intel-x86-64:~# cat /sys/block/sda/queue/scheduler
   [mq-deadline] kyber bfq none
   root@intel-x86-64:~# cat /sys/block/loop2/queue/scheduler
   [none]

To solve this problem, we can backport the patch from upstream 
correctly, or revert 832a4d4cdb3f612d5079aadcc67a44f18fa7b5b7 
.


The loop device gets schedulers after applying the patch I submitted.
I did the test in intel-x86-64 with linux-yocto, qemux86-64 
with linux-yocto and qemux86-64 with linux-yocto-rt.

The test steps includes boot and "cat /sys/block/loop*/queue/scheduler".

On 2024-03-13 10:59, Bruce Ashfield wrote:

CAUTION: This email comes from a non Wind River email account!
Do not click links or open attachments unless you recognize the sender and know 
the content is safe.

Since this is requested for the common branches and
hence all BSPs (This is the right place for a patch
like this) ... can you provide some extra context
about how they were identified (and tested).

Similar to my earlier comment, these in theory should
be nominated for -stable.

Bruce

In message: [linux-yocto][v5.10/standard/base && 
v5.10/standard/preempt-rt/base][PATCH  1/2]  blk-mq: Introduce the 
BLK_MQ_F_NO_SCHED_BY_DEFAULT flag
on 12/03/2024 Wentao Zhang wrote:


From: Bart Van Assche

commit 90b7198001f23ea37d3b46dc631bdaa2357a20b1 upstream.

elevator_get_default() uses the following algorithm to select an I/O
scheduler from inside add_disk():
- In case of a single hardware queue or if sharing hardware queues across
   multiple request queues (BLK_MQ_F_TAG_HCTX_SHARED), use mq-deadline.
- Otherwise, use 'none'.

This is a good choice for most but not for all block drivers. Make it
possible to override the selection of mq-deadline with a new flag,
namely BLK_MQ_F_NO_SCHED_BY_DEFAULT.

Cc: Christoph Hellwig
Cc: Ming Lei
Cc: Tetsuo Handa
Cc: Martijn Coenen
Cc: Jaegeuk Kim
Signed-off-by: Bart Van Assche
Link:https://lore.kernel.org/r/20210805174200.3250718-2-bvanass...@acm.org
Signed-off-by: Jens Axboe
Signed-off-by: Wentao Zhang
---
  block/elevator.c   | 3 +++
  include/linux/blk-mq.h | 6 ++
  2 files changed, 9 insertions(+)

diff --git a/block/elevator.c b/block/elevator.c
index 2f962662c32a..f762b2af1d2a 100644
--- a/block/elevator.c
+++ b/block/elevator.c
@@ -622,6 +622,9 @@ static inline bool elv_support_iosched(struct request_queue 
*q)
   */
  static struct elevator_type *elevator_get_default(struct request_queue *q)
  {
+ if (q->tag_set && q->tag_set->flags & BLK_MQ_F_NO_SCHED_BY_DEFAULT)
+ return NULL;
+
   if (q->nr_hw_queues != 1)
   return NULL;

diff --git a/include/linux/blk-mq.h b/include/linux/blk-mq.h
index f8ea27423d1d..39526279fbd3 100644
--- a/include/linux/blk-mq.h
+++ b/include/linux/blk-mq.h
@@ -398,7 +398,13 @@ enum {
   BLK_MQ_F_STACKING   = 1 << 2,
   BLK_MQ_F_TAG_HCTX_SHARED = 1 << 3,
   BLK_MQ_F_BLOCKING   = 1 << 5,
+ /* Do not allow an I/O scheduler to be configured. */
   BLK_MQ_F_NO_SCHED   = 1 << 6,
+ /*
+  * Select 'none' during queue registration in case of a single hwq
+  * or shared hwqs instead of 'mq-deadline'.
+  */
+ BLK_MQ_F_NO_SCHED_BY_DEFAULT= 1 << 7,
   BLK_MQ_F_ALLOC_POLICY_START_BIT = 8,
   BLK_MQ_F_ALLOC_POLICY_BITS = 1,

--
2.31.1


--

☮ Wentao Zhang
☮ Wind River Linux


-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#13679): 
https://lists.yoctoproject.org/g/linux-yocto/message/13679
Mute This Topic: https://lists.yoctoproject.org/mt/104880299/21656
Group Owner: linux-yocto+ow...@lists.yoctoproject.org
Unsubscribe: https://lists.yoctoproject.org/g/linux-yocto/unsub 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[linux-yocto][v5.10/standard/base && v5.10/standard/preempt-rt/base][PATCH 2/2] loop: Select I/O scheduler 'none' from inside add_disk()

2024-03-12 Thread Wentao Zhang via lists.yoctoproject.org
From: Bart Van Assche 

commit 2112f5c1330a671fa852051d85cb9eadc05d7eb7 upstream.

We noticed that the user interface of Android devices becomes very slow
under memory pressure. This is because Android uses the zram driver on top
of the loop driver for swapping, because under memory pressure the swap
code alternates reads and writes quickly, because mq-deadline is the
default scheduler for loop devices and because mq-deadline delays writes by
five seconds for such a workload with default settings. Fix this by making
the kernel select I/O scheduler 'none' from inside add_disk() for loop
devices. This default can be overridden at any time from user space,
e.g. via a udev rule. This approach has an advantage compared to changing
the I/O scheduler from userspace from 'mq-deadline' into 'none', namely
that synchronize_rcu() does not get called.

This patch changes the default I/O scheduler for loop devices from
'mq-deadline' into 'none'.

Additionally, this patch reduces the Android boot time on my test setup
with 0.5 seconds compared to configuring the loop I/O scheduler from user
space.

Cc: Christoph Hellwig 
Cc: Ming Lei 
Cc: Tetsuo Handa 
Cc: Martijn Coenen 
Cc: Jaegeuk Kim 
Signed-off-by: Bart Van Assche 
Link: https://lore.kernel.org/r/20210805174200.3250718-3-bvanass...@acm.org
Signed-off-by: Jens Axboe 
Signed-off-by: Wentao Zhang 
---
 drivers/block/loop.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/block/loop.c b/drivers/block/loop.c
index 0cdeeb0c5ece..ad3f06d5e986 100644
--- a/drivers/block/loop.c
+++ b/drivers/block/loop.c
@@ -2128,7 +2128,7 @@ static int loop_add(struct loop_device **l, int i)
lo->tag_set.numa_node = NUMA_NO_NODE;
lo->tag_set.cmd_size = sizeof(struct loop_cmd);
lo->tag_set.flags = BLK_MQ_F_SHOULD_MERGE | BLK_MQ_F_STACKING |
-   BLK_MQ_F_NO_SCHED;
+   BLK_MQ_F_NO_SCHED_BY_DEFAULT;
lo->tag_set.driver_data = lo;
 
err = blk_mq_alloc_tag_set(>tag_set);
-- 
2.31.1


-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#13670): 
https://lists.yoctoproject.org/g/linux-yocto/message/13670
Mute This Topic: https://lists.yoctoproject.org/mt/104880302/21656
Group Owner: linux-yocto+ow...@lists.yoctoproject.org
Unsubscribe: https://lists.yoctoproject.org/g/linux-yocto/unsub 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[linux-yocto][v5.10/standard/base && v5.10/standard/preempt-rt/base][PATCH 1/2] blk-mq: Introduce the BLK_MQ_F_NO_SCHED_BY_DEFAULT flag

2024-03-12 Thread Wentao Zhang via lists.yoctoproject.org
From: Bart Van Assche 

commit 90b7198001f23ea37d3b46dc631bdaa2357a20b1 upstream.

elevator_get_default() uses the following algorithm to select an I/O
scheduler from inside add_disk():
- In case of a single hardware queue or if sharing hardware queues across
  multiple request queues (BLK_MQ_F_TAG_HCTX_SHARED), use mq-deadline.
- Otherwise, use 'none'.

This is a good choice for most but not for all block drivers. Make it
possible to override the selection of mq-deadline with a new flag,
namely BLK_MQ_F_NO_SCHED_BY_DEFAULT.

Cc: Christoph Hellwig 
Cc: Ming Lei 
Cc: Tetsuo Handa 
Cc: Martijn Coenen 
Cc: Jaegeuk Kim 
Signed-off-by: Bart Van Assche 
Link: https://lore.kernel.org/r/20210805174200.3250718-2-bvanass...@acm.org
Signed-off-by: Jens Axboe 
Signed-off-by: Wentao Zhang 
---
 block/elevator.c   | 3 +++
 include/linux/blk-mq.h | 6 ++
 2 files changed, 9 insertions(+)

diff --git a/block/elevator.c b/block/elevator.c
index 2f962662c32a..f762b2af1d2a 100644
--- a/block/elevator.c
+++ b/block/elevator.c
@@ -622,6 +622,9 @@ static inline bool elv_support_iosched(struct request_queue 
*q)
  */
 static struct elevator_type *elevator_get_default(struct request_queue *q)
 {
+   if (q->tag_set && q->tag_set->flags & BLK_MQ_F_NO_SCHED_BY_DEFAULT)
+   return NULL;
+
if (q->nr_hw_queues != 1)
return NULL;
 
diff --git a/include/linux/blk-mq.h b/include/linux/blk-mq.h
index f8ea27423d1d..39526279fbd3 100644
--- a/include/linux/blk-mq.h
+++ b/include/linux/blk-mq.h
@@ -398,7 +398,13 @@ enum {
BLK_MQ_F_STACKING   = 1 << 2,
BLK_MQ_F_TAG_HCTX_SHARED = 1 << 3,
BLK_MQ_F_BLOCKING   = 1 << 5,
+   /* Do not allow an I/O scheduler to be configured. */
BLK_MQ_F_NO_SCHED   = 1 << 6,
+   /*
+* Select 'none' during queue registration in case of a single hwq
+* or shared hwqs instead of 'mq-deadline'.
+*/
+   BLK_MQ_F_NO_SCHED_BY_DEFAULT= 1 << 7,
BLK_MQ_F_ALLOC_POLICY_START_BIT = 8,
BLK_MQ_F_ALLOC_POLICY_BITS = 1,
 
-- 
2.31.1


-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#13669): 
https://lists.yoctoproject.org/g/linux-yocto/message/13669
Mute This Topic: https://lists.yoctoproject.org/mt/104880299/21656
Group Owner: linux-yocto+ow...@lists.yoctoproject.org
Unsubscribe: https://lists.yoctoproject.org/g/linux-yocto/unsub 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[linux-yocto] [PATCH] debug: move BTF to a separate fragment

2023-09-04 Thread Wentao Zhang via lists.yoctoproject.org
From: Bruce Ashfield 

pahole doesn't support all architectures or kernel versions. As such
we don't want config_btf to be enabled for all debug kernels.

Moving it to a separate fragment so it can be enabled only when
needed.

Signed-off-by: Bruce Ashfield 
(cherry picked from commit 77e7265c29fc238d1ecd43b47891bb5108c36da2)
Signed-off-by: Wentao Zhang 
---
 features/debug/debug-btf.cfg | 2 ++
 features/debug/debug-btf.scc | 6 ++
 2 files changed, 8 insertions(+)
 create mode 100644 features/debug/debug-btf.cfg
 create mode 100644 features/debug/debug-btf.scc

diff --git a/features/debug/debug-btf.cfg b/features/debug/debug-btf.cfg
new file mode 100644
index ..61815776
--- /dev/null
+++ b/features/debug/debug-btf.cfg
@@ -0,0 +1,2 @@
+# SPDX-License-Identifier: MIT
+CONFIG_DEBUG_INFO_BTF=y
diff --git a/features/debug/debug-btf.scc b/features/debug/debug-btf.scc
new file mode 100644
index ..57dfb930
--- /dev/null
+++ b/features/debug/debug-btf.scc
@@ -0,0 +1,6 @@
+# SPDX-License-Identifier: MIT
+define KFEATURE_DESCRIPTION "Enable BTF debug"
+define KFEATURE_COMPATIBILITY all
+
+include debug-kernel.scc
+kconf non-hardware debug-btf.cfg
-- 
2.25.1


-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#13035): 
https://lists.yoctoproject.org/g/linux-yocto/message/13035
Mute This Topic: https://lists.yoctoproject.org/mt/101161974/21656
Group Owner: linux-yocto+ow...@lists.yoctoproject.org
Unsubscribe: https://lists.yoctoproject.org/g/linux-yocto/unsub 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[linux-yocto] [yocto-kernel-cache yocto-5.15]: moving the config of debug kernels to a separate fragment

2023-09-04 Thread Wentao Zhang via lists.yoctoproject.org
Hi Bruce,

There is one patch to Moving the config of debug kernels to a separate fragment

Would you please help to merge the patch to yocto-5.15 branch?

Thanks,
Wentao

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#13034): 
https://lists.yoctoproject.org/g/linux-yocto/message/13034
Mute This Topic: https://lists.yoctoproject.org/mt/101161973/21656
Group Owner: linux-yocto+ow...@lists.yoctoproject.org
Unsubscribe: https://lists.yoctoproject.org/g/linux-yocto/unsub 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-