Skip to content

Commit 762a9f2

Browse files
committed
Merge tag 'for-linus-5.7-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rw/uml
Pull UML updates from Richard Weinberger: - New mode for time travel, external via virtio - Fixes for ubd to make sure no requests can get lost - Fixes for vector networking - Allow CONFIG_STATIC_LINK only when possible - Minor cleanups and fixes * tag 'for-linus-5.7-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rw/uml: um: Remove some unnecessary NULL checks in vector_user.c um: vector: Avoid NULL ptr deference if transport is unset um: Make CONFIG_STATIC_LINK actually static um: Implement cpu_relax() as ndelay(1) for time-travel um: Implement ndelay/udelay in time-travel mode um: Implement time-travel=ext um: virtio: Implement VHOST_USER_PROTOCOL_F_INBAND_NOTIFICATIONS um: time-travel: Rewrite as an event scheduler um: Move timer-internal.h to non-shared hostfs: Use kasprintf() instead of fixed buffer formatting um: falloc.h needs to be directly included for older libc um: ubd: Retry buffer read on any kind of error um: ubd: Prevent buffer overrun on command completion um: Fix overlapping ELF segments when statically linked um: Delete never executed timer um: Don't overwrite ethtool driver version um: Fix len of file in create_pid_file um: Don't use console_drivers directly um: Cleanup CONFIG_IOSCHED_CFQ
2 parents d5d2476 + 4a7c462 commit 762a9f2

File tree

26 files changed

+986
-214
lines changed

26 files changed

+986
-214
lines changed

arch/um/Kconfig

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,12 @@ config NR_CPUS
6262

6363
source "arch/$(HEADER_ARCH)/um/Kconfig"
6464

65+
config FORBID_STATIC_LINK
66+
bool
67+
6568
config STATIC_LINK
6669
bool "Force a static link"
67-
default n
70+
depends on !FORBID_STATIC_LINK
6871
help
6972
This option gives you the ability to force a static link of UML.
7073
Normally, UML is linked as a shared binary. This is inconvenient for
@@ -73,6 +76,9 @@ config STATIC_LINK
7376
Additionally, this option enables using higher memory spaces (up to
7477
2.75G) for UML.
7578

79+
NOTE: This option is incompatible with some networking features which
80+
depend on features that require being dynamically loaded (like NSS).
81+
7682
config LD_SCRIPT_STATIC
7783
bool
7884
default y
@@ -191,6 +197,7 @@ config UML_TIME_TRAVEL_SUPPORT
191197
prompt "Support time-travel mode (e.g. for test execution)"
192198
# inf-cpu mode is incompatible with the benchmarking
193199
depends on !RAID6_PQ_BENCHMARK
200+
depends on !SMP
194201
help
195202
Enable this option to support time travel inside the UML instance.
196203

arch/um/configs/i386_defconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ CONFIG_SLAB=y
2626
CONFIG_MODULES=y
2727
CONFIG_MODULE_UNLOAD=y
2828
# CONFIG_BLK_DEV_BSG is not set
29-
CONFIG_IOSCHED_CFQ=m
29+
CONFIG_IOSCHED_BFQ=m
3030
CONFIG_SSL=y
3131
CONFIG_NULL_CHAN=y
3232
CONFIG_PORT_CHAN=y

arch/um/configs/x86_64_defconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ CONFIG_SLAB=y
2424
CONFIG_MODULES=y
2525
CONFIG_MODULE_UNLOAD=y
2626
# CONFIG_BLK_DEV_BSG is not set
27-
CONFIG_IOSCHED_CFQ=m
27+
CONFIG_IOSCHED_BFQ=m
2828
CONFIG_SSL=y
2929
CONFIG_NULL_CHAN=y
3030
CONFIG_PORT_CHAN=y

arch/um/drivers/Kconfig

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,7 @@ config UML_NET_DAEMON
234234
config UML_NET_VECTOR
235235
bool "Vector I/O high performance network devices"
236236
depends on UML_NET
237+
select FORBID_STATIC_LINK
237238
help
238239
This User-Mode Linux network driver uses multi-message send
239240
and receive functions. The host running the UML guest must have
@@ -245,6 +246,7 @@ config UML_NET_VECTOR
245246
config UML_NET_VDE
246247
bool "VDE transport (obsolete)"
247248
depends on UML_NET
249+
select FORBID_STATIC_LINK
248250
help
249251
This User-Mode Linux network transport allows one or more running
250252
UMLs on a single host to communicate with each other and also
@@ -292,6 +294,7 @@ config UML_NET_MCAST
292294
config UML_NET_PCAP
293295
bool "pcap transport (obsolete)"
294296
depends on UML_NET
297+
select FORBID_STATIC_LINK
295298
help
296299
The pcap transport makes a pcap packet stream on the host look
297300
like an ethernet device inside UML. This is useful for making

arch/um/drivers/net_kern.c

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,6 @@ static void uml_net_get_drvinfo(struct net_device *dev,
266266
struct ethtool_drvinfo *info)
267267
{
268268
strlcpy(info->driver, DRIVER_NAME, sizeof(info->driver));
269-
strlcpy(info->version, "42", sizeof(info->version));
270269
}
271270

272271
static const struct ethtool_ops uml_net_ethtool_ops = {
@@ -275,17 +274,6 @@ static const struct ethtool_ops uml_net_ethtool_ops = {
275274
.get_ts_info = ethtool_op_get_ts_info,
276275
};
277276

278-
static void uml_net_user_timer_expire(struct timer_list *t)
279-
{
280-
#ifdef undef
281-
struct uml_net_private *lp = from_timer(lp, t, tl);
282-
struct connection *conn = &lp->user;
283-
284-
dprintk(KERN_INFO "uml_net_user_timer_expire [%p]\n", conn);
285-
do_connect(conn);
286-
#endif
287-
}
288-
289277
void uml_net_setup_etheraddr(struct net_device *dev, char *str)
290278
{
291279
unsigned char *addr = dev->dev_addr;
@@ -456,7 +444,6 @@ static void eth_configure(int n, void *init, char *mac,
456444
.add_address = transport->user->add_address,
457445
.delete_address = transport->user->delete_address });
458446

459-
timer_setup(&lp->tl, uml_net_user_timer_expire, 0);
460447
spin_lock_init(&lp->lock);
461448
memcpy(lp->mac, dev->dev_addr, sizeof(lp->mac));
462449

arch/um/drivers/ubd_kern.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1592,11 +1592,11 @@ int io_thread(void *arg)
15921592
&io_remainder_size,
15931593
UBD_REQ_BUFFER_SIZE
15941594
);
1595-
if (n < 0) {
1596-
if (n == -EAGAIN) {
1595+
if (n <= 0) {
1596+
if (n == -EAGAIN)
15971597
ubd_read_poll(-1);
1598-
continue;
1599-
}
1598+
1599+
continue;
16001600
}
16011601

16021602
for (count = 0; count < n/sizeof(struct io_thread_req *); count++) {
@@ -1607,7 +1607,9 @@ int io_thread(void *arg)
16071607
written = 0;
16081608

16091609
do {
1610-
res = os_write_file(kernel_fd, ((char *) io_req_buffer) + written, n);
1610+
res = os_write_file(kernel_fd,
1611+
((char *) io_req_buffer) + written,
1612+
n - written);
16111613
if (res >= 0) {
16121614
written += res;
16131615
}

arch/um/drivers/vector_kern.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@
4646

4747

4848
#define DRIVER_NAME "uml-vector"
49-
#define DRIVER_VERSION "01"
5049
struct vector_cmd_line_arg {
5150
struct list_head list;
5251
int unit;
@@ -198,6 +197,9 @@ static int get_transport_options(struct arglist *def)
198197
long parsed;
199198
int result = 0;
200199

200+
if (transport == NULL)
201+
return -EINVAL;
202+
201203
if (vector != NULL) {
202204
if (kstrtoul(vector, 10, &parsed) == 0) {
203205
if (parsed == 0) {
@@ -1378,7 +1380,6 @@ static void vector_net_get_drvinfo(struct net_device *dev,
13781380
struct ethtool_drvinfo *info)
13791381
{
13801382
strlcpy(info->driver, DRIVER_NAME, sizeof(info->driver));
1381-
strlcpy(info->version, DRIVER_VERSION, sizeof(info->version));
13821383
}
13831384

13841385
static int vector_net_load_bpf_flash(struct net_device *dev,

arch/um/drivers/vector_user.c

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -221,8 +221,7 @@ static struct vector_fds *user_init_tap_fds(struct arglist *ifspec)
221221
return result;
222222
tap_cleanup:
223223
printk(UM_KERN_ERR "user_init_tap: init failed, error %d", fd);
224-
if (result != NULL)
225-
kfree(result);
224+
kfree(result);
226225
return NULL;
227226
}
228227

@@ -266,8 +265,7 @@ static struct vector_fds *user_init_hybrid_fds(struct arglist *ifspec)
266265
return result;
267266
hybrid_cleanup:
268267
printk(UM_KERN_ERR "user_init_hybrid: init failed");
269-
if (result != NULL)
270-
kfree(result);
268+
kfree(result);
271269
return NULL;
272270
}
273271

@@ -344,10 +342,8 @@ static struct vector_fds *user_init_unix_fds(struct arglist *ifspec, int id)
344342
unix_cleanup:
345343
if (fd >= 0)
346344
os_close_file(fd);
347-
if (remote_addr != NULL)
348-
kfree(remote_addr);
349-
if (result != NULL)
350-
kfree(result);
345+
kfree(remote_addr);
346+
kfree(result);
351347
return NULL;
352348
}
353349

@@ -382,8 +378,7 @@ static struct vector_fds *user_init_raw_fds(struct arglist *ifspec)
382378
return result;
383379
raw_cleanup:
384380
printk(UM_KERN_ERR "user_init_raw: init failed, error %d", err);
385-
if (result != NULL)
386-
kfree(result);
381+
kfree(result);
387382
return NULL;
388383
}
389384

arch/um/drivers/vhost_user.h

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,10 @@
1010
/* Feature bits */
1111
#define VHOST_USER_F_PROTOCOL_FEATURES 30
1212
/* Protocol feature bits */
13-
#define VHOST_USER_PROTOCOL_F_REPLY_ACK 3
14-
#define VHOST_USER_PROTOCOL_F_SLAVE_REQ 5
15-
#define VHOST_USER_PROTOCOL_F_CONFIG 9
13+
#define VHOST_USER_PROTOCOL_F_REPLY_ACK 3
14+
#define VHOST_USER_PROTOCOL_F_SLAVE_REQ 5
15+
#define VHOST_USER_PROTOCOL_F_CONFIG 9
16+
#define VHOST_USER_PROTOCOL_F_INBAND_NOTIFICATIONS 14
1617
/* Vring state index masks */
1718
#define VHOST_USER_VRING_INDEX_MASK 0xff
1819
#define VHOST_USER_VRING_POLL_MASK BIT(8)
@@ -24,7 +25,8 @@
2425
/* Supported protocol features */
2526
#define VHOST_USER_SUPPORTED_PROTOCOL_F (BIT_ULL(VHOST_USER_PROTOCOL_F_REPLY_ACK) | \
2627
BIT_ULL(VHOST_USER_PROTOCOL_F_SLAVE_REQ) | \
27-
BIT_ULL(VHOST_USER_PROTOCOL_F_CONFIG))
28+
BIT_ULL(VHOST_USER_PROTOCOL_F_CONFIG) | \
29+
BIT_ULL(VHOST_USER_PROTOCOL_F_INBAND_NOTIFICATIONS))
2830

2931
enum vhost_user_request {
3032
VHOST_USER_GET_FEATURES = 1,
@@ -52,12 +54,14 @@ enum vhost_user_request {
5254
VHOST_USER_SET_VRING_ENDIAN = 23,
5355
VHOST_USER_GET_CONFIG = 24,
5456
VHOST_USER_SET_CONFIG = 25,
57+
VHOST_USER_VRING_KICK = 35,
5558
};
5659

5760
enum vhost_user_slave_request {
5861
VHOST_USER_SLAVE_IOTLB_MSG = 1,
5962
VHOST_USER_SLAVE_CONFIG_CHANGE_MSG = 2,
6063
VHOST_USER_SLAVE_VRING_HOST_NOTIFIER_MSG = 3,
64+
VHOST_USER_SLAVE_VRING_CALL = 4,
6165
};
6266

6367
struct vhost_user_header {

0 commit comments

Comments
 (0)