um: Misc cleanups
Subsystems (2)
cover um: Misc cleanups
From: Tiwei Bie <[email protected]>
Tiwei Bie (7):
um: Add missing trailing newline to help messages
um: vector: Fix indentation for help message
um: Fix help message for ssl-non-raw
um: Indent time-travel help messages
um: Remove unused offset and child_err fields from stub_data
um: Remove outdated comment about STUB_DATA_PAGES
um: Centralize stub size calculations
arch/um/drivers/ssl.c | 5 +++- arch/um/drivers/ubd_kern.c | 2 +- arch/um/drivers/vector_kern.c | 2 +- arch/um/include/shared/as-layout.h | 5 ++-- arch/um/include/shared/skas/stub-data.h | 3 +- arch/um/kernel/dtb.c | 2 +- arch/um/kernel/time.c | 37 +++++++++++++------------ arch/um/kernel/um_arch.c | 4 +-- arch/um/os-Linux/skas/process.c | 2 +- arch/x86/um/shared/sysdep/stub_32.h | 2 +- arch/x86/um/shared/sysdep/stub_64.h | 2 +- 11 files changed, 34 insertions(+), 32 deletions(-)
Signature · 1 line
2.34.1
PATCH 1/7 um: Add missing trailing newline to help messages
From: Tiwei Bie <[email protected]>
Some help messages are missing a trailing newline. They should end with two newlines, but only one is present. Add the missing newline to make the --help output more readable.
--- arch/um/drivers/ubd_kern.c | 2 +- arch/um/kernel/dtb.c | 2 +- arch/um/kernel/time.c | 5 +++-- arch/um/os-Linux/skas/process.c | 2 +- 4 files changed, 6 insertions(+), 5 deletions(-)
arch/um/drivers/ubd_kern.c +1 -1
@@ -370,7 +370,7 @@ __uml_help(ubd_setup," useful when a unique number should be given to the device. Note when\n" " specifying a label, the filename2 must be also presented. It can be\n" " an empty string, in which case the backing file is not used:\n" -" ubd0=File,,Serial\n" +" ubd0=File,,Serial\n\n" );static int udb_setup (char *str)
arch/um/kernel/dtb.c +1 -1
@@ -38,5 +38,5 @@ static int __init uml_dtb_setup(char *line, int *add)__uml_setup ("dtb=" , uml_dtb_setup,"dtb=<file>\n" -" Boot the kernel with the devicetree blob from the specified file.\n" +" Boot the kernel with the devicetree blob from the specified file.\n\n" );
arch/um/kernel/time.c +3 -2
@@ -1005,7 +1005,7 @@ __uml_help(setup_time_travel,"have more than one system simultaneously be on simulated time. The virtio\n" "driver code in UML knows about this so you can also simulate networks and\n" "devices using it, assuming the device has the right capabilities.\n" -"The optional ID is a 64-bit integer that's sent to the central scheduler.\n"); +"The optional ID is a 64-bit integer that's sent to the central scheduler.\n\n");static int setup_time_travel_start (char *str) {
@@ -1023,7 +1023,8 @@ __setup("time-travel-start=", setup_time_travel_start);__uml_help (setup_time_travel_start,"time-travel-start=<nanoseconds>\n" "Configure the UML instance's wall clock to start at this value rather than\n" -"the host's wall clock at the time of UML boot.\n" ); +"the host's wall clock at the time of UML boot.\n\n" ); +static struct kobject *bc_time_kobject;static ssize_t bc_show (struct kobject *kobj,struct kobj_attribute *attr,char *buf)
arch/um/os-Linux/skas/process.c +1 -1
@@ -895,7 +895,7 @@ __uml_setup("noreboot", noreboot_cmd_param,"noreboot\n" " Rather than rebooting, exit always, akin to QEMU's -no-reboot option.\n" " This is useful if you're using CONFIG_PANIC_TIMEOUT in order to catch\n" -" crashes in CI\n"); +" crashes in CI\n\n");void reboot_skas (void ) {
Signature · 1 line
2.34.1
PATCH 2/7 um: vector: Fix indentation for help message
In reply to Tiwei BieFrom: Tiwei Bie <[email protected]>
As with other help messages, use four spaces instead of a single tab for indentation.
--- arch/um/drivers/vector_kern.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/um/drivers/vector_kern.c +1 -1
@@ -1721,7 +1721,7 @@ static int __init vector_setup(char *str)__setup ("vec" , vector_setup);__uml_help (vector_setup,"vec[0-9]+:<option>=<value>,<option>=<value>\n" -" Configure a vector io network device.\n\n" +" Configure a vector io network device.\n\n" );late_initcall (vector_init);
Signature · 1 line
2.34.1
PATCH 3/7 um: Fix help message for ssl-non-raw
In reply to Tiwei BieFrom: Tiwei Bie <[email protected]>
Add the missing option name in the help message. Additionally, switch to __uml_help(), because this is a global option rather than a per-channel option.
--- arch/um/drivers/ssl.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
arch/um/drivers/ssl.c +4 -1
@@ -199,4 +199,7 @@ static int ssl_non_raw_setup(char *str)return 1 ; }__setup ("ssl-non-raw" , ssl_non_raw_setup); -__channel_help (ssl_non_raw_setup,"set serial lines to non-raw mode" ); +__uml_help (ssl_non_raw_setup, +"ssl-non-raw\n" +" Set serial lines to non-raw mode.\n\n" +);
Signature · 1 line
2.34.1
PATCH 4/7 um: Indent time-travel help messages
In reply to Tiwei BieFrom: Tiwei Bie <[email protected]>
Indent the help messages for time-travel to make them consistent with the format of other help messages.
--- arch/um/kernel/time.c | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-)
arch/um/kernel/time.c +18 -18
@@ -986,26 +986,26 @@ static int setup_time_travel(char *str)__setup ("time-travel" , setup_time_travel);__uml_help (setup_time_travel,"time-travel\n" -"This option just enables basic time travel mode, in which the clock/timers\n" -"inside the UML instance skip forward when there's nothing to do, rather than\n" -"waiting for real time to elapse. However, instance CPU speed is limited by\n" -"the real CPU speed, so e.g. a 10ms timer will always fire after ~10ms wall\n" -"clock (but quicker when there's nothing to do).\n" +" This option just enables basic time travel mode, in which the clock/timers\n" +" inside the UML instance skip forward when there's nothing to do, rather than\n" +" waiting for real time to elapse. However, instance CPU speed is limited by\n" +" the real CPU speed, so e.g. a 10ms timer will always fire after ~10ms wall\n" +" clock (but quicker when there's nothing to do).\n" "\n" "time-travel=inf-cpu\n" -"This enables time travel mode with infinite processing power, in which there\n" -"are no wall clock timers, and any CPU processing happens - as seen from the\n" -"guest - instantly. This can be useful for accurate simulation regardless of\n" -"debug overhead, physical CPU speed, etc. but is somewhat dangerous as it can\n" -"easily lead to getting stuck (e.g. if anything in the system busy loops).\n" +" This enables time travel mode with infinite processing power, in which there\n" +" are no wall clock timers, and any CPU processing happens - as seen from the\n" +" guest - instantly. This can be useful for accurate simulation regardless of\n" +" debug overhead, physical CPU speed, etc. but is somewhat dangerous as it can\n" +" easily lead to getting stuck (e.g. if anything in the system busy loops).\n" "\n" "time-travel=ext:[ID:]/path/to/socket\n" -"This enables time travel mode similar to =inf-cpu, except the system will\n" -"use the given socket to coordinate with a central scheduler, in order to\n" -"have more than one system simultaneously be on simulated time. The virtio\n" -"driver code in UML knows about this so you can also simulate networks and\n" -"devices using it, assuming the device has the right capabilities.\n" -"The optional ID is a 64-bit integer that's sent to the central scheduler.\n\n" ); +" This enables time travel mode similar to =inf-cpu, except the system will\n" +" use the given socket to coordinate with a central scheduler, in order to\n" +" have more than one system simultaneously be on simulated time. The virtio\n" +" driver code in UML knows about this so you can also simulate networks and\n" +" devices using it, assuming the device has the right capabilities.\n" +" The optional ID is a 64-bit integer that's sent to the central scheduler.\n\n" );static int setup_time_travel_start (char *str) {
@@ -1022,8 +1022,8 @@ static int setup_time_travel_start(char *str)__setup ("time-travel-start=" , setup_time_travel_start);__uml_help (setup_time_travel_start,"time-travel-start=<nanoseconds>\n" -"Configure the UML instance's wall clock to start at this value rather than\n" -"the host's wall clock at the time of UML boot.\n\n" ); +" Configure the UML instance's wall clock to start at this value rather than\n" +" the host's wall clock at the time of UML boot.\n\n" );static struct kobject *bc_time_kobject;
Signature · 1 line
2.34.1
PATCH 5/7 um: Remove unused offset and child_err fields from stub_data
In reply to Tiwei BieFrom: Tiwei Bie <[email protected]>
They are no longer used. Remove them.
--- arch/um/include/shared/skas/stub-data.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
arch/um/include/shared/skas/stub-data.h +1 -2
@@ -53,8 +53,7 @@ struct stub_syscall { };struct stub_data { -unsigned long offset; -long err, child_err; +long err;int syscall_data_len;/* 128 leaves enough room for additional fields in the struct */
Signature · 1 line
2.34.1
PATCH 6/7 um: Remove outdated comment about STUB_DATA_PAGES
In reply to Tiwei BieFrom: Tiwei Bie <[email protected]>
STUB_DATA_PAGES is no longer required to be a power of two since commit 91f0a0c5cc5b ("um: Calculate stub data address relative to stub code"). Remove the outdated comment.
--- arch/um/include/shared/as-layout.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/um/include/shared/as-layout.h +1 -1
@@ -23,7 +23,7 @@#define STUB_START stub_start#define STUB_CODE STUB_START#define STUB_DATA (STUB_CODE + UM_KERN_PAGE_SIZE) -#define STUB_DATA_PAGES 2/* must be a power of two */ +#define STUB_DATA_PAGES 2#define STUB_END (STUB_DATA + STUB_DATA_PAGES * UM_KERN_PAGE_SIZE)#ifndef __ASSEMBLER__
Signature · 1 line
2.34.1
PATCH 7/7 um: Centralize stub size calculations
In reply to Tiwei BieFrom: Tiwei Bie <[email protected]>
Currently, the stub size is calculated in multiple places. Define a macro that performs the calculation so that the code is easier to read and maintain.
--- arch/um/include/shared/as-layout.h | 3 ++- arch/um/kernel/um_arch.c | 4 +--- arch/x86/um/shared/sysdep/stub_32.h | 2 +- arch/x86/um/shared/sysdep/stub_64.h | 2 +- 4 files changed, 5 insertions(+), 6 deletions(-)
arch/um/include/shared/as-layout.h +2 -1
@@ -24,7 +24,8 @@#define STUB_CODE STUB_START#define STUB_DATA (STUB_CODE + UM_KERN_PAGE_SIZE)#define STUB_DATA_PAGES 2 -#define STUB_END (STUB_DATA + STUB_DATA_PAGES * UM_KERN_PAGE_SIZE) +#define STUB_SIZE ((1 + STUB_DATA_PAGES) * UM_KERN_PAGE_SIZE) +#define STUB_END (STUB_START + STUB_SIZE)#ifndef __ASSEMBLER__
arch/um/kernel/um_arch.c +1 -3
@@ -331,9 +331,7 @@ int __init linux_main(int argc, char **argv, char **envp) host_task_size =get_top_address (envp);/* reserve a few pages for the stubs */ - stub_start = host_task_size -STUB_DATA_PAGES *PAGE_SIZE ; -/* another page for the code portion */ - stub_start -=PAGE_SIZE ; + stub_start = host_task_size -STUB_SIZE ; host_task_size = stub_start;/* Limit TASK_SIZE to what is addressable by the page table */
arch/x86/um/shared/sysdep/stub_32.h +1 -1
@@ -129,7 +129,7 @@ static __always_inline void *get_stub_data(void) "subl %0,%%esp ;" \ "movl %1, %%eax ; " \ "call *%%eax ;" \ - :: "i" ((1 + STUB_DATA_PAGES) * UM_KERN_PAGE_SIZE), \ + :: "i" (STUB_SIZE), \ "i" (&fn))static __always_inline void
arch/x86/um/shared/sysdep/stub_64.h +1 -1
@@ -133,7 +133,7 @@ static __always_inline void *get_stub_data(void) "subq %0,%%rsp ;" \ "movq %1,%%rax ;" \ "call *%%rax ;" \ - :: "i" ((1 + STUB_DATA_PAGES) * UM_KERN_PAGE_SIZE), \ + :: "i" (STUB_SIZE), \ "i" (&fn))static __always_inline void
Signature · 1 line
2.34.1