um: build and irq fixes
cover um: build and irq fixes
From: Bartosz Golaszewski <[email protected]>
I've previously sent these patches separately. I still don't see them in next and I don't know what the policy is for picking up uml patches but I thought I'd resend them rebased together on top of v5.1-rc3.
Bartosz Golaszewski (4):
um: remove unused variable
um: remove uses of variable length arrays
um: define set_pte_at() as a static inline function, not a macro
um: irq: don't set the chip for all irqs
arch/um/include/asm/pgtable.h | 7 ++++++- arch/um/kernel/irq.c | 2 +- arch/um/kernel/skas/uaccess.c | 1 - arch/um/os-Linux/umid.c | 36 ++++++++++++++++++++++++++--------- 4 files changed, 34 insertions(+), 12 deletions(-)
Signature · 1 line
2.21.0
PATCH RESEND 1/4 um: remove unused variable
From: Bartosz Golaszewski <[email protected]>
The buf variable is unused. Remove it.
--- arch/um/kernel/skas/uaccess.c | 1 - 1 file changed, 1 deletion(-)
arch/um/kernel/skas/uaccess.c +0 -1
@@ -59,7 +59,6 @@ static pte_t *maybe_map(unsigned long virt, int is_write)static int do_op_one_page (unsigned long addr,int len,int is_write,int (*op)(unsigned long addr,int len,void *arg),void *arg) { -jmp_buf buf;struct page *page;pte_t *pte;int n;
Signature · 1 line
2.21.0
PATCH RESEND 2/4 um: remove uses of variable length arrays
In reply to Bartosz GolaszewskiFrom: Bartosz Golaszewski <[email protected]>
While the affected code is run in user-mode, the build still warns about it. Convert all uses of VLA to dynamic allocations.
--- arch/um/os-Linux/umid.c | 36 +++++++++++++++++++++++++++--------- 1 file changed, 27 insertions(+), 9 deletions(-)
arch/um/os-Linux/umid.c +27 -9
@@ -135,12 +135,18 @@ static int remove_files_and_dir(char *dir)*/ static inline int is_umdir_used (char *dir) { -char file[strlen (uml_dir) +UMID_LEN +sizeof ("/pid\0" )]; -char pid[sizeof ("nnnnn\0" )], *end; +char pid[sizeof ("nnnnn\0" )], *end, *file;int dead, fd, p, n, err; +size_t filelen; - n =snprintf (file,sizeof (file),"%s/pid" , dir); -if (n >=sizeof (file)) { + err =asprintf (&file,"%s/pid" , dir); +if (err <0 ) +return 0 ; + + filelen =strlen (file); + + n =snprintf (file, filelen,"%s/pid" , dir); +if (n >= filelen) {printk (UM_KERN_ERR "is_umdir_used - pid filename too long\n" ); err = -E2BIG ; goto out;
@@ -185,6 +191,7 @@ static inline int is_umdir_used(char *dir) out_close:close (fd); out: +free (file);return 0 ; }
@@ -210,18 +217,21 @@ static int umdir_take_if_dead(char *dir)static void __init create_pid_file (void ) { -char file[strlen (uml_dir) +UMID_LEN +sizeof ("/pid\0" )]; -char pid[sizeof ("nnnnn\0" )]; +char pid[sizeof ("nnnnn\0" )], *file;int fd, n; -if (umid_file_name ("pid" , file,sizeof (file))) + file =malloc (strlen (uml_dir) +UMID_LEN +sizeof ("/pid\0" )); +if (!file)return ; +if (umid_file_name ("pid" , file,sizeof (file))) + goto out; + fd =open (file,O_RDWR |O_CREAT |O_EXCL ,0644 );if (fd <0 ) {printk (UM_KERN_ERR "Open of machine pid file \"%s\" failed: " "%s\n" , file,strerror (errno)); -return ; + goto out; }snprintf (pid,sizeof (pid),"%d\n" ,getpid ());
@@ -231,6 +241,8 @@ static void __init create_pid_file(void) errno);close (fd); +out: +free (file); }int __init set_umid (char *name)
@@ -385,13 +397,19 @@ __uml_setup("uml_dir=", set_uml_dir,static void remove_umid_dir (void ) { -char dir[strlen (uml_dir) +UMID_LEN +1 ], err; +char *dir, err; + + dir =malloc (strlen (uml_dir) +UMID_LEN +1 ); +if (!dir) +return ;sprintf (dir,"%s%s" , uml_dir, umid); err =remove_files_and_dir (dir);if (err)os_warn ("%s - remove_files_and_dir failed with err = %d\n" , __func__, err); + +free (dir); }__uml_exitcall (remove_umid_dir);
Signature · 1 line
2.21.0
PATCH RESEND 3/4 um: define set_pte_at() as a static inline function, not a macro
In reply to Bartosz GolaszewskiFrom: Bartosz Golaszewski <[email protected]>
When defined as macro, the mm argument is unused and subsequently the variable passed as mm is considered unused by the compiler. This fixes a build warning.
--- arch/um/include/asm/pgtable.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
arch/um/include/asm/pgtable.h +6 -1
@@ -263,7 +263,12 @@ static inline void set_pte(pte_t *pteptr, pte_t pteval) *pteptr =pte_mknewpage (*pteptr);if (pte_present (*pteptr)) *pteptr =pte_mknewprot (*pteptr); } -#define set_pte_at (mm,addr,ptep,pteval) set_pte(ptep,pteval) + +static inline void set_pte_at (struct mm_struct *mm,unsigned long addr, +pte_t *pteptr,pte_t pteval) +{ +set_pte (pteptr, pteval); +}#define __HAVE_ARCH_PTE_SAMEstatic inline int pte_same (pte_t pte_a,pte_t pte_b)
Signature · 1 line
2.21.0
PATCH RESEND 4/4 um: irq: don't set the chip for all irqs
In reply to Bartosz GolaszewskiFrom: Bartosz Golaszewski <[email protected]>
Setting a chip for an interrupt marks it as allocated. Since UM doesn't support dynamic interrupt numbers (yet), it means we cannot simply increase NR_IRQS and then use the free irqs between LAST_IRQ and NR_IRQS with gpio-mockup or iio testing drivers as irq_alloc_descs() will fail after not being able to neither find an unallocated range of interrupts nor expand the range.
Only call irq_set_chip_and_handler() for irqs until LAST_IRQ.
--- arch/um/kernel/irq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/um/kernel/irq.c +1 -1
@@ -479,7 +479,7 @@ void __init init_IRQ(void)irq_set_chip_and_handler (TIMER_IRQ , &SIGVTALRM_irq_type, handle_edge_irq); -for (i =1 ; i <NR_IRQS ; i++) +for (i =1 ; i <LAST_IRQ ; i++)irq_set_chip_and_handler (i, &normal_irq_type, handle_edge_irq);/* Initialize EPOLL Loop */ os_setup_epoll ();
Signature · 1 line
2.21.0
śr., 3 kwi 2019 o 10:39 Bartosz Golaszewski <[email protected]> napisał(a):
Quoted 7 lines
From: Bartosz Golaszewski <[email protected]>
I've previously sent these patches separately. I still don't see them in next and I don't know what the policy is for picking up uml patches but I thought I'd resend them rebased together on top of v5.1-rc3.
And of course I forgot to pick up acks from Anton...
Quoted 15 lines
Bartosz Golaszewski (4):
um: remove unused variable
um: remove uses of variable length arrays
um: defineset_pte_at()as a static inline function, not a macro
um: irq: don't set the chip for all irqsarch/um/include/asm/pgtable.h | 7 ++++++- arch/um/kernel/irq.c | 2 +- arch/um/kernel/skas/uaccess.c | 1 - arch/um/os-Linux/umid.c | 36 ++++++++++++++++++++++++++--------- 4 files changed, 34 insertions(+), 12 deletions(-)--
2.21.0
Anton Ivanov
maintainerQuoted 9 lines · Bartosz Golaszewski
śr., 3 kwi 2019 o 10:39 Bartosz Golaszewski <[email protected]> napisał(a):
Quoted 7 lines
From: Bartosz Golaszewski <[email protected]>
I've previously sent these patches separately. I still don't see them in next and I don't know what the policy is for picking up uml patches but I thought I'd resend them rebased together on top of v5.1-rc3.
I test and ack stuff to the extent I can (especially the areas which I have worked on recently). Richard has the final say for what goes in on the next merge and he does it based on his own and my testing and/or markings in patchwork.
Quoted 1 line
And of course I forgot to pick up acks from Anton...
Indeed - I have acked some of these :)
Quoted 22 lines
Quoted 7 lines
Bartosz Golaszewski (4):
um: remove unused variable
um: remove uses of variable length arrays
um: defineset_pte_at()as a static inline function, not a macro
um: irq: don't set the chip for all irqsQuoted 9 lines
arch/um/include/asm/pgtable.h | 7 ++++++- arch/um/kernel/irq.c | 2 +- arch/um/kernel/skas/uaccess.c | 1 - arch/um/os-Linux/umid.c | 36 ++++++++++++++++++++++++++--------- 4 files changed, 34 insertions(+), 12 deletions(-)--
2.21.0_______________________________________________
linux-um mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-um
Signature · 3 lines
Anton R. Ivanov Cambridgegreys Limited. Registered in England. Company Number 10273661 https://www.cambridgegreys.com/