From nobody Wed Dec 24 21:51:13 2025 Received: from out0-201.mail.aliyun.com (out0-201.mail.aliyun.com [140.205.0.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 13AE85F869 for ; Wed, 6 Mar 2024 10:25:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=140.205.0.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709720703; cv=none; b=LifL11mIb+EAN0wil2QfnZsPOT4Eyb78cyExCOo8WVGqaFkgsjEHPBlhXIbnMc1i0m/GXlZftE3Osi+9lXoiSuZenZg2xc4glpEG02dwAUnteP+DBhIBLjaEQgppTaxC8jowHXrfifzYDC3SfFBL+iVnaWKU0+q7jOhvly5sg54= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709720703; c=relaxed/simple; bh=AXpywqvycgeH2lxm2ANI1OyzNC9k0kJVnejMe1p/+ZY=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=Y7cr2pH1IcgetUBO4ea8S1FUVl4+qESK7bme9OtbQviq9vA8OkW6hxo0E0yt7HU1il1wJroBdeOMZcKtn5ooiKQUS/RoqNII6Zd7jjnddqD463X5MF85RVR70itf/9wQkOUTaLt0wbKNsATITTksPs5xGltVaANOyZPH9pBM8jw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=antgroup.com; spf=pass smtp.mailfrom=antgroup.com; arc=none smtp.client-ip=140.205.0.201 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=antgroup.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=antgroup.com X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R161e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018047187;MF=tiwei.btw@antgroup.com;NM=1;PH=DS;RN=8;SR=0;TI=SMTPD_---.Wgbn-JT_1709720381; Received: from ubuntu..(mailfrom:tiwei.btw@antgroup.com fp:SMTPD_---.Wgbn-JT_1709720381) by smtp.aliyun-inc.com; Wed, 06 Mar 2024 18:19:41 +0800 From: "Tiwei Bie" To: richard@nod.at, anton.ivanov@cambridgegreys.com, johannes@sipsolutions.net Cc: , , , , "Tiwei Bie" Subject: [PATCH v3 1/9] um: Make local functions and variables static Date: Wed, 06 Mar 2024 18:19:17 +0800 Message-Id: <20240306101925.1088870-2-tiwei.btw@antgroup.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240306101925.1088870-1-tiwei.btw@antgroup.com> References: <20240306101925.1088870-1-tiwei.btw@antgroup.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable This will also fix the warnings like: warning: no previous prototype for =E2=80=98fork_handler=E2=80=99 [-Wmissin= g-prototypes] 140 | void fork_handler(void) | ^~~~~~~~~~~~ Signed-off-by: Tiwei Bie Reviewed-by: Johannes Berg --- arch/um/drivers/pcap_kern.c | 4 ++-- arch/um/drivers/ubd_user.c | 2 +- arch/um/kernel/kmsg_dump.c | 2 +- arch/um/kernel/process.c | 8 ++++---- arch/um/kernel/time.c | 6 +++--- arch/um/os-Linux/drivers/ethertap_kern.c | 2 +- arch/um/os-Linux/drivers/tuntap_kern.c | 2 +- arch/um/os-Linux/signal.c | 4 ++-- arch/x86/um/os-Linux/registers.c | 2 +- arch/x86/um/tls_32.c | 2 +- 10 files changed, 17 insertions(+), 17 deletions(-) diff --git a/arch/um/drivers/pcap_kern.c b/arch/um/drivers/pcap_kern.c index 25ee2c97ca21..d9bf95d7867b 100644 --- a/arch/um/drivers/pcap_kern.c +++ b/arch/um/drivers/pcap_kern.c @@ -15,7 +15,7 @@ struct pcap_init { char *filter; }; =20 -void pcap_init_kern(struct net_device *dev, void *data) +static void pcap_init_kern(struct net_device *dev, void *data) { struct uml_net_private *pri; struct pcap_data *ppri; @@ -50,7 +50,7 @@ static const struct net_kern_info pcap_kern_info =3D { .write =3D pcap_write, }; =20 -int pcap_setup(char *str, char **mac_out, void *data) +static int pcap_setup(char *str, char **mac_out, void *data) { struct pcap_init *init =3D data; char *remain, *host_if =3D NULL, *options[2] =3D { NULL, NULL }; diff --git a/arch/um/drivers/ubd_user.c b/arch/um/drivers/ubd_user.c index a1afe414ce48..b4f8b8e60564 100644 --- a/arch/um/drivers/ubd_user.c +++ b/arch/um/drivers/ubd_user.c @@ -23,7 +23,7 @@ #include #include =20 -struct pollfd kernel_pollfd; +static struct pollfd kernel_pollfd; =20 int start_io_thread(unsigned long sp, int *fd_out) { diff --git a/arch/um/kernel/kmsg_dump.c b/arch/um/kernel/kmsg_dump.c index 427dd5a61a38..4382cf02a6d1 100644 --- a/arch/um/kernel/kmsg_dump.c +++ b/arch/um/kernel/kmsg_dump.c @@ -57,7 +57,7 @@ static struct kmsg_dumper kmsg_dumper =3D { .dump =3D kmsg_dumper_stdout }; =20 -int __init kmsg_dumper_stdout_init(void) +static int __init kmsg_dumper_stdout_init(void) { return kmsg_dump_register(&kmsg_dumper); } diff --git a/arch/um/kernel/process.c b/arch/um/kernel/process.c index ab95648e93e1..20f3813143d8 100644 --- a/arch/um/kernel/process.c +++ b/arch/um/kernel/process.c @@ -137,7 +137,7 @@ void new_thread_handler(void) } =20 /* Called magically, see new_thread_handler above */ -void fork_handler(void) +static void fork_handler(void) { force_flush_all(); =20 @@ -268,14 +268,14 @@ int clear_user_proc(void __user *buf, int size) static atomic_t using_sysemu =3D ATOMIC_INIT(0); int sysemu_supported; =20 -void set_using_sysemu(int value) +static void set_using_sysemu(int value) { if (value > sysemu_supported) return; atomic_set(&using_sysemu, value); } =20 -int get_using_sysemu(void) +static int get_using_sysemu(void) { return atomic_read(&using_sysemu); } @@ -313,7 +313,7 @@ static const struct proc_ops sysemu_proc_ops =3D { .proc_write =3D sysemu_proc_write, }; =20 -int __init make_proc_sysemu(void) +static int __init make_proc_sysemu(void) { struct proc_dir_entry *ent; if (!sysemu_supported) diff --git a/arch/um/kernel/time.c b/arch/um/kernel/time.c index 3e270da6b6f6..efa5b9c97992 100644 --- a/arch/um/kernel/time.c +++ b/arch/um/kernel/time.c @@ -319,7 +319,7 @@ void time_travel_add_event_rel(struct time_travel_event= *e, time_travel_add_event(e, time_travel_time + delay_ns); } =20 -void time_travel_periodic_timer(struct time_travel_event *e) +static void time_travel_periodic_timer(struct time_travel_event *e) { time_travel_add_event(&time_travel_timer_event, time_travel_time + time_travel_timer_interval); @@ -812,7 +812,7 @@ unsigned long calibrate_delay_is_known(void) return 0; } =20 -int setup_time_travel(char *str) +static int setup_time_travel(char *str) { if (strcmp(str, "=3Dinf-cpu") =3D=3D 0) { time_travel_mode =3D TT_MODE_INFCPU; @@ -862,7 +862,7 @@ __uml_help(setup_time_travel, "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"); =20 -int setup_time_travel_start(char *str) +static int setup_time_travel_start(char *str) { int err; =20 diff --git a/arch/um/os-Linux/drivers/ethertap_kern.c b/arch/um/os-Linux/dr= ivers/ethertap_kern.c index 3182e759d8de..5e5ee40680ce 100644 --- a/arch/um/os-Linux/drivers/ethertap_kern.c +++ b/arch/um/os-Linux/drivers/ethertap_kern.c @@ -63,7 +63,7 @@ const struct net_kern_info ethertap_kern_info =3D { .write =3D etap_write, }; =20 -int ethertap_setup(char *str, char **mac_out, void *data) +static int ethertap_setup(char *str, char **mac_out, void *data) { struct ethertap_init *init =3D data; =20 diff --git a/arch/um/os-Linux/drivers/tuntap_kern.c b/arch/um/os-Linux/driv= ers/tuntap_kern.c index adcb6717be6f..ff022d9cf0dd 100644 --- a/arch/um/os-Linux/drivers/tuntap_kern.c +++ b/arch/um/os-Linux/drivers/tuntap_kern.c @@ -53,7 +53,7 @@ const struct net_kern_info tuntap_kern_info =3D { .write =3D tuntap_write, }; =20 -int tuntap_setup(char *str, char **mac_out, void *data) +static int tuntap_setup(char *str, char **mac_out, void *data) { struct tuntap_init *init =3D data; =20 diff --git a/arch/um/os-Linux/signal.c b/arch/um/os-Linux/signal.c index 24a403a70a02..787cfb9a0308 100644 --- a/arch/um/os-Linux/signal.c +++ b/arch/um/os-Linux/signal.c @@ -72,7 +72,7 @@ static int signals_blocked; static unsigned int signals_pending; static unsigned int signals_active =3D 0; =20 -void sig_handler(int sig, struct siginfo *si, mcontext_t *mc) +static void sig_handler(int sig, struct siginfo *si, mcontext_t *mc) { int enabled =3D signals_enabled; =20 @@ -108,7 +108,7 @@ static void timer_real_alarm_handler(mcontext_t *mc) timer_handler(SIGALRM, NULL, ®s); } =20 -void timer_alarm_handler(int sig, struct siginfo *unused_si, mcontext_t *m= c) +static void timer_alarm_handler(int sig, struct siginfo *unused_si, mconte= xt_t *mc) { int enabled; =20 diff --git a/arch/x86/um/os-Linux/registers.c b/arch/x86/um/os-Linux/regist= ers.c index df8f4b4bf98b..f3638dd09cec 100644 --- a/arch/x86/um/os-Linux/registers.c +++ b/arch/x86/um/os-Linux/registers.c @@ -17,7 +17,7 @@ #include #include =20 -int have_xstate_support; +static int have_xstate_support; =20 int save_i387_registers(int pid, unsigned long *fp_regs) { diff --git a/arch/x86/um/tls_32.c b/arch/x86/um/tls_32.c index 66162eafd8e8..ba40b1b8e179 100644 --- a/arch/x86/um/tls_32.c +++ b/arch/x86/um/tls_32.c @@ -20,7 +20,7 @@ static int host_supports_tls =3D -1; int host_gdt_entry_tls_min; =20 -int do_set_thread_area(struct user_desc *info) +static int do_set_thread_area(struct user_desc *info) { int ret; u32 cpu; --=20 2.34.1 From nobody Wed Dec 24 21:51:13 2025 Received: from out0-209.mail.aliyun.com (out0-209.mail.aliyun.com [140.205.0.209]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 057CC5F566 for ; Wed, 6 Mar 2024 10:25:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=140.205.0.209 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709720703; cv=none; b=kXkOaXKfOxYWmkcdJFeEifZInCFeS33F3VBCXzF6hlBFSTke65ss4FyPtF76pLyAv0vImixOjkLpDthe0uiNRygWU3eTUFxPqjDnT34L0VdhSrwFjlvkOwNQs/0yAwTNg6rYJsFPECBG8aU2/8pzJFwqX2GfSyEpXE45TAbavhE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709720703; c=relaxed/simple; bh=IPelaOlLNzUGstOhPXdkzDn7BzmoqqeZFdhJ5KOY6+A=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=WMPHn+u9UvgI1X58zrmJNKgrQ7gTN7QI0t4QAMtEVYWCnrw1mYQmI8fc11dhIHodknn3RZekX6L79k7RPy2rLai7g7dSlJ3K/f/ObWt5ksBi50LdLO8cg6ip5I+aiUJTJvv5GRMWto+OzuxLAqskfDIA1OZ3dLIKR/6igZySN5M= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=antgroup.com; spf=pass smtp.mailfrom=antgroup.com; arc=none smtp.client-ip=140.205.0.209 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=antgroup.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=antgroup.com X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R371e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018047204;MF=tiwei.btw@antgroup.com;NM=1;PH=DS;RN=8;SR=0;TI=SMTPD_---.Wgbn-JZ_1709720381; Received: from ubuntu..(mailfrom:tiwei.btw@antgroup.com fp:SMTPD_---.Wgbn-JZ_1709720381) by smtp.aliyun-inc.com; Wed, 06 Mar 2024 18:19:41 +0800 From: "Tiwei Bie" To: richard@nod.at, anton.ivanov@cambridgegreys.com, johannes@sipsolutions.net Cc: , , , , "Tiwei Bie" Subject: [PATCH v3 2/9] um: Fix the declaration of vfree Date: Wed, 06 Mar 2024 18:19:18 +0800 Message-Id: <20240306101925.1088870-3-tiwei.btw@antgroup.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240306101925.1088870-1-tiwei.btw@antgroup.com> References: <20240306101925.1088870-1-tiwei.btw@antgroup.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The definition of vfree has changed since commit b3bdda02aa54 ("vmalloc: add const to void* parameters"). Update the declaration of vfree in um_malloc.h to match the latest definition. Signed-off-by: Tiwei Bie Reviewed-by: Johannes Berg --- arch/um/include/shared/um_malloc.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/um/include/shared/um_malloc.h b/arch/um/include/shared/um= _malloc.h index 13da93284c2c..d25084447c69 100644 --- a/arch/um/include/shared/um_malloc.h +++ b/arch/um/include/shared/um_malloc.h @@ -12,7 +12,7 @@ extern void *uml_kmalloc(int size, int flags); extern void kfree(const void *ptr); =20 extern void *vmalloc(unsigned long size); -extern void vfree(void *ptr); +extern void vfree(const void *ptr); =20 #endif /* __UM_MALLOC_H__ */ =20 --=20 2.34.1 From nobody Wed Dec 24 21:51:13 2025 Received: from out187-18.us.a.mail.aliyun.com (out187-18.us.a.mail.aliyun.com [47.90.187.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 30D7360B8F for ; Wed, 6 Mar 2024 10:35:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=47.90.187.18 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709721328; cv=none; b=eKtPrFoOLTPYFa3ZiqFX/h+Kg0u8ggfmRowQviHBiccPJEc/ZO6MRnCOpNrOA2vj9y7JFsHUejv3LweOiNZA2KeY8hP/tkw1WnXOUPetOk9ftLwDNW1H+tGRdPFy1rNCHFpZV0flwZzhO3bA9CR6c+ONUmGUfBjJrh62+AbI63c= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709721328; c=relaxed/simple; bh=5BvnaK+Q3e30bHwbnZ/Zuza3SgyqFfcHiBGD0cfTfMY=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=VOAJT2+4EWMaLkAVFGMul6hwp8Rs9GFrG5oOd5eWb0A0NGZia+dJPhhRjA0VvSD2aENyw0vbrCDhX4FNc6UEV6BvFxNKPX0TSWah/AHuae00BwD5pCA0/4lOwuu6jne+1AWaPWKumoT0KzHODCQMPPH/9Z1AswYOMCQA3Tu51k4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=antgroup.com; spf=pass smtp.mailfrom=antgroup.com; arc=none smtp.client-ip=47.90.187.18 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=antgroup.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=antgroup.com X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R451e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018047213;MF=tiwei.btw@antgroup.com;NM=1;PH=DS;RN=8;SR=0;TI=SMTPD_---.Wgbn-Jf_1709720382; Received: from ubuntu..(mailfrom:tiwei.btw@antgroup.com fp:SMTPD_---.Wgbn-Jf_1709720382) by smtp.aliyun-inc.com; Wed, 06 Mar 2024 18:19:42 +0800 From: "Tiwei Bie" To: richard@nod.at, anton.ivanov@cambridgegreys.com, johannes@sipsolutions.net Cc: , , , , "Tiwei Bie" Subject: [PATCH v3 3/9] um: Remove unused functions Date: Wed, 06 Mar 2024 18:19:19 +0800 Message-Id: <20240306101925.1088870-4-tiwei.btw@antgroup.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240306101925.1088870-1-tiwei.btw@antgroup.com> References: <20240306101925.1088870-1-tiwei.btw@antgroup.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable These functions are not used anymore. Removing them will also address below -Wmissing-prototypes warnings: arch/um/kernel/process.c:51:5: warning: no previous prototype for =E2=80=98= pid_to_processor_id=E2=80=99 [-Wmissing-prototypes] arch/um/kernel/process.c:253:5: warning: no previous prototype for =E2=80= =98copy_to_user_proc=E2=80=99 [-Wmissing-prototypes] arch/um/kernel/process.c:263:5: warning: no previous prototype for =E2=80= =98clear_user_proc=E2=80=99 [-Wmissing-prototypes] arch/um/kernel/tlb.c:579:6: warning: no previous prototype for =E2=80=98flu= sh_tlb_mm_range=E2=80=99 [-Wmissing-prototypes] Signed-off-by: Tiwei Bie Reviewed-by: Johannes Berg --- arch/um/kernel/process.c | 21 --------------------- arch/um/kernel/tlb.c | 6 ------ 2 files changed, 27 deletions(-) diff --git a/arch/um/kernel/process.c b/arch/um/kernel/process.c index 20f3813143d8..292c8014aaa6 100644 --- a/arch/um/kernel/process.c +++ b/arch/um/kernel/process.c @@ -48,17 +48,6 @@ static inline int external_pid(void) return userspace_pid[0]; } =20 -int pid_to_processor_id(int pid) -{ - int i; - - for (i =3D 0; i < ncpus; i++) { - if (cpu_tasks[i].pid =3D=3D pid) - return i; - } - return -1; -} - void free_stack(unsigned long stack, int order) { free_pages(stack, order); @@ -250,21 +239,11 @@ char *uml_strdup(const char *string) } EXPORT_SYMBOL(uml_strdup); =20 -int copy_to_user_proc(void __user *to, void *from, int size) -{ - return copy_to_user(to, from, size); -} - int copy_from_user_proc(void *to, void __user *from, int size) { return copy_from_user(to, from, size); } =20 -int clear_user_proc(void __user *buf, int size) -{ - return clear_user(buf, size); -} - static atomic_t using_sysemu =3D ATOMIC_INIT(0); int sysemu_supported; =20 diff --git a/arch/um/kernel/tlb.c b/arch/um/kernel/tlb.c index 7d050ab0f78a..70b5e47e9761 100644 --- a/arch/um/kernel/tlb.c +++ b/arch/um/kernel/tlb.c @@ -576,12 +576,6 @@ void flush_tlb_range(struct vm_area_struct *vma, unsig= ned long start, } EXPORT_SYMBOL(flush_tlb_range); =20 -void flush_tlb_mm_range(struct mm_struct *mm, unsigned long start, - unsigned long end) -{ - fix_range(mm, start, end, 0); -} - void flush_tlb_mm(struct mm_struct *mm) { struct vm_area_struct *vma; --=20 2.34.1 From nobody Wed Dec 24 21:51:13 2025 Received: from out187-16.us.a.mail.aliyun.com (out187-16.us.a.mail.aliyun.com [47.90.187.16]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5D1605FDBD for ; Wed, 6 Mar 2024 10:25:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=47.90.187.16 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709720713; cv=none; b=ZCpGSUPv0AOewwKyWxlBv7uwLgEDBmqnujU10uzpffp+HY78/40znbAdYRo8R45QKj4PiKeVAE3ThBzrj6NhnQqj/9+YWXOk962CeCXf//8JXOkImvKHHz0/u6YzH/YUCIyAxlp98qmRbNmBYVdOu2XDRhwiMXrj2cD7p7fWIDE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709720713; c=relaxed/simple; bh=e5W/30uahPxnnobqPEw5qPDCHBhsj0fyCzs0F+PD/V8=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=LBvylGeu84ih/eyzK4H8R9nuHA2MDl6YdeIK3aNS9iPOwyt4oTctFx+P6Yo2d6ZbLy4DhlHp/bZjjK0/HLlqbjuhbkBR3ZIrORzHeac10WgWC53YyiBdNeJLDJrAXe+ddyzbAJsOKpa2w1KtjTlO7eJ9Kl1CQteSW+CGGSD6kqI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=antgroup.com; spf=pass smtp.mailfrom=antgroup.com; arc=none smtp.client-ip=47.90.187.16 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=antgroup.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=antgroup.com X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R161e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018047211;MF=tiwei.btw@antgroup.com;NM=1;PH=DS;RN=8;SR=0;TI=SMTPD_---.Wgbn-Jk_1709720382; Received: from ubuntu..(mailfrom:tiwei.btw@antgroup.com fp:SMTPD_---.Wgbn-Jk_1709720382) by smtp.aliyun-inc.com; Wed, 06 Mar 2024 18:19:42 +0800 From: "Tiwei Bie" To: richard@nod.at, anton.ivanov@cambridgegreys.com, johannes@sipsolutions.net Cc: , , , , "Tiwei Bie" Subject: [PATCH v3 4/9] um: Fix the return type of __switch_to Date: Wed, 06 Mar 2024 18:19:20 +0800 Message-Id: <20240306101925.1088870-5-tiwei.btw@antgroup.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240306101925.1088870-1-tiwei.btw@antgroup.com> References: <20240306101925.1088870-1-tiwei.btw@antgroup.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Make it match the declaration in asm-generic/switch_to.h. And also include the header to allow the compiler to check it. Signed-off-by: Tiwei Bie Reviewed-by: Johannes Berg --- arch/um/kernel/process.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/um/kernel/process.c b/arch/um/kernel/process.c index 292c8014aaa6..a7607ef1b02f 100644 --- a/arch/um/kernel/process.c +++ b/arch/um/kernel/process.c @@ -26,6 +26,7 @@ #include #include #include +#include #include #include #include @@ -73,7 +74,7 @@ static inline void set_current(struct task_struct *task) =20 extern void arch_switch_to(struct task_struct *to); =20 -void *__switch_to(struct task_struct *from, struct task_struct *to) +struct task_struct *__switch_to(struct task_struct *from, struct task_stru= ct *to) { to->thread.prev_sched =3D from; set_current(to); --=20 2.34.1 From nobody Wed Dec 24 21:51:13 2025 Received: from out0-196.mail.aliyun.com (out0-196.mail.aliyun.com [140.205.0.196]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 50AAB605AF for ; Wed, 6 Mar 2024 10:35:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=140.205.0.196 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709721321; cv=none; b=kVxB2eo+/836PvMOaJU/3DtxIO0VQNO8/cdu81WZAANcVs1ROsHcenaIY/oUX1h5ZMeMHwQni4Ewmyx1JIW+fQCs0DLS0YDlWAW0oHRn02eV8MY5VlPiyadqvImQJyx06Jq1qpF0UQEXgpciUV5CCz1jYP0EdAMjL6ww74VAcQw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709721321; c=relaxed/simple; bh=LCWgwGnZmzeExd4BBExTPbb7JJEolQjmEp6RqFiS0xo=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=Id/H8+6w2kvdb+eDjg0BSMmyBckPA7ItliJ059o9OVHvywE9m8jAY5FgjOHteRVZwY5IOaT+AdduiqD6vZIiTin7ZkkU886NPKJsJ7gWRUSLkRVwtIwPgwuls3BH27/oCXBI8INQt6cmtZeMM2L/ib8+6Nd/3NnsWgYKDE1tXbg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=antgroup.com; spf=pass smtp.mailfrom=antgroup.com; arc=none smtp.client-ip=140.205.0.196 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=antgroup.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=antgroup.com X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R801e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018047209;MF=tiwei.btw@antgroup.com;NM=1;PH=DS;RN=8;SR=0;TI=SMTPD_---.Wgbn-Js_1709720382; Received: from ubuntu..(mailfrom:tiwei.btw@antgroup.com fp:SMTPD_---.Wgbn-Js_1709720382) by smtp.aliyun-inc.com; Wed, 06 Mar 2024 18:19:43 +0800 From: "Tiwei Bie" To: richard@nod.at, anton.ivanov@cambridgegreys.com, johannes@sipsolutions.net Cc: , , , , "Tiwei Bie" Subject: [PATCH v3 5/9] um: Add missing headers Date: Wed, 06 Mar 2024 18:19:21 +0800 Message-Id: <20240306101925.1088870-6-tiwei.btw@antgroup.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240306101925.1088870-1-tiwei.btw@antgroup.com> References: <20240306101925.1088870-1-tiwei.btw@antgroup.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable This will address below -Wmissing-prototypes warnings: arch/um/kernel/mem.c:202:8: warning: no previous prototype for =E2=80=98pgd= _alloc=E2=80=99 [-Wmissing-prototypes] arch/um/kernel/mem.c:215:7: warning: no previous prototype for =E2=80=98uml= _kmalloc=E2=80=99 [-Wmissing-prototypes] arch/um/kernel/process.c:207:6: warning: no previous prototype for =E2=80= =98arch_cpu_idle=E2=80=99 [-Wmissing-prototypes] arch/um/kernel/process.c:328:15: warning: no previous prototype for =E2=80= =98arch_align_stack=E2=80=99 [-Wmissing-prototypes] arch/um/kernel/reboot.c:45:6: warning: no previous prototype for =E2=80=98m= achine_restart=E2=80=99 [-Wmissing-prototypes] arch/um/kernel/reboot.c:51:6: warning: no previous prototype for =E2=80=98m= achine_power_off=E2=80=99 [-Wmissing-prototypes] arch/um/kernel/reboot.c:57:6: warning: no previous prototype for =E2=80=98m= achine_halt=E2=80=99 [-Wmissing-prototypes] arch/um/kernel/skas/mmu.c:17:5: warning: no previous prototype for =E2=80= =98init_new_context=E2=80=99 [-Wmissing-prototypes] arch/um/kernel/skas/mmu.c:60:6: warning: no previous prototype for =E2=80= =98destroy_context=E2=80=99 [-Wmissing-prototypes] arch/um/kernel/skas/process.c:36:12: warning: no previous prototype for =E2= =80=98start_uml=E2=80=99 [-Wmissing-prototypes] arch/um/kernel/time.c:807:15: warning: no previous prototype for =E2=80=98c= alibrate_delay_is_known=E2=80=99 [-Wmissing-prototypes] arch/um/kernel/tlb.c:594:6: warning: no previous prototype for =E2=80=98for= ce_flush_all=E2=80=99 [-Wmissing-prototypes] arch/x86/um/bugs_32.c:22:6: warning: no previous prototype for =E2=80=98arc= h_check_bugs=E2=80=99 [-Wmissing-prototypes] arch/x86/um/bugs_32.c:44:6: warning: no previous prototype for =E2=80=98arc= h_examine_signal=E2=80=99 [-Wmissing-prototypes] arch/x86/um/bugs_64.c:9:6: warning: no previous prototype for =E2=80=98arch= _check_bugs=E2=80=99 [-Wmissing-prototypes] arch/x86/um/bugs_64.c:13:6: warning: no previous prototype for =E2=80=98arc= h_examine_signal=E2=80=99 [-Wmissing-prototypes] arch/x86/um/elfcore.c:10:12: warning: no previous prototype for =E2=80=98el= f_core_extra_phdrs=E2=80=99 [-Wmissing-prototypes] arch/x86/um/elfcore.c:15:5: warning: no previous prototype for =E2=80=98elf= _core_write_extra_phdrs=E2=80=99 [-Wmissing-prototypes] arch/x86/um/elfcore.c:42:5: warning: no previous prototype for =E2=80=98elf= _core_write_extra_data=E2=80=99 [-Wmissing-prototypes] arch/x86/um/elfcore.c:63:8: warning: no previous prototype for =E2=80=98elf= _core_extra_data_size=E2=80=99 [-Wmissing-prototypes] arch/x86/um/fault.c:18:5: warning: no previous prototype for =E2=80=98arch_= fixup=E2=80=99 [-Wmissing-prototypes] arch/x86/um/os-Linux/mcontext.c:7:6: warning: no previous prototype for =E2= =80=98get_regs_from_mc=E2=80=99 [-Wmissing-prototypes] arch/x86/um/os-Linux/tls.c:22:6: warning: no previous prototype for =E2=80= =98check_host_supports_tls=E2=80=99 [-Wmissing-prototypes] Signed-off-by: Tiwei Bie Reviewed-by: Johannes Berg --- arch/um/kernel/mem.c | 2 ++ arch/um/kernel/process.c | 2 ++ arch/um/kernel/reboot.c | 1 + arch/um/kernel/skas/mmu.c | 1 + arch/um/kernel/skas/process.c | 1 + arch/um/kernel/time.c | 1 + arch/um/kernel/tlb.c | 1 + arch/x86/um/bugs_32.c | 1 + arch/x86/um/bugs_64.c | 1 + arch/x86/um/elfcore.c | 1 + arch/x86/um/fault.c | 1 + arch/x86/um/os-Linux/mcontext.c | 1 + arch/x86/um/os-Linux/tls.c | 1 + 13 files changed, 15 insertions(+) diff --git a/arch/um/kernel/mem.c b/arch/um/kernel/mem.c index 38d5a71a579b..ca91accd64fc 100644 --- a/arch/um/kernel/mem.c +++ b/arch/um/kernel/mem.c @@ -12,12 +12,14 @@ #include #include #include +#include #include #include #include #include #include #include +#include #include =20 #ifdef CONFIG_KASAN diff --git a/arch/um/kernel/process.c b/arch/um/kernel/process.c index a7607ef1b02f..4235e2ca2664 100644 --- a/arch/um/kernel/process.c +++ b/arch/um/kernel/process.c @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #include @@ -27,6 +28,7 @@ #include #include #include +#include #include #include #include diff --git a/arch/um/kernel/reboot.c b/arch/um/kernel/reboot.c index 48c0610d506e..25840eee1068 100644 --- a/arch/um/kernel/reboot.c +++ b/arch/um/kernel/reboot.c @@ -9,6 +9,7 @@ #include #include #include +#include #include #include #include diff --git a/arch/um/kernel/skas/mmu.c b/arch/um/kernel/skas/mmu.c index 656fe16c9b63..aeed1c2aaf3c 100644 --- a/arch/um/kernel/skas/mmu.c +++ b/arch/um/kernel/skas/mmu.c @@ -10,6 +10,7 @@ =20 #include #include +#include #include #include #include diff --git a/arch/um/kernel/skas/process.c b/arch/um/kernel/skas/process.c index f2ac134c9752..fdd5922f9222 100644 --- a/arch/um/kernel/skas/process.c +++ b/arch/um/kernel/skas/process.c @@ -12,6 +12,7 @@ #include #include #include +#include =20 extern void start_kernel(void); =20 diff --git a/arch/um/kernel/time.c b/arch/um/kernel/time.c index efa5b9c97992..a8bfe8be1526 100644 --- a/arch/um/kernel/time.c +++ b/arch/um/kernel/time.c @@ -19,6 +19,7 @@ #include #include #include +#include #include #include #include diff --git a/arch/um/kernel/tlb.c b/arch/um/kernel/tlb.c index 70b5e47e9761..8784f03fa4a6 100644 --- a/arch/um/kernel/tlb.c +++ b/arch/um/kernel/tlb.c @@ -8,6 +8,7 @@ #include =20 #include +#include #include #include #include diff --git a/arch/x86/um/bugs_32.c b/arch/x86/um/bugs_32.c index 33daff4dade4..d29929efcc07 100644 --- a/arch/x86/um/bugs_32.c +++ b/arch/x86/um/bugs_32.c @@ -3,6 +3,7 @@ * Licensed under the GPL */ =20 +#include #include #include #include diff --git a/arch/x86/um/bugs_64.c b/arch/x86/um/bugs_64.c index 8cc8256c698d..b01295e8a676 100644 --- a/arch/x86/um/bugs_64.c +++ b/arch/x86/um/bugs_64.c @@ -4,6 +4,7 @@ * Licensed under the GPL */ =20 +#include #include =20 void arch_check_bugs(void) diff --git a/arch/x86/um/elfcore.c b/arch/x86/um/elfcore.c index 650cdbbdaf45..ef50662fc40d 100644 --- a/arch/x86/um/elfcore.c +++ b/arch/x86/um/elfcore.c @@ -1,5 +1,6 @@ // SPDX-License-Identifier: GPL-2.0 #include +#include #include #include #include diff --git a/arch/x86/um/fault.c b/arch/x86/um/fault.c index 84ac7f7b0257..0dde4d613a87 100644 --- a/arch/x86/um/fault.c +++ b/arch/x86/um/fault.c @@ -3,6 +3,7 @@ * Licensed under the GPL */ =20 +#include #include =20 /* These two are from asm-um/uaccess.h and linux/module.h, check them. */ diff --git a/arch/x86/um/os-Linux/mcontext.c b/arch/x86/um/os-Linux/mcontex= t.c index 49c3744cac37..e80ab7d28117 100644 --- a/arch/x86/um/os-Linux/mcontext.c +++ b/arch/x86/um/os-Linux/mcontext.c @@ -3,6 +3,7 @@ #define __FRAME_OFFSETS #include #include +#include =20 void get_regs_from_mc(struct uml_pt_regs *regs, mcontext_t *mc) { diff --git a/arch/x86/um/os-Linux/tls.c b/arch/x86/um/os-Linux/tls.c index 3e1b1bf6acbc..eed9efe29ade 100644 --- a/arch/x86/um/os-Linux/tls.c +++ b/arch/x86/um/os-Linux/tls.c @@ -6,6 +6,7 @@ #include #include =20 +#include #include =20 #ifndef PTRACE_GET_THREAD_AREA --=20 2.34.1 From nobody Wed Dec 24 21:51:13 2025 Received: from out187-15.us.a.mail.aliyun.com (out187-15.us.a.mail.aliyun.com [47.90.187.15]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CFC525F869 for ; Wed, 6 Mar 2024 10:25:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=47.90.187.15 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709720714; cv=none; b=j418ZjkLNPhdiriHB8J/axbMx8bLUnKlc6n5UQ+THIcUTa2+mA6YSsna0qfMEQDpomE9GKIqJikVMnjeLodC3kUOgNHcnkJwDY3yuXaotxt6wKtpHtFmlDoqSrj97mQyfP453Mxl6lbczVtbeOe7AGkIV/K/DTPwnVy4ti+/77c= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709720714; c=relaxed/simple; bh=aeIv3sGdCkzoeZ0Sga2roNKU5ZWZgPhlxgVKkJoerUE=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=hkVu8AjF0MQo638UfpuO7p0Q8yJnymwshrCACzqnQBhRf62Af0mjE0HAms5n83LNVTkC2chWho83KqNxtBFjT0npNnYG3itutokk+rHxa5VxWu4WytPq7M45Q5nIGJlhn2QGJdATi9LNHbEDWhKOwgDn0KQClli3JMCjVE7TRNU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=antgroup.com; spf=pass smtp.mailfrom=antgroup.com; arc=none smtp.client-ip=47.90.187.15 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=antgroup.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=antgroup.com X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R321e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018047193;MF=tiwei.btw@antgroup.com;NM=1;PH=DS;RN=8;SR=0;TI=SMTPD_---.Wgbn-Jv_1709720383; Received: from ubuntu..(mailfrom:tiwei.btw@antgroup.com fp:SMTPD_---.Wgbn-Jv_1709720383) by smtp.aliyun-inc.com; Wed, 06 Mar 2024 18:19:43 +0800 From: "Tiwei Bie" To: richard@nod.at, anton.ivanov@cambridgegreys.com, johannes@sipsolutions.net Cc: , , , , "Tiwei Bie" Subject: [PATCH v3 6/9] um: Stop tracking host PID in cpu_tasks Date: Wed, 06 Mar 2024 18:19:22 +0800 Message-Id: <20240306101925.1088870-7-tiwei.btw@antgroup.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240306101925.1088870-1-tiwei.btw@antgroup.com> References: <20240306101925.1088870-1-tiwei.btw@antgroup.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The host PID tracked in 'cpu_tasks' is no longer used. Stopping tracking it will also save some cycles. Signed-off-by: Tiwei Bie Reviewed-by: Johannes Berg --- arch/um/include/shared/as-layout.h | 1 - arch/um/kernel/process.c | 12 ++---------- arch/um/kernel/skas/process.c | 4 ---- 3 files changed, 2 insertions(+), 15 deletions(-) diff --git a/arch/um/include/shared/as-layout.h b/arch/um/include/shared/as= -layout.h index 9ec3015bc5e2..c22f46a757dc 100644 --- a/arch/um/include/shared/as-layout.h +++ b/arch/um/include/shared/as-layout.h @@ -31,7 +31,6 @@ #include =20 struct cpu_task { - int pid; void *task; }; =20 diff --git a/arch/um/kernel/process.c b/arch/um/kernel/process.c index 4235e2ca2664..1201c1a79b23 100644 --- a/arch/um/kernel/process.c +++ b/arch/um/kernel/process.c @@ -43,13 +43,7 @@ * cares about its entry, so it's OK if another processor is modifying its * entry. */ -struct cpu_task cpu_tasks[NR_CPUS] =3D { [0 ... NR_CPUS - 1] =3D { -1, NUL= L } }; - -static inline int external_pid(void) -{ - /* FIXME: Need to look up userspace_pid by cpu */ - return userspace_pid[0]; -} +struct cpu_task cpu_tasks[NR_CPUS] =3D { [0 ... NR_CPUS - 1] =3D { NULL } = }; =20 void free_stack(unsigned long stack, int order) { @@ -70,8 +64,7 @@ unsigned long alloc_stack(int order, int atomic) =20 static inline void set_current(struct task_struct *task) { - cpu_tasks[task_thread_info(task)->cpu] =3D ((struct cpu_task) - { external_pid(), task }); + cpu_tasks[task_thread_info(task)->cpu] =3D ((struct cpu_task) { task }); } =20 extern void arch_switch_to(struct task_struct *to); @@ -208,7 +201,6 @@ void um_idle_sleep(void) =20 void arch_cpu_idle(void) { - cpu_tasks[current_thread_info()->cpu].pid =3D os_getpid(); um_idle_sleep(); } =20 diff --git a/arch/um/kernel/skas/process.c b/arch/um/kernel/skas/process.c index fdd5922f9222..99a5cbb36083 100644 --- a/arch/um/kernel/skas/process.c +++ b/arch/um/kernel/skas/process.c @@ -18,12 +18,8 @@ extern void start_kernel(void); =20 static int __init start_kernel_proc(void *unused) { - int pid; - block_signals_trace(); - pid =3D os_getpid(); =20 - cpu_tasks[0].pid =3D pid; cpu_tasks[0].task =3D current; =20 start_kernel(); --=20 2.34.1 From nobody Wed Dec 24 21:51:13 2025 Received: from out0-195.mail.aliyun.com (out0-195.mail.aliyun.com [140.205.0.195]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3AC66605B3 for ; Wed, 6 Mar 2024 10:35:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=140.205.0.195 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709721321; cv=none; b=AcVWhr9SfvXiygntFng8Xf3hwE4c97eFJZ3zG0dbyIpX8UnJ7vZ8j7wbJfuomjzgRrvgTsHpYpqioopLJ4xt4rcHjfCnCedNve+dEKjyXpUuB/vM1VCNab+u6LkG+DuGICM02gEmfFYL7aFyFwvG5ubQO9AAx7gNyauHOrpjbTI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709721321; c=relaxed/simple; bh=/GC90DWrL7cXoxLWup0Y9mv2Ik+79aVESmMJJq8tlo0=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=Zhph66ub8BnU9vvMPrMoXZiuh/ann8Ou6vvVcLCNBOdSRVMPEdz/pWctury1MgVnJ98F066upVm0yVj0uQz3aYA+R+XSNVyKvxEv/aM9GCBFj3vvac1kb0Tc74ImqvRXE6ASvysDN+gawlEXTiXVqXg0/0g7r8LfZ2x2EC5iWFE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=antgroup.com; spf=pass smtp.mailfrom=antgroup.com; arc=none smtp.client-ip=140.205.0.195 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=antgroup.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=antgroup.com X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R201e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018047208;MF=tiwei.btw@antgroup.com;NM=1;PH=DS;RN=8;SR=0;TI=SMTPD_---.Wgbn-Jx_1709720383; Received: from ubuntu..(mailfrom:tiwei.btw@antgroup.com fp:SMTPD_---.Wgbn-Jx_1709720383) by smtp.aliyun-inc.com; Wed, 06 Mar 2024 18:19:43 +0800 From: "Tiwei Bie" To: richard@nod.at, anton.ivanov@cambridgegreys.com, johannes@sipsolutions.net Cc: , , , , "Tiwei Bie" Subject: [PATCH v3 7/9] um: Move declarations to proper headers Date: Wed, 06 Mar 2024 18:19:23 +0800 Message-Id: <20240306101925.1088870-8-tiwei.btw@antgroup.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240306101925.1088870-1-tiwei.btw@antgroup.com> References: <20240306101925.1088870-1-tiwei.btw@antgroup.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable This will address below -Wmissing-prototypes warnings: arch/um/kernel/initrd.c:18:12: warning: no previous prototype for =E2=80=98= read_initrd=E2=80=99 [-Wmissing-prototypes] arch/um/kernel/um_arch.c:408:19: warning: no previous prototype for =E2=80= =98read_initrd=E2=80=99 [-Wmissing-prototypes] arch/um/os-Linux/start_up.c:301:12: warning: no previous prototype for =E2= =80=98parse_iomem=E2=80=99 [-Wmissing-prototypes] arch/x86/um/ptrace_32.c:15:6: warning: no previous prototype for =E2=80=98a= rch_switch_to=E2=80=99 [-Wmissing-prototypes] arch/x86/um/ptrace_32.c:101:5: warning: no previous prototype for =E2=80=98= poke_user=E2=80=99 [-Wmissing-prototypes] arch/x86/um/ptrace_32.c:153:5: warning: no previous prototype for =E2=80=98= peek_user=E2=80=99 [-Wmissing-prototypes] arch/x86/um/ptrace_64.c:111:5: warning: no previous prototype for =E2=80=98= poke_user=E2=80=99 [-Wmissing-prototypes] arch/x86/um/ptrace_64.c:171:5: warning: no previous prototype for =E2=80=98= peek_user=E2=80=99 [-Wmissing-prototypes] arch/x86/um/syscalls_64.c:48:6: warning: no previous prototype for =E2=80= =98arch_switch_to=E2=80=99 [-Wmissing-prototypes] arch/x86/um/tls_32.c:184:5: warning: no previous prototype for =E2=80=98arc= h_switch_tls=E2=80=99 [-Wmissing-prototypes] Signed-off-by: Tiwei Bie Reviewed-by: Johannes Berg --- arch/um/include/asm/ptrace-generic.h | 3 +++ arch/um/include/shared/kern_util.h | 1 + arch/um/kernel/physmem.c | 3 +-- arch/um/kernel/process.c | 2 -- arch/um/kernel/ptrace.c | 3 --- arch/um/kernel/um_arch.h | 2 ++ arch/um/os-Linux/start_up.c | 1 + arch/x86/um/asm/ptrace.h | 6 ++++++ arch/x86/um/ptrace_32.c | 2 -- 9 files changed, 14 insertions(+), 9 deletions(-) diff --git a/arch/um/include/asm/ptrace-generic.h b/arch/um/include/asm/ptr= ace-generic.h index adf91ef553ae..4696f24d1492 100644 --- a/arch/um/include/asm/ptrace-generic.h +++ b/arch/um/include/asm/ptrace-generic.h @@ -36,6 +36,9 @@ extern long subarch_ptrace(struct task_struct *child, lon= g request, extern unsigned long getreg(struct task_struct *child, int regno); extern int putreg(struct task_struct *child, int regno, unsigned long valu= e); =20 +extern int poke_user(struct task_struct *child, long addr, long data); +extern int peek_user(struct task_struct *child, long addr, long data); + extern int arch_set_tls(struct task_struct *new, unsigned long tls); extern void clear_flushed_tls(struct task_struct *task); extern int syscall_trace_enter(struct pt_regs *regs); diff --git a/arch/um/include/shared/kern_util.h b/arch/um/include/shared/ke= rn_util.h index 789b83013f35..81bc38a2e3fc 100644 --- a/arch/um/include/shared/kern_util.h +++ b/arch/um/include/shared/kern_util.h @@ -41,6 +41,7 @@ extern void uml_pm_wake(void); =20 extern int start_uml(void); extern void paging_init(void); +extern int parse_iomem(char *str, int *add); =20 extern void uml_cleanup(void); extern void do_uml_exitcalls(void); diff --git a/arch/um/kernel/physmem.c b/arch/um/kernel/physmem.c index 91485119ae67..fb2adfb49945 100644 --- a/arch/um/kernel/physmem.c +++ b/arch/um/kernel/physmem.c @@ -12,6 +12,7 @@ #include #include #include +#include #include #include =20 @@ -161,8 +162,6 @@ __uml_setup("mem=3D", uml_mem_setup, " Example: mem=3D64M\n\n" ); =20 -extern int __init parse_iomem(char *str, int *add); - __uml_setup("iomem=3D", parse_iomem, "iomem=3D,\n" " Configure as an IO memory region named .\n\n" diff --git a/arch/um/kernel/process.c b/arch/um/kernel/process.c index 1201c1a79b23..30bf7739ed0f 100644 --- a/arch/um/kernel/process.c +++ b/arch/um/kernel/process.c @@ -67,8 +67,6 @@ static inline void set_current(struct task_struct *task) cpu_tasks[task_thread_info(task)->cpu] =3D ((struct cpu_task) { task }); } =20 -extern void arch_switch_to(struct task_struct *to); - struct task_struct *__switch_to(struct task_struct *from, struct task_stru= ct *to) { to->thread.prev_sched =3D from; diff --git a/arch/um/kernel/ptrace.c b/arch/um/kernel/ptrace.c index 6600a2782796..2124624b7817 100644 --- a/arch/um/kernel/ptrace.c +++ b/arch/um/kernel/ptrace.c @@ -35,9 +35,6 @@ void ptrace_disable(struct task_struct *child) user_disable_single_step(child); } =20 -extern int peek_user(struct task_struct * child, long addr, long data); -extern int poke_user(struct task_struct * child, long addr, long data); - long arch_ptrace(struct task_struct *child, long request, unsigned long addr, unsigned long data) { diff --git a/arch/um/kernel/um_arch.h b/arch/um/kernel/um_arch.h index 1e07fb7ee35e..46e731ab9dfc 100644 --- a/arch/um/kernel/um_arch.h +++ b/arch/um/kernel/um_arch.h @@ -11,4 +11,6 @@ extern void __init uml_dtb_init(void); static inline void uml_dtb_init(void) { } #endif =20 +extern int __init read_initrd(void); + #endif diff --git a/arch/um/os-Linux/start_up.c b/arch/um/os-Linux/start_up.c index 8b0e98ab842c..6b21061c431c 100644 --- a/arch/um/os-Linux/start_up.c +++ b/arch/um/os-Linux/start_up.c @@ -20,6 +20,7 @@ #include #include #include +#include #include #include #include diff --git a/arch/x86/um/asm/ptrace.h b/arch/x86/um/asm/ptrace.h index 83822fd42204..2fef3da55533 100644 --- a/arch/x86/um/asm/ptrace.h +++ b/arch/x86/um/asm/ptrace.h @@ -54,6 +54,8 @@ extern int ptrace_get_thread_area(struct task_struct *chi= ld, int idx, extern int ptrace_set_thread_area(struct task_struct *child, int idx, struct user_desc __user *user_desc); =20 +extern int arch_switch_tls(struct task_struct *to); + #else =20 #define PT_REGS_R8(r) UPT_R8(&(r)->regs) @@ -83,5 +85,9 @@ extern long arch_prctl(struct task_struct *task, int opti= on, unsigned long __user *addr); =20 #endif + #define user_stack_pointer(regs) PT_REGS_SP(regs) + +extern void arch_switch_to(struct task_struct *to); + #endif /* __UM_X86_PTRACE_H */ diff --git a/arch/x86/um/ptrace_32.c b/arch/x86/um/ptrace_32.c index 7f1abde2c84b..b0a71c6cdc6e 100644 --- a/arch/x86/um/ptrace_32.c +++ b/arch/x86/um/ptrace_32.c @@ -10,8 +10,6 @@ #include #include =20 -extern int arch_switch_tls(struct task_struct *to); - void arch_switch_to(struct task_struct *to) { int err =3D arch_switch_tls(to); --=20 2.34.1 From nobody Wed Dec 24 21:51:13 2025 Received: from out187-3.us.a.mail.aliyun.com (out187-3.us.a.mail.aliyun.com [47.90.187.3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B1B7E60B8E for ; Wed, 6 Mar 2024 10:35:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=47.90.187.3 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709721330; cv=none; b=bhe+ZwSKCtlGGckr5tfJP1w5U5KhyMqE0GfMRohp88E+28Acp7DZyK5PcMjTT1xGvBaUMyx9yJYPzudkStJUuJs98OuTMPWZGUU9KAPxJLOUvM1lUBWNllEz5vD+0pMJpsVb1Gdh+doPo81TgE8ZdZeGFXHMezVkh6q9Adku9WU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709721330; c=relaxed/simple; bh=O0NWohxWLhuPCPdgUtUvYLL8yZ/Ty6sMX82olIEuy3M=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=XooFPYSEydGyokgl6XKEOJiO8UzWccurg42inWoMq925dxQJTElTxhGu1325lm5ZR92IrzZHaTvdJgMifwxo1MyP0rmEKSam1frKIay9HWiofh7wXwzLut3O7mJJynIHoyylK7fbnsa870ryATrli3mQqYKElr+/QdMeHdKyJ4Y= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=antgroup.com; spf=pass smtp.mailfrom=antgroup.com; arc=none smtp.client-ip=47.90.187.3 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=antgroup.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=antgroup.com X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R181e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018047207;MF=tiwei.btw@antgroup.com;NM=1;PH=DS;RN=8;SR=0;TI=SMTPD_---.Wgbn-K1_1709720384; Received: from ubuntu..(mailfrom:tiwei.btw@antgroup.com fp:SMTPD_---.Wgbn-K1_1709720384) by smtp.aliyun-inc.com; Wed, 06 Mar 2024 18:19:44 +0800 From: "Tiwei Bie" To: richard@nod.at, anton.ivanov@cambridgegreys.com, johannes@sipsolutions.net Cc: , , , , "Tiwei Bie" Subject: [PATCH v3 8/9] um: Fix -Wmissing-prototypes warnings for text_poke* Date: Wed, 06 Mar 2024 18:19:24 +0800 Message-Id: <20240306101925.1088870-9-tiwei.btw@antgroup.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240306101925.1088870-1-tiwei.btw@antgroup.com> References: <20240306101925.1088870-1-tiwei.btw@antgroup.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable The prototypes for text_poke* are declared in asm/text-patching.h under arch/x86/include/. It's safe to include this header, as it's UML-aware (by checking CONFIG_UML_X86). This will address below -Wmissing-prototypes warnings: arch/um/kernel/um_arch.c:461:7: warning: no previous prototype for =E2=80= =98text_poke=E2=80=99 [-Wmissing-prototypes] arch/um/kernel/um_arch.c:473:6: warning: no previous prototype for =E2=80= =98text_poke_sync=E2=80=99 [-Wmissing-prototypes] Signed-off-by: Tiwei Bie Reviewed-by: Johannes Berg --- arch/um/kernel/um_arch.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/um/kernel/um_arch.c b/arch/um/kernel/um_arch.c index 7a9820797eae..e95f805e5004 100644 --- a/arch/um/kernel/um_arch.c +++ b/arch/um/kernel/um_arch.c @@ -23,6 +23,7 @@ #include #include #include +#include #include #include #include --=20 2.34.1 From nobody Wed Dec 24 21:51:13 2025 Received: from out0-208.mail.aliyun.com (out0-208.mail.aliyun.com [140.205.0.208]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2FF88605BD for ; Wed, 6 Mar 2024 10:35:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=140.205.0.208 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709721323; cv=none; b=PVbBdqt0e0eDHb1EIVrBk7fGmPMlUcVjiN9vi9l7eju7GcYLmF+ztOcjmrVXqUT1nHhxQu2/BxEiqZ7u9MDlcO1z9hj8eZFXYp9ZN5xYsT0meSDSBfkd3rRWgn79fKcxc48JpkjHYNs3dxx8PRSjwMKL1RKLnUDn2hDWCgYFYxo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709721323; c=relaxed/simple; bh=zBjAivud5mTNfsW4xRhvWvtLToxsTYEYwBbFkqAQ+MM=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=R5GqYu9yBqQcYElHzg5woCsuSwWikOosGot0t00zU2y6VVjvy9YDytA35mBEGZHW6fTYK29/hU/vetImVq9ZTD9XGChM5pTWl4bAW7rz6MYxKIMubS8WH4/eLRoRU4izNH4125LOLUOfoBhdqKqeHOExK4wDVEz2o6XRwpjHp2o= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=antgroup.com; spf=pass smtp.mailfrom=antgroup.com; arc=none smtp.client-ip=140.205.0.208 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=antgroup.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=antgroup.com X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R151e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018047205;MF=tiwei.btw@antgroup.com;NM=1;PH=DS;RN=8;SR=0;TI=SMTPD_---.Wgbn-K9_1709720384; Received: from ubuntu..(mailfrom:tiwei.btw@antgroup.com fp:SMTPD_---.Wgbn-K9_1709720384) by smtp.aliyun-inc.com; Wed, 06 Mar 2024 18:19:44 +0800 From: "Tiwei Bie" To: richard@nod.at, anton.ivanov@cambridgegreys.com, johannes@sipsolutions.net Cc: , , , , "Tiwei Bie" Subject: [PATCH v3 9/9] um: Fix -Wmissing-prototypes warnings for __warp_* and foo Date: Wed, 06 Mar 2024 18:19:25 +0800 Message-Id: <20240306101925.1088870-10-tiwei.btw@antgroup.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240306101925.1088870-1-tiwei.btw@antgroup.com> References: <20240306101925.1088870-1-tiwei.btw@antgroup.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable These functions are not called explicitly. Let's just workaround the -Wmissing-prototypes warnings by declaring them locally similar to what was done in arch/x86/kernel/asm-offsets_32.c. This will address below -Wmissing-prototypes warnings: ./arch/x86/um/shared/sysdep/kernel-offsets.h:9:6: warning: no previous prot= otype for =E2=80=98foo=E2=80=99 [-Wmissing-prototypes] arch/um/os-Linux/main.c:187:7: warning: no previous prototype for =E2=80=98= __wrap_malloc=E2=80=99 [-Wmissing-prototypes] arch/um/os-Linux/main.c:208:7: warning: no previous prototype for =E2=80=98= __wrap_calloc=E2=80=99 [-Wmissing-prototypes] arch/um/os-Linux/main.c:222:6: warning: no previous prototype for =E2=80=98= __wrap_free=E2=80=99 [-Wmissing-prototypes] arch/x86/um/user-offsets.c:17:6: warning: no previous prototype for =E2=80= =98foo=E2=80=99 [-Wmissing-prototypes] Signed-off-by: Tiwei Bie Reviewed-by: Johannes Berg --- arch/um/os-Linux/main.c | 5 +++++ arch/x86/um/shared/sysdep/kernel-offsets.h | 3 +++ arch/x86/um/user-offsets.c | 3 +++ 3 files changed, 11 insertions(+) diff --git a/arch/um/os-Linux/main.c b/arch/um/os-Linux/main.c index c8a42ecbd7a2..e82164f90288 100644 --- a/arch/um/os-Linux/main.c +++ b/arch/um/os-Linux/main.c @@ -184,6 +184,11 @@ int __init main(int argc, char **argv, char **envp) =20 extern void *__real_malloc(int); =20 +/* workaround for -Wmissing-prototypes warnings */ +void *__wrap_malloc(int size); +void *__wrap_calloc(int n, int size); +void __wrap_free(void *ptr); + void *__wrap_malloc(int size) { void *ret; diff --git a/arch/x86/um/shared/sysdep/kernel-offsets.h b/arch/x86/um/share= d/sysdep/kernel-offsets.h index a004bffb7b8d..48de3a71f845 100644 --- a/arch/x86/um/shared/sysdep/kernel-offsets.h +++ b/arch/x86/um/shared/sysdep/kernel-offsets.h @@ -6,6 +6,9 @@ #include #include =20 +/* workaround for a warning with -Wmissing-prototypes */ +void foo(void); + void foo(void) { #include diff --git a/arch/x86/um/user-offsets.c b/arch/x86/um/user-offsets.c index e54a9814ccf1..1c77d9946199 100644 --- a/arch/x86/um/user-offsets.c +++ b/arch/x86/um/user-offsets.c @@ -14,6 +14,9 @@ COMMENT(#val " / sizeof(unsigned long)"); \ DEFINE(sym, val / sizeof(unsigned long)) =20 +/* workaround for a warning with -Wmissing-prototypes */ +void foo(void); + void foo(void) { #ifdef __i386__ --=20 2.34.1