Skip to content

Commit 2ddda25

Browse files
committed
Merge: Sync nvme drivers with kernel 6.15
MR: https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-9/-/merge_requests/6993 # Merge Request Required Information JIRA: https://issues.redhat.com/browse/RHEL-96225 ## Summary of Changes Backport patches and fixes from kernel 6.15 to RHEL9.7 ## Approved Development Ticket(s) All submissions to CentOS Stream must reference a ticket in [Red Hat Jira](https://issues.redhat.com/). Signed-off-by: Maurizio Lombardi <mlombard@redhat.com> <details><summary>Click for formatting instructions</summary> Please follow the CentOS Stream [contribution documentation](https://docs.centos.org/en-US/stream-contrib/quickstart/) for how to file this ticket and have it approved. List tickets each on their own line of this description using the format "Resolves: RHEL-76229", "Related: RHEL-76229" or "Reverts: RHEL-76229", as appropriate. </details> Approved-by: John Meneghini <jmeneghi@redhat.com> Approved-by: bgurney <bgurney@redhat.com> Approved-by: CKI KWF Bot <cki-ci-bot+kwf-gitlab-com@redhat.com> Merged-by: Augusto Caringi <acaringi@redhat.com>
2 parents 6840458 + 48764ee commit 2ddda25

File tree

6 files changed

+43
-5
lines changed

6 files changed

+43
-5
lines changed

drivers/nvme/host/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ config NVME_TCP_TLS
9797
depends on NVME_TCP
9898
select NET_HANDSHAKE
9999
select KEYS
100+
select TLS
100101
help
101102
Enables TLS encryption for NVMe TCP using the netlink handshake API.
102103

drivers/nvme/host/core.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4471,7 +4471,8 @@ static void nvme_fw_act_work(struct work_struct *work)
44714471
msleep(100);
44724472
}
44734473

4474-
if (!nvme_change_ctrl_state(ctrl, NVME_CTRL_LIVE))
4474+
if (!nvme_change_ctrl_state(ctrl, NVME_CTRL_CONNECTING) ||
4475+
!nvme_change_ctrl_state(ctrl, NVME_CTRL_LIVE))
44754476
return;
44764477

44774478
nvme_unquiesce_io_queues(ctrl);

drivers/nvme/host/pci.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,7 @@ static bool nvme_dbbuf_update_and_check_event(u16 value, __le32 *dbbuf_db,
386386
* as it only leads to a small amount of wasted memory for the lifetime of
387387
* the I/O.
388388
*/
389-
static int nvme_pci_npages_prp(void)
389+
static __always_inline int nvme_pci_npages_prp(void)
390390
{
391391
unsigned max_bytes = (NVME_MAX_KB_SZ * 1024) + NVME_CTRL_PAGE_SIZE;
392392
unsigned nprps = DIV_ROUND_UP(max_bytes, NVME_CTRL_PAGE_SIZE);
@@ -1107,7 +1107,9 @@ static void nvme_poll_irqdisable(struct nvme_queue *nvmeq)
11071107
WARN_ON_ONCE(test_bit(NVMEQ_POLLED, &nvmeq->flags));
11081108

11091109
disable_irq(pci_irq_vector(pdev, nvmeq->cq_vector));
1110+
spin_lock(&nvmeq->cq_poll_lock);
11101111
nvme_poll_cq(nvmeq, NULL);
1112+
spin_unlock(&nvmeq->cq_poll_lock);
11111113
enable_irq(pci_irq_vector(pdev, nvmeq->cq_vector));
11121114
}
11131115

@@ -3459,7 +3461,7 @@ static pci_ers_result_t nvme_slot_reset(struct pci_dev *pdev)
34593461

34603462
dev_info(dev->ctrl.device, "restart after slot reset\n");
34613463
pci_restore_state(pdev);
3462-
if (!nvme_try_sched_reset(&dev->ctrl))
3464+
if (nvme_try_sched_reset(&dev->ctrl))
34633465
nvme_unquiesce_io_queues(&dev->ctrl);
34643466
return PCI_ERS_RESULT_RECOVERED;
34653467
}
@@ -3532,6 +3534,9 @@ static const struct pci_device_id nvme_id_table[] = {
35323534
.driver_data = NVME_QUIRK_BOGUS_NID, },
35333535
{ PCI_DEVICE(0x15b7, 0x5008), /* Sandisk SN530 */
35343536
.driver_data = NVME_QUIRK_BROKEN_MSI },
3537+
{ PCI_DEVICE(0x15b7, 0x5009), /* Sandisk SN550 */
3538+
.driver_data = NVME_QUIRK_BROKEN_MSI |
3539+
NVME_QUIRK_NO_DEEPEST_PS },
35353540
{ PCI_DEVICE(0x1987, 0x5012), /* Phison E12 */
35363541
.driver_data = NVME_QUIRK_BOGUS_NID, },
35373542
{ PCI_DEVICE(0x1987, 0x5016), /* Phison E16 */

drivers/nvme/host/tcp.c

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1904,7 +1904,7 @@ static void __nvme_tcp_stop_queue(struct nvme_tcp_queue *queue)
19041904
cancel_work_sync(&queue->io_work);
19051905
}
19061906

1907-
static void nvme_tcp_stop_queue(struct nvme_ctrl *nctrl, int qid)
1907+
static void nvme_tcp_stop_queue_nowait(struct nvme_ctrl *nctrl, int qid)
19081908
{
19091909
struct nvme_tcp_ctrl *ctrl = to_tcp_ctrl(nctrl);
19101910
struct nvme_tcp_queue *queue = &ctrl->queues[qid];
@@ -1920,6 +1920,31 @@ static void nvme_tcp_stop_queue(struct nvme_ctrl *nctrl, int qid)
19201920
mutex_unlock(&queue->queue_lock);
19211921
}
19221922

1923+
static void nvme_tcp_wait_queue(struct nvme_ctrl *nctrl, int qid)
1924+
{
1925+
struct nvme_tcp_ctrl *ctrl = to_tcp_ctrl(nctrl);
1926+
struct nvme_tcp_queue *queue = &ctrl->queues[qid];
1927+
int timeout = 100;
1928+
1929+
while (timeout > 0) {
1930+
if (!test_bit(NVME_TCP_Q_ALLOCATED, &queue->flags) ||
1931+
!sk_wmem_alloc_get(queue->sock->sk))
1932+
return;
1933+
msleep(2);
1934+
timeout -= 2;
1935+
}
1936+
dev_warn(nctrl->device,
1937+
"qid %d: timeout draining sock wmem allocation expired\n",
1938+
qid);
1939+
}
1940+
1941+
static void nvme_tcp_stop_queue(struct nvme_ctrl *nctrl, int qid)
1942+
{
1943+
nvme_tcp_stop_queue_nowait(nctrl, qid);
1944+
nvme_tcp_wait_queue(nctrl, qid);
1945+
}
1946+
1947+
19231948
static void nvme_tcp_setup_sock_ops(struct nvme_tcp_queue *queue)
19241949
{
19251950
write_lock_bh(&queue->sock->sk->sk_callback_lock);
@@ -1986,7 +2011,9 @@ static void nvme_tcp_stop_io_queues(struct nvme_ctrl *ctrl)
19862011
int i;
19872012

19882013
for (i = 1; i < ctrl->queue_count; i++)
1989-
nvme_tcp_stop_queue(ctrl, i);
2014+
nvme_tcp_stop_queue_nowait(ctrl, i);
2015+
for (i = 1; i < ctrl->queue_count; i++)
2016+
nvme_tcp_wait_queue(ctrl, i);
19902017
}
19912018

19922019
static int nvme_tcp_start_io_queues(struct nvme_ctrl *ctrl,

drivers/nvme/target/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ config NVME_TARGET_TCP_TLS
9898
bool "NVMe over Fabrics TCP target TLS encryption support"
9999
depends on NVME_TARGET_TCP
100100
select NET_HANDSHAKE
101+
select TLS
101102
help
102103
Enables TLS encryption for the NVMe TCP target using the netlink handshake API.
103104

drivers/nvme/target/tcp.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1546,6 +1546,9 @@ static void nvmet_tcp_restore_socket_callbacks(struct nvmet_tcp_queue *queue)
15461546
{
15471547
struct socket *sock = queue->sock;
15481548

1549+
if (!queue->state_change)
1550+
return;
1551+
15491552
write_lock_bh(&sock->sk->sk_callback_lock);
15501553
sock->sk->sk_data_ready = queue->data_ready;
15511554
sock->sk->sk_state_change = queue->state_change;

0 commit comments

Comments
 (0)