Skip to content

Commit 047fcbb

Browse files
mikechristieBrian Maly
authored andcommitted
vhost-scsi: Change def inline_sg_cnt and max_io_vqs for exadata
Upstream we set inline_sg_cnt and max_io_vqs based on their original values and concerns about regressions: max_io_vqs - If a user tries to create more than max_io_vqs then the device setup will fail and QEMU will fail to start. Upstream this is 128 because since mq was added this was the default. If we change it too low, then VMs will fail to start. For exadata, this is their first time using vhost-scsi so we can set it low. Their primary concern is mem use so we set it to 1. inline_sg_cnt - If a user has a really high perf setup (multiple LUNs per vhost-scsi device with fast backend devices) then there was a concern they could see a regression if we lower this too low. Upstream it was left as the original value. For exadata, their primary concern is mem use so we set this to not preallocate any memory for command's scatterlists. We will use whatever memory is available when performing IO. Orabug: 38099086 Signed-off-by: Mike Christie <[email protected]> Reviewed-by: Boris Ostrovsky <[email protected]> Signed-off-by: Brian Maly <[email protected]>
1 parent 83560c9 commit 047fcbb

File tree

1 file changed

+32
-2
lines changed

1 file changed

+32
-2
lines changed

drivers/vhost/scsi.c

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
*/
5252
#define VHOST_SCSI_MAX_RESP_IOVS sizeof(struct virtio_scsi_cmd_resp)
5353

54-
static unsigned int vhost_scsi_inline_sg_cnt = VHOST_SCSI_PREALLOC_SGLS;
54+
static unsigned int vhost_scsi_inline_sg_cnt = UINT_MAX;
5555

5656
#ifdef CONFIG_ARCH_NO_SG_CHAIN
5757
static int vhost_scsi_set_inline_sg_cnt(const char *buf,
@@ -199,10 +199,11 @@ enum {
199199
};
200200

201201
#define VHOST_SCSI_MAX_TARGET 256
202+
#define VHOST_SCSI_DEF_IO_VQ 128
202203
#define VHOST_SCSI_MAX_IO_VQ 1024
203204
#define VHOST_SCSI_MAX_EVENT 128
204205

205-
static unsigned vhost_scsi_max_io_vqs = 128;
206+
static unsigned vhost_scsi_max_io_vqs = UINT_MAX;
206207
module_param_named(max_io_vqs, vhost_scsi_max_io_vqs, uint, 0644);
207208
MODULE_PARM_DESC(max_io_vqs, "Set the max number of IO virtqueues a vhost scsi device can support. The default is 128. The max is 1024.");
208209

@@ -2811,6 +2812,35 @@ static int __init vhost_scsi_init(void)
28112812
{
28122813
int ret = -ENOMEM;
28132814

2815+
2816+
if (static_branch_unlikely(&on_exadata)) {
2817+
/*
2818+
* We can't change the upstream default because existing users
2819+
* with more than 1 queue will hit failures during device
2820+
* setup. Exadata has never used vhost-scsi before so it's ok
2821+
* to start them at 1 so they can use as little mem as possible
2822+
* initially.
2823+
*/
2824+
if (vhost_scsi_max_io_vqs == UINT_MAX)
2825+
vhost_scsi_max_io_vqs = 1;
2826+
/*
2827+
* We have not changed the upstream default because there's
2828+
* a chance of a perf regression if there are users doing
2829+
* muiltiple LUNs per vhost-scsi device and using high perf
2830+
* devices for the backends. For exadata we use 0, because
2831+
* their primary concern is memory use.
2832+
*/
2833+
if (vhost_scsi_inline_sg_cnt == UINT_MAX)
2834+
vhost_scsi_inline_sg_cnt = 0;
2835+
} else {
2836+
if (vhost_scsi_max_io_vqs == UINT_MAX)
2837+
vhost_scsi_max_io_vqs = VHOST_SCSI_DEF_IO_VQ;
2838+
2839+
if (vhost_scsi_inline_sg_cnt == UINT_MAX)
2840+
vhost_scsi_inline_sg_cnt = VHOST_SCSI_PREALLOC_SGLS;
2841+
}
2842+
2843+
28142844
pr_debug("TCM_VHOST fabric module %s on %s/%s"
28152845
" on "UTS_RELEASE"\n", VHOST_SCSI_VERSION, utsname()->sysname,
28162846
utsname()->machine);

0 commit comments

Comments
 (0)