Skip to content

Commit 6155670

Browse files
committed
Merge tag 'for-linus-5.11-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/rw/uml
Pull UML fixes from Richard Weinberger: - Make sure to set a default console, otherwise ttynull is selected - Revert initial ARCH_HAS_SET_MEMORY support, this needs more work - Fix a regression due to ubd refactoring - Various small fixes * tag 'for-linus-5.11-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/rw/uml: um: time: fix initialization in time-travel mode um: fix os_idle_sleep() to not hang Revert "um: support some of ARCH_HAS_SET_MEMORY" Revert "um: allocate a guard page to helper threads" um: virtio: free vu_dev only with the contained struct device um: kmsg_dumper: always dump when not tty console um: stdio_console: Make preferred console um: return error from ioremap() um: ubd: fix command line handling of ubd
2 parents 3afe907 + 7f34142 commit 6155670

File tree

14 files changed

+84
-99
lines changed

14 files changed

+84
-99
lines changed

arch/um/Kconfig

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ config UML
1515
select HAVE_DEBUG_KMEMLEAK
1616
select HAVE_DEBUG_BUGVERBOSE
1717
select NO_DMA
18-
select ARCH_HAS_SET_MEMORY
1918
select GENERIC_IRQ_SHOW
2019
select GENERIC_CPU_DEVICES
2120
select HAVE_GCC_PLUGINS

arch/um/drivers/ubd_kern.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -375,11 +375,11 @@ static int ubd_setup_common(char *str, int *index_out, char **error_out)
375375
file = NULL;
376376

377377
backing_file = strsep(&str, ",:");
378-
if (*backing_file == '\0')
378+
if (backing_file && *backing_file == '\0')
379379
backing_file = NULL;
380380

381381
serial = strsep(&str, ",:");
382-
if (*serial == '\0')
382+
if (serial && *serial == '\0')
383383
serial = NULL;
384384

385385
if (backing_file && ubd_dev->no_cow) {
@@ -1241,7 +1241,7 @@ static int __init ubd_driver_init(void){
12411241
/* Letting ubd=sync be like using ubd#s= instead of ubd#= is
12421242
* enough. So use anyway the io thread. */
12431243
}
1244-
stack = alloc_stack(0);
1244+
stack = alloc_stack(0, 0);
12451245
io_pid = start_io_thread(stack + PAGE_SIZE - sizeof(void *),
12461246
&thread_fd);
12471247
if(io_pid < 0){

arch/um/drivers/virtio_uml.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1084,6 +1084,7 @@ static void virtio_uml_release_dev(struct device *d)
10841084
}
10851085

10861086
os_close_file(vu_dev->sock);
1087+
kfree(vu_dev);
10871088
}
10881089

10891090
/* Platform device */
@@ -1097,7 +1098,7 @@ static int virtio_uml_probe(struct platform_device *pdev)
10971098
if (!pdata)
10981099
return -EINVAL;
10991100

1100-
vu_dev = devm_kzalloc(&pdev->dev, sizeof(*vu_dev), GFP_KERNEL);
1101+
vu_dev = kzalloc(sizeof(*vu_dev), GFP_KERNEL);
11011102
if (!vu_dev)
11021103
return -ENOMEM;
11031104

arch/um/include/asm/io.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#define ioremap ioremap
66
static inline void __iomem *ioremap(phys_addr_t offset, size_t size)
77
{
8-
return (void __iomem *)(unsigned long)offset;
8+
return NULL;
99
}
1010

1111
#define iounmap iounmap

arch/um/include/asm/pgtable.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,15 +55,12 @@ extern unsigned long end_iomem;
5555
#define _PAGE_CHG_MASK (PAGE_MASK | _PAGE_ACCESSED | _PAGE_DIRTY)
5656
#define __PAGE_KERNEL_EXEC \
5757
(_PAGE_PRESENT | _PAGE_RW | _PAGE_DIRTY | _PAGE_ACCESSED)
58-
#define __PAGE_KERNEL_RO \
59-
(_PAGE_PRESENT | _PAGE_DIRTY | _PAGE_ACCESSED)
6058
#define PAGE_NONE __pgprot(_PAGE_PROTNONE | _PAGE_ACCESSED)
6159
#define PAGE_SHARED __pgprot(_PAGE_PRESENT | _PAGE_RW | _PAGE_USER | _PAGE_ACCESSED)
6260
#define PAGE_COPY __pgprot(_PAGE_PRESENT | _PAGE_USER | _PAGE_ACCESSED)
6361
#define PAGE_READONLY __pgprot(_PAGE_PRESENT | _PAGE_USER | _PAGE_ACCESSED)
6462
#define PAGE_KERNEL __pgprot(_PAGE_PRESENT | _PAGE_RW | _PAGE_DIRTY | _PAGE_ACCESSED)
6563
#define PAGE_KERNEL_EXEC __pgprot(__PAGE_KERNEL_EXEC)
66-
#define PAGE_KERNEL_RO __pgprot(__PAGE_KERNEL_RO)
6764

6865
/*
6966
* The i386 can't do page protection for execute, and considers that the same

arch/um/include/asm/set_memory.h

Lines changed: 0 additions & 1 deletion
This file was deleted.

arch/um/include/shared/kern_util.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ extern int kmalloc_ok;
1919
#define UML_ROUND_UP(addr) \
2020
((((unsigned long) addr) + PAGE_SIZE - 1) & PAGE_MASK)
2121

22-
extern unsigned long alloc_stack(int atomic);
22+
extern unsigned long alloc_stack(int order, int atomic);
2323
extern void free_stack(unsigned long stack, int order);
2424

2525
struct pt_regs;

arch/um/kernel/kmsg_dump.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// SPDX-License-Identifier: GPL-2.0
22
#include <linux/kmsg_dump.h>
33
#include <linux/console.h>
4+
#include <linux/string.h>
45
#include <shared/init.h>
56
#include <shared/kern.h>
67
#include <os.h>
@@ -16,8 +17,12 @@ static void kmsg_dumper_stdout(struct kmsg_dumper *dumper,
1617
if (!console_trylock())
1718
return;
1819

19-
for_each_console(con)
20-
break;
20+
for_each_console(con) {
21+
if(strcmp(con->name, "tty") == 0 &&
22+
(con->flags & (CON_ENABLED | CON_CONSDEV)) != 0) {
23+
break;
24+
}
25+
}
2126

2227
console_unlock();
2328

arch/um/kernel/process.c

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
#include <os.h>
3333
#include <skas.h>
3434
#include <linux/time-internal.h>
35-
#include <asm/set_memory.h>
3635

3736
/*
3837
* This is a per-cpu array. A processor only modifies its entry and it only
@@ -63,18 +62,16 @@ void free_stack(unsigned long stack, int order)
6362
free_pages(stack, order);
6463
}
6564

66-
unsigned long alloc_stack(int atomic)
65+
unsigned long alloc_stack(int order, int atomic)
6766
{
68-
unsigned long addr;
67+
unsigned long page;
6968
gfp_t flags = GFP_KERNEL;
7069

7170
if (atomic)
7271
flags = GFP_ATOMIC;
73-
addr = __get_free_pages(flags, 1);
72+
page = __get_free_pages(flags, order);
7473

75-
set_memory_ro(addr, 1);
76-
77-
return addr + PAGE_SIZE;
74+
return page;
7875
}
7976

8077
static inline void set_current(struct task_struct *task)

arch/um/kernel/time.c

Lines changed: 31 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -535,6 +535,31 @@ static int time_travel_connect_external(const char *socket)
535535

536536
return 1;
537537
}
538+
539+
static void time_travel_set_start(void)
540+
{
541+
if (time_travel_start_set)
542+
return;
543+
544+
switch (time_travel_mode) {
545+
case TT_MODE_EXTERNAL:
546+
time_travel_start = time_travel_ext_req(UM_TIMETRAVEL_GET_TOD, -1);
547+
/* controller gave us the *current* time, so adjust by that */
548+
time_travel_ext_get_time();
549+
time_travel_start -= time_travel_time;
550+
break;
551+
case TT_MODE_INFCPU:
552+
case TT_MODE_BASIC:
553+
if (!time_travel_start_set)
554+
time_travel_start = os_persistent_clock_emulation();
555+
break;
556+
case TT_MODE_OFF:
557+
/* we just read the host clock with os_persistent_clock_emulation() */
558+
break;
559+
}
560+
561+
time_travel_start_set = true;
562+
}
538563
#else /* CONFIG_UML_TIME_TRAVEL_SUPPORT */
539564
#define time_travel_start_set 0
540565
#define time_travel_start 0
@@ -553,6 +578,10 @@ static void time_travel_set_interval(unsigned long long interval)
553578
{
554579
}
555580

581+
static inline void time_travel_set_start(void)
582+
{
583+
}
584+
556585
/* fail link if this actually gets used */
557586
extern u64 time_travel_ext_req(u32 op, u64 time);
558587

@@ -731,6 +760,8 @@ void read_persistent_clock64(struct timespec64 *ts)
731760
{
732761
long long nsecs;
733762

763+
time_travel_set_start();
764+
734765
if (time_travel_mode != TT_MODE_OFF)
735766
nsecs = time_travel_start + time_travel_time;
736767
else
@@ -742,25 +773,6 @@ void read_persistent_clock64(struct timespec64 *ts)
742773

743774
void __init time_init(void)
744775
{
745-
#ifdef CONFIG_UML_TIME_TRAVEL_SUPPORT
746-
switch (time_travel_mode) {
747-
case TT_MODE_EXTERNAL:
748-
time_travel_start = time_travel_ext_req(UM_TIMETRAVEL_GET_TOD, -1);
749-
/* controller gave us the *current* time, so adjust by that */
750-
time_travel_ext_get_time();
751-
time_travel_start -= time_travel_time;
752-
break;
753-
case TT_MODE_INFCPU:
754-
case TT_MODE_BASIC:
755-
if (!time_travel_start_set)
756-
time_travel_start = os_persistent_clock_emulation();
757-
break;
758-
case TT_MODE_OFF:
759-
/* we just read the host clock with os_persistent_clock_emulation() */
760-
break;
761-
}
762-
#endif
763-
764776
timer_set_signal_handler();
765777
late_time_init = um_timer_setup;
766778
}

0 commit comments

Comments
 (0)