From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=95.215.58.213 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796104492; b=m0/loci4J7r8btZezcI7gCkoqoKf0ESYCv92eC7M9OhhLF8/96LuZ6NR6UCHZzVm1L9O MpJDRDWi3aj+e0R1486dqfJLf5G74EkbVbUrdR4PjWWmwenJDG1uLqagJMXjmYjzjOW+l QiYMn4w4zSx87LQ4O5h4zaeTNxwb+6Io51MyXL0uvAl3g2h04krmvNUgqtdB81xUvmKDM 0MdcKRYJEhFxUcBuRVWrS1OjFDZVWUpaz2CM3+kAjsvrQw7HEMnu0VQLqnI+8lm7/ZKFF e7KsGmHCyvhh9p5DtaeVBXG9B4NIarx5/X6ThfQVGlwHEL4r+8agP+trLgcpcuNR8VQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796104492; h=DMARC-Filter:X-Envelope-To:DKIM-Signature:X-Envelope-To:Received: X-Mizu-Trace-ID:X-Migadu-Flow:From:To:Cc:Subject:Date:Message-ID: X-Mailer:MIME-Version:Content-Transfer-Encoding; bh=4bzgOukGzsPW2Jpue2sRpBVxrzQ4IR8KoVH3nMnmJM4=; b=XcWPtFXB5oj8sUyr7f5pKEQ9zg8FSBNM9J6Gux0U+gMvUS7Q20o7JOi8CwQfA7V3sqw6 GMD+8C/wbaT7XTOIJ7hs+ZKxZut5tiWLQoegWDNUYjuhpbRoT6sD1i20ROJ6l1p3osC3d h2WMfyq5xN/ZK5pdPiUEAHpjlUc4lz1h3p8ewcVWWZVk9u+fQit5eshyH6XU0uy7rptFf VT6lDcUcs0TDup/IBznO9pdOh4aQAv8ocNAtxKgc8lOQ3nrj/wxiTFKWIgdULFet40zfM E47AJFyMUNP4xy3S7YIGLuM/qZtAkypWYKotFue8+YyP2xxc8KG3bKnXC8cCOmiKeBw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass header.d=linux.dev header.i=@linux.dev header.a=rsa-sha256 header.s=key1 header.b=bZIKGyPr; arc=none smtp.remote-ip=95.215.58.213 Received: from mta1.migadu.com (out-213.mta1.migadu.com [95.215.58.213]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7223A606A31A for ; Tue, 1 Dec 2026 05:54:50 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 7223A606A31A Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key, unprotected) header.d=linux.dev header.i=@linux.dev header.a=rsa-sha256 header.s=key1 header.b=bZIKGyPr X-Envelope-To: linux-cifs@vger.kernel.org DKIM-Signature: a=rsa-sha256; bh=aP4Pc6mdpT4jA83AkRy1A/VPNIYG6S2KdlXNHMUPKHE=; c=simple/simple; d=linux.dev; h=from:to:subject:date:message-id:mime-version:content-type; s=key1; t=1796104489; v=1; x=1796709289; b=bZIKGyPrG0UEXX3kS2rpDqDoAqfatQ1KbFnzIHBf4uvKoP4RNYoIdH+935Ml5GPD8QkCsfxg WaDCa0waxnbr3dNIOChm197twUsi/F3/isyzmbSkjlCShAl6ARpPn2ovKzU3vgMkTFIr5KsLwar OymxqNAjfuGWobFLxhzZuZ8w= X-Envelope-To: linux-cifs@vger.kernel.org Received: by smtp.migadu.com with ESMTPS id 3209aa5306cfaaf8; Tue, 01 Dec 2026 05:54:49 +0000 X-Mizu-Trace-ID: 3209aa5306cfaaf8 X-Migadu-Flow: FLOW_OUT From: Huiwen He To: linux-cifs@vger.kernel.org Cc: linkinjeon@kernel.org, stefan.chulski@broadcom.com, chenxiaosong@chenxiaosong.com Subject: [PATCH] ksmbd-tools: add the "server request workqueue" option Date: Tue, 1 Dec 2026 13:54:29 +0800 Message-ID: <20261201055429.2235941-1-huiwen.he@linux.dev> X-Mailer: git-send-email 2.43.0 X-Mailing-List: linux-cifs@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Huiwen He Let administrators select the kernel workqueue for incoming SMB requests through ksmbd.conf. The global option accepts "percpu" (the default) or "unbound" and takes effect at server startup. Pass the selected mode to the kernel in the last reserved byte of the startup request. Signed-off-by: Huiwen He --- include/linux/ksmbd_server.h | 8 +++++++- include/tools.h | 1 + ksmbd.conf.5.in | 9 +++++++++ ksmbd.conf.example | 1 + mountd/ipc.c | 1 + tools/config_parser.c | 13 +++++++++++++ 6 files changed, 32 insertions(+), 1 deletion(-) diff --git a/include/linux/ksmbd_server.h b/include/linux/ksmbd_server.h index a712911..63cc06b 100644 --- a/include/linux/ksmbd_server.h +++ b/include/linux/ksmbd_server.h @@ -35,6 +35,11 @@ struct ksmbd_heartbeat { #define KSMBD_GLOBAL_FLAG_SMB3_ENCRYPTION_OFF (1 << 3) #define KSMBD_GLOBAL_FLAG_DURABLE_HANDLES (1 << 4) +enum ksmbd_wq_mode { + KSMBD_WQ_PERCPU = 0, + KSMBD_WQ_UNBOUND = 1, +}; + struct ksmbd_startup_request { __u32 flags; __s32 signing; @@ -59,7 +64,8 @@ struct ksmbd_startup_request { __u32 max_ip_connections; /* Number of maximum connection per ip address */ __s8 aapl_model[32]; /* AAPL model string for Finder icon, e.g. "Xserve" */ __u32 max_sessions_per_connection; /* Maximum sessions per connection */ - __s8 reserved[463]; /* Reserved room */ + __s8 reserved[462]; /* Reserved room */ + __u8 request_wq_mode; /* enum ksmbd_wq_mode */ __u32 ifc_list_sz; __s8 ____payload[]; } __attribute__((packed)); diff --git a/include/tools.h b/include/tools.h index 063fc02..d4d7c24 100644 --- a/include/tools.h +++ b/include/tools.h @@ -61,6 +61,7 @@ struct smbconf_global { unsigned short ipc_timeout; unsigned int deadtime; bool bind_interfaces_only; + unsigned char request_wq_mode; char **interfaces; unsigned long file_max; unsigned int smb2_max_read; diff --git a/ksmbd.conf.5.in b/ksmbd.conf.5.in index 8091823..b06b61d 100644 --- a/ksmbd.conf.5.in +++ b/ksmbd.conf.5.in @@ -335,6 +335,15 @@ Use of SMB3 multi-channel is supported. Default: \fBserver multi channel support = no\fR .TP +\fBserver request workqueue\fR (G) +Select the kernel workqueue for incoming SMB requests at server startup. +With \fBpercpu\fR, requests use the per-CPU queue. +With \fBunbound\fR, requests use the unbound queue. +The kernel must support request workqueue selection. +Restart the SMB server to apply changes. + +Default: \fBserver request workqueue = percpu\fR +.TP \fBserver signing\fR (G) Client is allowed or required to use SMB2 signing. With \fBserver signing = disabled\fR or \fBserver signing = auto\fR, SMB2 signing is allowed if it is requested by the client. diff --git a/ksmbd.conf.example b/ksmbd.conf.example index 765726b..0897287 100644 --- a/ksmbd.conf.example +++ b/ksmbd.conf.example @@ -24,6 +24,7 @@ server max protocol = SMB3_11 server min protocol = SMB2_10 server multi channel support = no + server request workqueue = percpu server signing = auto server string = SMB SERVER share:fake_fscaps = 64 diff --git a/mountd/ipc.c b/mountd/ipc.c index f4aecf5..678b637 100644 --- a/mountd/ipc.c +++ b/mountd/ipc.c @@ -135,6 +135,7 @@ static int ipc_ksmbd_starting_up(void) ev->flags = global_conf.flags; ev->reserved[0] = KSMBD_IPC_FEATURE_QUOTA; + ev->request_wq_mode = global_conf.request_wq_mode; ev->signing = global_conf.server_signing; ev->tcp_port = global_conf.tcp_port; ev->ipc_timeout = global_conf.ipc_timeout; diff --git a/tools/config_parser.c b/tools/config_parser.c index 9b617fa..4052b39 100644 --- a/tools/config_parser.c +++ b/tools/config_parser.c @@ -532,6 +532,18 @@ static int process_global_conf_kv(GHashTable *kv) global_conf.krb5_support = cp_get_group_kv_bool(v); } + if (group_kv_steal(kv, "server request workqueue", &k, &v)) { + g_strchomp(v); + if (!g_ascii_strcasecmp(v, "percpu")) + global_conf.request_wq_mode = KSMBD_WQ_PERCPU; + else if (!g_ascii_strcasecmp(v, "unbound")) + global_conf.request_wq_mode = KSMBD_WQ_UNBOUND; + else { + pr_err("Invalid server request workqueue `%s'\n", v); + return -EINVAL; + } + } + if (group_kv_steal(kv, "server multi channel support", &k, &v)) { if (cp_get_group_kv_bool(v)) global_conf.flags |= @@ -594,6 +606,7 @@ static void add_group_global_conf(void) add_group_key_value("share:fake_fscaps = 64"); /* sparse files */ add_group_key_value("tcp port = 445"); add_group_key_value("workgroup = WORKGROUP"); + add_group_key_value("server request workqueue = percpu"); add_group_key_value("server signing = auto"); add_group_key_value("smb2 leases = yes"); } base-commit: 728b3cbe011d79f543b561bd8427fd0b12c96a70