nvme-fc: Prevent null pointer dereference in nvme_fc_io_getuuid()
Subsystems (15)
Sasha Levin
maintainerPATCH 1/28 nvme-fc: Prevent null pointer dereference in nvme_fc_io_getuuid()
From: Nigel Kirkland <[email protected]>
[ Upstream commit 8ae5b3a685dc59a8cf7ccfe0e850999ba9727a3c ]
The nvme_fc_fcp_op structure describing an AEN operation is initialized with a null request structure pointer. An FC LLDD may make a call to nvme_fc_io_getuuid passing a pointer to an nvmefc_fcp_req for an AEN operation.
Add validation of the request structure pointer before dereference.
--- drivers/nvme/host/fc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/nvme/host/fc.c +1 -1
@@ -1911,7 +1911,7 @@ char *nvme_fc_io_getuuid(struct nvmefc_fcp_req *req)struct nvme_fc_fcp_op *op =fcp_req_to_fcp_op (req);struct request *rq = op->rq; -if (!IS_ENABLED (CONFIG_BLK_CGROUP_FC_APPID ) || !rq->bio) +if (!IS_ENABLED (CONFIG_BLK_CGROUP_FC_APPID ) || !rq || !rq->bio)return NULL ;return blkcg_get_fc_appid (rq->bio); }
Signature · 1 line
2.40.1
Sasha Levin
maintainerPATCH 2/28 parisc: sba: Fix compile warning wrt list of SBA devices
From: Helge Deller <[email protected]>
[ Upstream commit eb3255ee8f6f4691471a28fbf22db5e8901116cd ]
Fix this makecheck warning:drivers/parisc/sba_iommu.c:98:19: warning: symbol 'sba_list'
was not declared. Should it be static?
--- arch/parisc/include/asm/ropes.h | 3 +++ drivers/char/agp/parisc-agp.c | 2 -- 2 files changed, 3 insertions(+), 2 deletions(-)
arch/parisc/include/asm/ropes.h +3 -0
@@ -86,6 +86,9 @@ struct sba_device {struct ioc ioc[MAX_IOC ]; }; +/* list of SBA's in system, see drivers/parisc/sba_iommu.c */ +extern struct sba_device *sba_list; +#define ASTRO_RUNWAY_PORT 0x582#define IKE_MERCED_PORT 0x803#define REO_MERCED_PORT 0x804
drivers/char/agp/parisc-agp.c +0 -2
@@ -394,8 +394,6 @@ find_quicksilver(struct device *dev, void *data)static int __init parisc_agp_init (void ) { -extern struct sba_device *sba_list; -int err =-1 ;struct parisc_device *sba =NULL , *lba =NULL ;struct lba_device *lbadev =NULL ;
Signature · 1 line
2.40.1
Sasha Levin
maintainerPATCH 3/28 parisc: iosapic.c: Fix sparse warnings
In reply to Sasha LevinFrom: Helge Deller <[email protected]>
[ Upstream commit 927c6c8aa27c284a799b8c18784e37d3373af908 ]
--- drivers/parisc/iosapic.c | 4 ++-- drivers/parisc/iosapic_private.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-)
drivers/parisc/iosapic.c +2 -2
@@ -202,9 +202,9 @@ static inline void iosapic_write(void __iomem *iosapic, unsigned int reg, u32 vastatic DEFINE_SPINLOCK (iosapic_lock); -static inline void iosapic_eoi (void __iomem *addr,unsigned int data) +static inline void iosapic_eoi (__le32 __iomem *addr,__le32 data) { -__raw_writel (data, addr); +__raw_writel ((__force u32 )data, addr); }/*
drivers/parisc/iosapic_private.h +2 -2
@@ -118,8 +118,8 @@ struct iosapic_irt {struct vector_info {struct iosapic_info *iosapic;/* I/O SAPIC this vector is on */ struct irt_entry *irte;/* IRT entry */ -u32 __iomem *eoi_addr;/* precalculate EOI reg address */ -u32 eoi_data;/* IA64: ? PA: swapped txn_data */ +__le32 __iomem *eoi_addr;/* precalculate EOI reg address */ +__le32 eoi_data;/* IA64: ? PA: swapped txn_data */ int txn_irq;/* virtual IRQ number for processor */ ulong txn_addr;/* IA64: id_eid PA: partial HPA */ u32 txn_data;/* CPU interrupt bit */
Signature · 1 line
2.40.1
Sasha Levin
maintainerPATCH 4/28 parisc: drivers: Fix sparse warning
In reply to Sasha LevinFrom: Helge Deller <[email protected]>
[ Upstream commit b137b9d60b8add5620a06c687a71ce18776730b0 ]
Fix "warning: directive in macro's argument list" warning.
--- arch/parisc/kernel/drivers.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/parisc/kernel/drivers.c +1 -1
@@ -924,9 +924,9 @@ static __init void qemu_header(void)pr_info ("#define PARISC_MODEL \"%s\"\n\n" , boot_cpu_data.pdc.sys_model_name); +#define p ((unsigned long *)&boot_cpu_data.pdc.model)pr_info ("#define PARISC_PDC_MODEL 0x%lx, 0x%lx, 0x%lx, " "0x%lx, 0x%lx, 0x%lx, 0x%lx, 0x%lx, 0x%lx\n\n" , - #define p ((unsigned long *)&boot_cpu_data.pdc.model) p[0 ], p[1 ], p[2 ], p[3 ], p[4 ], p[5 ], p[6 ], p[7 ], p[8 ]);#undef p
Signature · 1 line
2.40.1
Sasha Levin
maintainerPATCH 5/28 parisc: irq: Make irq_stack_union static to avoid sparse warning
In reply to Sasha LevinFrom: Helge Deller <[email protected]>
[ Upstream commit b1bef1388c427cdad7331a9c8eb4ebbbe5b954b0 ]
--- arch/parisc/kernel/irq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/parisc/kernel/irq.c +1 -1
@@ -368,7 +368,7 @@ union irq_stack_union {volatile unsigned int lock[1 ]; }; -DEFINE_PER_CPU(union irq_stack_union, irq_stack_union) = { +static DEFINE_PER_CPU(union irq_stack_union, irq_stack_union) = { .slock = {1 ,1 ,1 ,1 }, };#endif
Signature · 1 line
2.40.1
Sasha Levin
maintainerPATCH 6/28 scsi: qedf: Add synchronization between I/O completions and abort
In reply to Sasha LevinFrom: Javed Hasan <[email protected]>
[ Upstream commit 7df0b2605489bef3f4223ad66f1f9bb8d50d4cd2 ]
Avoid race condition between I/O completion and abort processing by protecting the cmd_type with the rport lock.
--- drivers/scsi/qedf/qedf_io.c | 10 ++++++++-- drivers/scsi/qedf/qedf_main.c | 7 ++++++- 2 files changed, 14 insertions(+), 3 deletions(-)
drivers/scsi/qedf/qedf_io.c +8 -2
@@ -1904,6 +1904,7 @@ int qedf_initiate_abts(struct qedf_ioreq *io_req, bool return_scsi_cmd_on_abts) goto drop_rdata_kref; } +spin_lock_irqsave (&fcport->rport_lock, flags);if (!test_bit (QEDF_CMD_OUTSTANDING , &io_req->flags) ||test_bit (QEDF_CMD_IN_CLEANUP , &io_req->flags) ||test_bit (QEDF_CMD_IN_ABORT , &io_req->flags)) {
@@ -1911,17 +1912,20 @@ int qedf_initiate_abts(struct qedf_ioreq *io_req, bool return_scsi_cmd_on_abts)"io_req xid=0x%x sc_cmd=%p already in cleanup or abort processing or already completed.\n" , io_req->xid, io_req->sc_cmd); rc =1 ; +spin_unlock_irqrestore (&fcport->rport_lock, flags); goto drop_rdata_kref; } +/* Set the command type to abort */ + io_req->cmd_type =QEDF_ABTS ; +spin_unlock_irqrestore (&fcport->rport_lock, flags); +kref_get (&io_req->refcount); xid = io_req->xid; qedf->control_requests++; qedf->packet_aborts++; -/* Set the command type to abort */ - io_req->cmd_type =QEDF_ABTS ; io_req->return_scsi_cmd_on_abts = return_scsi_cmd_on_abts;set_bit (QEDF_CMD_IN_ABORT , &io_req->flags);
@@ -2210,7 +2214,9 @@ int qedf_initiate_cleanup(struct qedf_ioreq *io_req, refcount, fcport, fcport->rdata->ids.port_id);/* Cleanup cmds re-use the same TID as the original I/O */ +spin_lock_irqsave (&fcport->rport_lock, flags); io_req->cmd_type =QEDF_CLEANUP ; +spin_unlock_irqrestore (&fcport->rport_lock, flags); io_req->return_scsi_cmd_on_abts = return_scsi_cmd_on_abts;init_completion (&io_req->cleanup_done);
drivers/scsi/qedf/qedf_main.c +6 -1
@@ -2807,6 +2807,8 @@ void qedf_process_cqe(struct qedf_ctx *qedf, struct fcoe_cqe *cqe)struct qedf_ioreq *io_req;struct qedf_rport *fcport;u32 comp_type; +u8 io_comp_type; +unsigned long flags; comp_type = (cqe->cqe_data >>FCOE_CQE_CQE_TYPE_SHIFT ) &FCOE_CQE_CQE_TYPE_MASK ;
@@ -2840,11 +2842,14 @@ void qedf_process_cqe(struct qedf_ctx *qedf, struct fcoe_cqe *cqe)return ; } +spin_lock_irqsave (&fcport->rport_lock, flags); + io_comp_type = io_req->cmd_type; +spin_unlock_irqrestore (&fcport->rport_lock, flags);switch (comp_type) {case FCOE_GOOD_COMPLETION_CQE_TYPE :atomic_inc (&fcport->free_sqes); -switch (io_req->cmd_type) { +switch (io_comp_type) {case QEDF_SCSI_CMD :qedf_scsi_completion (qedf, cqe, io_req);break ;
Signature · 1 line
2.40.1
Sasha Levin
maintainerPATCH 7/28 scsi: ufs: core: Move __ufshcd_send_uic_cmd() outside host_lock
In reply to Sasha LevinFrom: Kiwoong Kim <[email protected]>
[ Upstream commit 2d3f59cf868b4a2dd678a96cd49bdd91411bd59f ]
__ufshcd_send_uic_cmd() is wrapped by uic_cmd_mutex and its related contexts are accessed within the section wrapped by uic_cmd_mutex. Thus, wrapping with host_lock is redundant.
--- drivers/ufs/core/ufshcd.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)
drivers/ufs/core/ufshcd.c +1 -5
@@ -2346,7 +2346,6 @@ __ufshcd_send_uic_cmd(struct ufs_hba *hba, struct uic_command *uic_cmd, bool completion) {lockdep_assert_held (&hba->uic_cmd_mutex); -lockdep_assert_held (hba->host->host_lock);if (!ufshcd_ready_for_uic_cmd (hba)) { dev_err(hba->dev,
@@ -2373,7 +2372,6 @@ __ufshcd_send_uic_cmd(struct ufs_hba *hba, struct uic_command *uic_cmd,int ufshcd_send_uic_cmd (struct ufs_hba *hba,struct uic_command *uic_cmd) {int ret; -unsigned long flags;if (hba->quirks &UFSHCD_QUIRK_BROKEN_UIC_CMD )return 0 ;
@@ -2382,9 +2380,7 @@ int ufshcd_send_uic_cmd(struct ufs_hba *hba, struct uic_command *uic_cmd)mutex_lock (&hba->uic_cmd_mutex);ufshcd_add_delay_before_dme_cmd (hba); -spin_lock_irqsave (hba->host->host_lock, flags); ret =__ufshcd_send_uic_cmd (hba, uic_cmd, true); -spin_unlock_irqrestore (hba->host->host_lock, flags);if (!ret) ret =ufshcd_wait_for_uic_cmd (hba, uic_cmd);
@@ -4076,8 +4072,8 @@ static int ufshcd_uic_pwr_ctrl(struct ufs_hba *hba, struct uic_command *cmd)wmb (); reenable_intr = true; } - ret =__ufshcd_send_uic_cmd (hba, cmd, false);spin_unlock_irqrestore (hba->host->host_lock, flags); + ret =__ufshcd_send_uic_cmd (hba, cmd, false);if (ret) { dev_err(hba->dev, "pwr ctrl cmd 0x%x with mode 0x%x uic error %d\n",
Signature · 1 line
2.40.1
Sasha Levin
maintainerPATCH 8/28 scsi: ufs: core: Poll HCS.UCRDY before issuing a UIC command
In reply to Sasha LevinFrom: Kiwoong Kim <[email protected]>
[ Upstream commit d32533d30e2119b0c0aa17596734f1f842f750df ]
With auto hibern8 enabled, UIC could be busy processing a hibern8 operation and the HCI would reports UIC not ready for a short while through HCS.UCRDY. The UFS driver doesn't currently handle this situation. The UFSHCI spec specifies UCRDY like this: whether the host controller is ready to process UIC COMMAND
The 'ready' could be seen as many different meanings. If the meaning includes not processing any request from HCI, processing a hibern8 operation can be 'not ready'. In this situation, the driver needs to wait until the operations is completed.
--- drivers/ufs/core/ufshcd.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/ufs/core/ufshcd.c +6 -1
@@ -22,6 +22,7 @@#include <linux/module.h> #include <linux/regulator/consumer.h> #include <linux/sched/clock.h> +#include <linux/iopoll.h> #include <scsi/scsi_cmnd.h> #include <scsi/scsi_dbg.h> #include <scsi/scsi_driver.h>
@@ -2254,7 +2255,11 @@ static inline int ufshcd_hba_capabilities(struct ufs_hba *hba)*/ static inline bool ufshcd_ready_for_uic_cmd (struct ufs_hba *hba) { -return ufshcd_readl (hba,REG_CONTROLLER_STATUS ) &UIC_COMMAND_READY ; +u32 val; +int ret =read_poll_timeout (ufshcd_readl, val, val &UIC_COMMAND_READY , +500 ,UIC_CMD_TIMEOUT *1000 , false, hba, +REG_CONTROLLER_STATUS ); +return ret ==0 ? true : false; }/**
Signature · 1 line
2.40.1
Sasha Levin
maintainerPATCH 9/28 selftests/ftrace: Correctly enable event in instance-event.tc
In reply to Sasha LevinFrom: Zheng Yejian <[email protected]>
[ Upstream commit f4e4ada586995b17f828c6d147d1800eb1471450 ]
Function instance_set() expects to enable event 'sched_switch', so we should set 1 to its 'enable' file.
Testcase passed after this patch:
# ./ftracetest test.d/instances/instance-event.tc === Ftrace unit tests === [1] Test creation and deletion of trace instances while setting an event [PASS]
# of passed: 1 # of failed: 0 # of unresolved: 0 # of untested: 0 # of unsupported: 0 # of xfailed: 0 # of undefined(test bug): 0
--- .../testing/selftests/ftrace/test.d/instances/instance-event.tc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/ftrace/test.d/instances/instance-event.tc +1 -1
@@ -39,7 +39,7 @@ instance_read() { instance_set() { while :; do - echo 1 > foo/events/sched/sched_switch + echo 1 > foo/events/sched/sched_switch/enable done 2> /dev/null }
Signature · 1 line
2.40.1
Sasha Levin
maintainerPATCH 10/28 ring-buffer: Avoid softlockup in ring_buffer_resize()
In reply to Sasha LevinFrom: Zheng Yejian <[email protected]>
[ Upstream commit f6bd2c92488c30ef53b5bd80c52f0a7eee9d545a ]
When user resize all trace ring buffer through file 'buffer_size_kb', then in ring_buffer_resize(), kernel allocates buffer pages for each cpu in a loop.
If the kernel preemption model is PREEMPT_NONE and there are many cpus and there are many buffer pages to be allocated, it may not give up cpu for a long time and finally cause a softlockup.
To avoid it, call cond_resched() after each cpu buffer allocation.
--- kernel/trace/ring_buffer.c | 2 ++ 1 file changed, 2 insertions(+)
kernel/trace/ring_buffer.c +2 -0
@@ -2212,6 +2212,8 @@ int ring_buffer_resize(struct trace_buffer *buffer, unsigned long size, err = -ENOMEM ; goto out_err; } + +cond_resched (); }cpus_read_lock ();
Signature · 1 line
2.40.1
Sasha Levin
maintainerPATCH 11/28 btrfs: improve error message after failure to add delayed dir index item
In reply to Sasha LevinFrom: Filipe Manana <[email protected]>
[ Upstream commit 91bfe3104b8db0310f76f2dcb6aacef24c889366 ]
If we fail to add a delayed dir index item because there's already another item with the same index number, we print an error message (and then BUG). However that message isn't very helpful to debug anything because we don't know what's the index number and what are the values of index counters in the inode and its delayed inode (index_cnt fields of struct btrfs_inode and struct btrfs_delayed_node).
So update the error message to include the index number and counters.
We actually had a recent case where this issue was hit by a syzbot report (see the link below).
--- fs/btrfs/delayed-inode.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
fs/btrfs/delayed-inode.c +4 -3
@@ -1493,9 +1493,10 @@ int btrfs_insert_delayed_dir_index(struct btrfs_trans_handle *trans, ret =__btrfs_add_delayed_item (delayed_node, delayed_item);if (unlikely (ret)) {btrfs_err (trans->fs_info, -"err add delayed dir index item(name: %.*s) into the insertion tree of the delayed node(root id: %llu, inode id: %llu, errno: %d)" , - name_len, name, delayed_node->root->root_key.objectid, - delayed_node->inode_id, ret); +"error adding delayed dir index item, name: %.*s, index: %llu, root: %llu, dir: %llu, dir->index_cnt: %llu, delayed_node->index_cnt: %llu, error: %d" , + name_len, name, index,btrfs_root_id (delayed_node->root), + delayed_node->inode_id, dir->index_cnt, + delayed_node->index_cnt, ret);BUG (); }mutex_unlock (&delayed_node->mutex);
Signature · 1 line
2.40.1
Sasha Levin
maintainerPATCH 12/28 btrfs: assert delayed node locked when removing delayed item
In reply to Sasha LevinFrom: Filipe Manana <[email protected]>
[ Upstream commit a57c2d4e46f519b24558ae0752c17eec416ac72a ]
When removing a delayed item, or releasing which will remove it as well, we will modify one of the delayed node's rbtrees and item counter if the delayed item is in one of the rbtrees. This require having the delayed node's mutex locked, otherwise we will race with other tasks modifying the rbtrees and the counter.
This is motivated by a previous version of another patch actually calling btrfs_release_delayed_item() after unlocking the delayed node's mutex and against a delayed item that is in a rbtree.
So assert at __btrfs_remove_delayed_item() that the delayed node's mutex is locked.
--- fs/btrfs/delayed-inode.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
fs/btrfs/delayed-inode.c +8 -4
@@ -407,6 +407,7 @@ static void finish_one_item(struct btrfs_delayed_root *delayed_root)static void __btrfs_remove_delayed_item (struct btrfs_delayed_item *delayed_item) { +struct btrfs_delayed_node *delayed_node = delayed_item->delayed_node;struct rb_root_cached *root;struct btrfs_delayed_root *delayed_root;
@@ -414,18 +415,21 @@ static void __btrfs_remove_delayed_item(struct btrfs_delayed_item *delayed_item)if (RB_EMPTY_NODE (&delayed_item->rb_node))return ; - delayed_root = delayed_item->delayed_node->root->fs_info->delayed_root; +/* If it's in a rbtree, then we need to have delayed node locked. */ +lockdep_assert_held (&delayed_node->mutex); + + delayed_root = delayed_node->root->fs_info->delayed_root;BUG_ON (!delayed_root);if (delayed_item->type ==BTRFS_DELAYED_INSERTION_ITEM ) - root = &delayed_item->delayed_node->ins_root; + root = &delayed_node->ins_root;else - root = &delayed_item->delayed_node->del_root; + root = &delayed_node->del_root;rb_erase_cached (&delayed_item->rb_node, root);RB_CLEAR_NODE (&delayed_item->rb_node); - delayed_item->delayed_node->count--; + delayed_node->count--;finish_one_item (delayed_root); }
Signature · 1 line
2.40.1
Sasha Levin
maintainerPATCH 13/28 selftests: fix dependency checker script
In reply to Sasha LevinFrom: "Ricardo B. Marliere" <[email protected]>
[ Upstream commit 5f9dd2e896a91bfca90f8463eb6808c03d535d8a ]
This patch fixes inconsistencies in the parsing rules of the levels 1 and 2 of the kselftest_deps.sh. It was added the levels 4 and 5 to account for a few edge cases that are present in some tests, also some
minor identation styling have been fixed (s/ /\t/g).
--- tools/testing/selftests/kselftest_deps.sh | 77 +++++++++++++++++++---- 1 file changed, 65 insertions(+), 12 deletions(-)
tools/testing/selftests/kselftest_deps.sh +65 -12
@@ -46,11 +46,11 @@ fi print_targets=0 while getopts "p" arg; do - case $arg in - p) + case $arg in + p) print_targets=1 shift;; - esac + esac done if [ $# -eq 0 ]
@@ -92,6 +92,10 @@ pass_cnt=0 # Get all TARGETS from selftests Makefile targets=$(egrep "^TARGETS +|^TARGETS =" Makefile | cut -d "=" -f2) +# Initially, in LDLIBS related lines, the dep checker needs +# to ignore lines containing the following strings: +filter="\$(VAR_LDLIBS)\|pkg-config\|PKG_CONFIG\|IOURING_EXTRA_LIBS" + # Single test case if [ $# -eq 2 ] then
@@ -100,6 +104,8 @@ then l1_test $test l2_test $test l3_test $test + l4_test $test + l5_test $test print_results $1 $2 exit $?
@@ -113,7 +119,7 @@ fi # Append space at the end of the list to append more tests. l1_tests=$(grep -r --include=Makefile "^LDLIBS" | \ - grep -v "VAR_LDLIBS" | awk -F: '{print $1}') + grep -v "$filter" | awk -F: '{print $1}' | uniq) # Level 2: LDLIBS set dynamically. #
@@ -126,7 +132,7 @@ l1_tests=$(grep -r --include=Makefile "^LDLIBS" | \ # Append space at the end of the list to append more tests. l2_tests=$(grep -r --include=Makefile ": LDLIBS" | \ - grep -v "VAR_LDLIBS" | awk -F: '{print $1}') + grep -v "$filter" | awk -F: '{print $1}' | uniq) # Level 3 # memfd and others use pkg-config to find mount and fuse libs
@@ -138,11 +144,32 @@ l2_tests=$(grep -r --include=Makefile ": LDLIBS" | \ # VAR_LDLIBS := $(shell pkg-config fuse --libs 2>/dev/null) l3_tests=$(grep -r --include=Makefile "^VAR_LDLIBS" | \ - grep -v "pkg-config" | awk -F: '{print $1}') + grep -v "pkg-config\|PKG_CONFIG" | awk -F: '{print $1}' | uniq) -#echo $l1_tests -#echo $l2_1_tests -#echo $l3_tests +# Level 4 +# some tests may fall back to default using `|| echo -l<libname>` +# if pkg-config doesn't find the libs, instead of using VAR_LDLIBS +# as per level 3 checks. +# e.g: +# netfilter/Makefile +# LDLIBS += $(shell $(HOSTPKG_CONFIG) --libs libmnl 2>/dev/null || echo -lmnl) +l4_tests=$(grep -r --include=Makefile "^LDLIBS" | \ + grep "pkg-config\|PKG_CONFIG" | awk -F: '{print $1}' | uniq) + +# Level 5 +# some tests may use IOURING_EXTRA_LIBS to add extra libs to LDLIBS, +# which in turn may be defined in a sub-Makefile +# e.g.: +# mm/Makefile +# $(OUTPUT)/gup_longterm: LDLIBS += $(IOURING_EXTRA_LIBS) +l5_tests=$(grep -r --include=Makefile "LDLIBS +=.*\$(IOURING_EXTRA_LIBS)" | \ + awk -F: '{print $1}' | uniq) + +#echo l1_tests $l1_tests +#echo l2_tests $l2_tests +#echo l3_tests $l3_tests +#echo l4_tests $l4_tests +#echo l5_tests $l5_tests all_tests print_results $1 $2
@@ -164,24 +191,32 @@ all_tests() for test in $l3_tests; do l3_test $test done + + for test in $l4_tests; do + l4_test $test + done + + for test in $l5_tests; do + l5_test $test + done } # Use same parsing used for l1_tests and pick libraries this time. l1_test() { test_libs=$(grep --include=Makefile "^LDLIBS" $test | \ - grep -v "VAR_LDLIBS" | \ + grep -v "$filter" | \ sed -e 's/\:/ /' | \ sed -e 's/+/ /' | cut -d "=" -f 2) check_libs $test $test_libs } -# Use same parsing used for l2__tests and pick libraries this time. +# Use same parsing used for l2_tests and pick libraries this time. l2_test() { test_libs=$(grep --include=Makefile ": LDLIBS" $test | \ - grep -v "VAR_LDLIBS" | \ + grep -v "$filter" | \ sed -e 's/\:/ /' | sed -e 's/+/ /' | \ cut -d "=" -f 2)
@@ -197,6 +232,24 @@ l3_test() check_libs $test $test_libs } +l4_test() +{ + test_libs=$(grep --include=Makefile "^VAR_LDLIBS\|^LDLIBS" $test | \ + grep "\(pkg-config\|PKG_CONFIG\).*|| echo " | \ + sed -e 's/.*|| echo //' | sed -e 's/)$//') + + check_libs $test $test_libs +} + +l5_test() +{ + tests=$(find $(dirname "$test") -type f -name "*.mk") + test_libs=$(grep "^IOURING_EXTRA_LIBS +\?=" $tests | \ + cut -d "=" -f 2) + + check_libs $test $test_libs +} + check_libs() {
Signature · 1 line
2.40.1
Sasha Levin
maintainerPATCH 14/28 ring-buffer: Do not attempt to read past "commit"
In reply to Sasha LevinFrom: "Steven Rostedt (Google)" <[email protected]>
[ Upstream commit 95a404bd60af6c4d9d8db01ad14fe8957ece31ca ]
When iterating over the ring buffer while the ring buffer is active, the writer can corrupt the reader. There's barriers to help detect this and handle it, but that code missed the case where the last event was at the very end of the page and has only 4 bytes left.
The checks to detect the corruption by the writer to reads needs to see the length of the event. If the length in the first 4 bytes is zero then the length is stored in the second 4 bytes. But if the writer is in the process of updating that code, there's a small window where the length in the first 4 bytes could be zero even though the length is only 4 bytes. That will cause rb_event_length() to read the next 4 bytes which could happen to be off the allocated page.
To protect against this, fail immediately if the next event pointer is less than 8 bytes from the end of the commit (last byte of data), as all events must be a minimum of 8 bytes anyway.
--- kernel/trace/ring_buffer.c | 5 +++++ 1 file changed, 5 insertions(+)
kernel/trace/ring_buffer.c +5 -0
@@ -2388,6 +2388,11 @@ rb_iter_head_event(struct ring_buffer_iter *iter)*/ commit =rb_page_commit (iter_head_page);smp_rmb (); + +/* An event needs to be at least 8 bytes in size */ +if (iter->head > commit -8 ) + goto reset; + event =__rb_page_index (iter_head_page, iter->head); length =rb_event_length (event);
Signature · 1 line
2.40.1
Sasha Levin
maintainerPATCH 15/28 net/smc: bugfix for smcr v2 server connect success statistic
In reply to Sasha LevinFrom: Guangguan Wang <[email protected]>
[ Upstream commit 6912e724832c47bb381eb1bd1e483ec8df0d0f0f ]
In the macro SMC_STAT_SERV_SUCC_INC, the smcd_version is used to determin whether to increase the v1 statistic or the v2 statistic. It is correct for SMCD. But for SMCR, smcr_version should be used.
--- net/smc/smc_stats.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/smc/smc_stats.h +2 -1
@@ -244,8 +244,9 @@ while (0)#define SMC_STAT_SERV_SUCC_INC (net, _ini) \ do { \ typeof(_ini) i = (_ini); \ - bool is_v2 = (i->smcd_version & SMC_V2); \ bool is_smcd = (i->is_smcd); \ + u8 version = is_smcd ? i->smcd_version : i->smcr_version; \ + bool is_v2 = (version & SMC_V2); \ typeof(net->smc.smc_stats) smc_stats = (net)->smc.smc_stats; \ if (is_v2 && is_smcd) \ this_cpu_inc(smc_stats->smc[SMC_TYPE_D].srv_v2_succ_cnt); \
Signature · 1 line
2.40.1
Sasha Levin
maintainerPATCH 16/28 ata: sata_mv: Fix incorrect string length computation in mv_dump_mem()
In reply to Sasha LevinFrom: Christophe JAILLET <[email protected]>
[ Upstream commit e97eb65dd464e7f118a16a26337322d07eb653e2 ]
snprintf() returns the "number of characters which *would* be generated for the given input", not the size *really* generated.
In order to avoid too large values for 'o' (and potential negative values for "sizeof(linebuf) o") use scnprintf() instead of snprintf().
Note that given the "w < 4" in the for loop, the buffer can NOT overflow, but using the *right* function is always better.
--- drivers/ata/sata_mv.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/ata/sata_mv.c +2 -2
@@ -1255,8 +1255,8 @@ static void mv_dump_mem(struct device *dev, void __iomem *start, unsigned bytes)for (b =0 ; b < bytes; ) {for (w =0 , o =0 ; b < bytes && w <4 ; w++) { - o +=snprintf (linebuf + o,sizeof (linebuf) - o, -"%08x " ,readl (start + b)); + o +=scnprintf (linebuf + o,sizeof (linebuf) - o, +"%08x " ,readl (start + b)); b +=sizeof (u32); } dev_dbg(dev, "%s: %p: %s\n",
Signature · 1 line
2.40.1
Sasha Levin
maintainerPATCH 17/28 platform/mellanox: mlxbf-bootctl: add NET dependency into Kconfig
In reply to Sasha LevinFrom: David Thompson <[email protected]>
[ Upstream commit c2dffda1d8f7511505bbbf16ba282f2079b30089 ]
The latest version of the mlxbf_bootctl driver utilizes "sysfs_format_mac", and this API is only available if NET is defined in the kernel configuration. This patch changes the mlxbf_bootctl Kconfig to depend on NET.
--- drivers/platform/mellanox/Kconfig | 1 + 1 file changed, 1 insertion(+)
drivers/platform/mellanox/Kconfig +1 -0
@@ -60,6 +60,7 @@ config MLXBF_BOOTCTL tristate "Mellanox BlueField Firmware Boot Control driver" depends on ARM64 depends on ACPI + depends on NET help The Mellanox BlueField firmware implements functionality to request swapping the primary and alternate eMMC boot partition,
Signature · 1 line
2.40.1
Sasha Levin
maintainerPATCH 18/28 platform/x86: asus-wmi: Support 2023 ROG X16 tablet mode
In reply to Sasha LevinFrom: "Luke D. Jones" <[email protected]>
[ Upstream commit 4106a70ddad57ee6d8f98b81d6f036740c72762b ]
Add quirk for ASUS ROG X16 (GV601V, 2023 versions) Flow 2-in-1 to enable tablet mode with lid flip (all screen rotations).
--- drivers/platform/x86/asus-nb-wmi.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/platform/x86/asus-nb-wmi.c +9 -0
@@ -478,6 +478,15 @@ static const struct dmi_system_id asus_quirks[] = { }, .driver_data = &quirk_asus_tablet_mode, }, + { + .callback = dmi_matched, + .ident = "ASUS ROG FLOW X16", + .matches = { +DMI_MATCH (DMI_SYS_VENDOR ,"ASUSTeK COMPUTER INC." ), + DMI_MATCH(DMI_PRODUCT_NAME, "GV601V"), + }, + .driver_data = &quirk_asus_tablet_mode, + }, { .callback = dmi_matched, .ident = "ASUS VivoBook E410MA",
Signature · 1 line
2.40.1
Sasha Levin
maintainerPATCH 19/28 thermal/of: add missing of_node_put()
In reply to Sasha LevinFrom: Julia Lawall <[email protected]>
[ Upstream commit 8a81cf96f5510aaf9a65d103f7405079a7b0fcc5 ]
for_each_child_of_node performs an of_node_get on each iteration, so a break out of the loop requires an of_node_put.
This was done using the Coccinelle semantic patch iterators/for_each_child.cocci
--- drivers/thermal/thermal_of.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/thermal/thermal_of.c +6 -2
@@ -149,8 +149,10 @@ static int of_find_trip_id(struct device_node *np, struct device_node *trip)*/ for_each_child_of_node (trips, t) { -if (t == trip) +if (t == trip) { +of_node_put (t); goto out; + } i++; }
@@ -519,8 +521,10 @@ static int thermal_of_for_each_cooling_maps(struct thermal_zone_device *tz,for_each_child_of_node (cm_np, child) { ret =thermal_of_for_each_cooling_device (tz_np, child, tz, cdev, action); -if (ret) +if (ret) { +of_node_put (child);break ; + } }of_node_put (cm_np);
Signature · 1 line
2.40.1
Sasha Levin
maintainerPATCH 20/28 drm/amd/display: Don't check registers, if using AUX BL control
In reply to Sasha LevinFrom: Swapnil Patel <[email protected]>
[ Upstream commit f5b2c10b57615828b531bb0ae56bd6325a41167e ]
[Why]
Currently the driver looks DCN registers to access if BL is on or not. This check is not valid if we are using AUX based brightness control. This causes driver to not send out "backlight off" command during power off sequence as it already thinks it is off.
[How]
Only check DCN registers if we aren't using AUX based brightness control.
--- drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c +3 -1
@@ -973,7 +973,9 @@ void dce110_edp_backlight_control(return ; } -if (link->panel_cntl) { +if (link->panel_cntl && !(link->dpcd_sink_ext_caps.bits.oled || + link->dpcd_sink_ext_caps.bits.hdr_aux_backlight_control ==1 || + link->dpcd_sink_ext_caps.bits.sdr_aux_backlight_control ==1 )) {bool is_backlight_on = link->panel_cntl->funcs->is_panel_backlight_on (link->panel_cntl);if ((enable && is_backlight_on) || (!enable && !is_backlight_on)) {
Signature · 1 line
2.40.1
Sasha Levin
maintainerPATCH 21/28 drm/amdgpu/soc21: don't remap HDP registers for SR-IOV
In reply to Sasha LevinFrom: Alex Deucher <[email protected]>
[ Upstream commit 1832403cd41ca6b19b24e9d64f79cb08d920ca44 ]
This matches the behavior for soc15 and nv.
--- drivers/gpu/drm/amd/amdgpu/soc21.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/soc21.c +1 -1
@@ -755,7 +755,7 @@ static int soc21_common_hw_init(void *handle)* for the purpose of expose those registers * to process space */ -if (adev->nbio.funcs->remap_hdp_registers) +if (adev->nbio.funcs->remap_hdp_registers && !amdgpu_sriov_vf (adev)) adev->nbio.funcs->remap_hdp_registers (adev);/* enable the doorbell aperture */ soc21_enable_doorbell_aperture (adev, true);
Signature · 1 line
2.40.1
Sasha Levin
maintainerPATCH 22/28 drm/amdgpu/nbio4.3: set proper rmmio_remap.reg_offset for SR-IOV
In reply to Sasha LevinFrom: Alex Deucher <[email protected]>
[ Upstream commit ab43213e7afd08ac68d4282060bacf309e70fd14 ]
Needed for HDP flush to work correctly.
--- drivers/gpu/drm/amd/amdgpu/nbio_v4_3.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/gpu/drm/amd/amdgpu/nbio_v4_3.c +3 -0
@@ -344,6 +344,9 @@ static void nbio_v4_3_init_registers(struct amdgpu_device *adev) data &= ~RCC_DEV0_EPF2_STRAP2__STRAP_NO_SOFT_RESET_DEV0_F2_MASK ;WREG32_SOC15 (NBIO ,0 , regRCC_DEV0_EPF2_STRAP2, data); } +if (amdgpu_sriov_vf (adev)) + adev->rmmio_remap.reg_offset =SOC15_REG_OFFSET (NBIO ,0 , + regBIF_BX_DEV0_EPF0_VF0_HDP_MEM_COHERENCY_FLUSH_CNTL) <<2 ; }static u32 nbio_v4_3_get_rom_offset (struct amdgpu_device *adev)
Signature · 1 line
2.40.1
Sasha Levin
maintainerPATCH 23/28 drm/amdgpu: Handle null atom context in VBIOS info ioctl
In reply to Sasha LevinFrom: David Francis <[email protected]>
[ Upstream commit 5e7e82254270c8cf8b107451c5de01cee2f135ae ]
On some APU systems, there is no atom context and so the atom_context struct is null.
Add a check to the VBIOS_INFO branch of amdgpu_info_ioctl to handle this case, returning all zeroes.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +11 -6
@@ -896,12 +896,17 @@ int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file *filp)struct atom_context *atom_context; atom_context = adev->mode_info.atom_context; -memcpy (vbios_info.name, atom_context->name,sizeof (atom_context->name)); -memcpy (vbios_info.vbios_pn, atom_context->vbios_pn,sizeof (atom_context->vbios_pn)); - vbios_info.version = atom_context->version; -memcpy (vbios_info.vbios_ver_str, atom_context->vbios_ver_str, -sizeof (atom_context->vbios_ver_str)); -memcpy (vbios_info.date, atom_context->date,sizeof (atom_context->date)); +if (atom_context) { +memcpy (vbios_info.name, atom_context->name, +sizeof (atom_context->name)); +memcpy (vbios_info.vbios_pn, atom_context->vbios_pn, +sizeof (atom_context->vbios_pn)); + vbios_info.version = atom_context->version; +memcpy (vbios_info.vbios_ver_str, atom_context->vbios_ver_str, +sizeof (atom_context->vbios_ver_str)); +memcpy (vbios_info.date, atom_context->date, +sizeof (atom_context->date)); + }return copy_to_user (out, &vbios_info,min ((size_t )size,sizeof (vbios_info))) ? -EFAULT :0 ;
Signature · 1 line
2.40.1
Sasha Levin
maintainerPATCH 24/28 riscv: errata: fix T-Head dcache.cva encoding
In reply to Sasha LevinFrom: Icenowy Zheng <[email protected]>
[ Upstream commit 8eb8fe67e2c84324398f5983c41b4f831d0705b3 ]
The dcache.cva encoding shown in the comments are wrong, it's for dcache.cval1 (which is restricted to L1) instead.
Fix this in the comment and in the hardcoded instruction.
--- arch/riscv/include/asm/errata_list.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/riscv/include/asm/errata_list.h +2 -2
@@ -100,7 +100,7 @@ asm volatile(ALTERNATIVE( \* | 31 - 25 | 24 - 20 | 19 - 15 | 14 - 12 | 11 - 7 | 6 - 0 | * 0000001 01001 rs1 000 00000 0001011 * dcache.cva rs1 (clean, virtual address) -* 0000001 00100 rs1 000 00000 0001011 +* 0000001 00101 rs1 000 00000 0001011 * * dcache.cipa rs1 (clean then invalidate, physical address) * | 31 - 25 | 24 - 20 | 19 - 15 | 14 - 12 | 11 - 7 | 6 - 0 |
@@ -113,7 +113,7 @@ asm volatile(ALTERNATIVE( \* 0000000 11001 00000 000 00000 0001011 */ #define THEAD_inval_A0 ".long 0x0265000b" -#define THEAD_clean_A0 ".long 0x0245000b" +#define THEAD_clean_A0 ".long 0x0255000b"#define THEAD_flush_A0 ".long 0x0275000b"#define THEAD_SYNC_S ".long 0x0190000b"
Signature · 7 lines
2.40.1 _______________________________________________ linux-riscv mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-riscv
Sasha Levin
maintainerPATCH 25/28 scsi: pm80xx: Use phy-specific SAS address when sending PHY_START command
In reply to Sasha LevinFrom: Michal Grzedzicki <[email protected]>
[ Upstream commit 71996bb835aed58c7ec4967be1d05190a27339ec ]
Some cards have more than one SAS address. Using an incorrect address causes communication issues with some devices like expanders.
--- drivers/scsi/pm8001/pm8001_hwi.c | 2 +- drivers/scsi/pm8001/pm80xx_hwi.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/scsi/pm8001/pm8001_hwi.c +1 -1
@@ -4313,7 +4313,7 @@ pm8001_chip_phy_start_req(struct pm8001_hba_info *pm8001_ha, u8 phy_id) payload.sas_identify.dev_type =SAS_END_DEVICE ; payload.sas_identify.initiator_bits =SAS_PROTOCOL_ALL ;memcpy (payload.sas_identify.sas_addr, - pm8001_ha->sas_addr,SAS_ADDR_SIZE ); + &pm8001_ha->phy[phy_id].dev_sas_addr,SAS_ADDR_SIZE ); payload.sas_identify.phy_id = phy_id; return pm8001_mpi_build_cmd(pm8001_ha, 0, opcode, &payload,
drivers/scsi/pm8001/pm80xx_hwi.c +1 -1
@@ -4803,7 +4803,7 @@ pm80xx_chip_phy_start_req(struct pm8001_hba_info *pm8001_ha, u8 phy_id) payload.sas_identify.dev_type =SAS_END_DEVICE ; payload.sas_identify.initiator_bits =SAS_PROTOCOL_ALL ;memcpy (payload.sas_identify.sas_addr, - &pm8001_ha->sas_addr,SAS_ADDR_SIZE ); + &pm8001_ha->phy[phy_id].dev_sas_addr,SAS_ADDR_SIZE ); payload.sas_identify.phy_id = phy_id; return pm8001_mpi_build_cmd(pm8001_ha, 0, opcode, &payload,
Signature · 1 line
2.40.1
Sasha Levin
maintainerPATCH 26/28 scsi: pm80xx: Avoid leaking tags when processing OPC_INB_SET_CONTROLLER_CONFIG command
In reply to Sasha LevinFrom: Michal Grzedzicki <[email protected]>
[ Upstream commit c13e7331745852d0dd7c35eabbe181cbd5b01172 ]
Tags allocated for OPC_INB_SET_CONTROLLER_CONFIG command need to be freed when we receive the response.
--- drivers/scsi/pm8001/pm80xx_hwi.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/scsi/pm8001/pm80xx_hwi.c +2 -0
@@ -3750,10 +3750,12 @@ static int mpi_set_controller_config_resp(struct pm8001_hba_info *pm8001_ha, (struct set_ctrl_cfg_resp *)(piomb +4 );u32 status =le32_to_cpu (pPayload->status);u32 err_qlfr_pgcd =le32_to_cpu (pPayload->err_qlfr_pgcd); +u32 tag =le32_to_cpu (pPayload->tag);pm8001_dbg (pm8001_ha,MSG ,"SET CONTROLLER RESP: status 0x%x qlfr_pgcd 0x%x\n" , status, err_qlfr_pgcd); +pm8001_tag_free (pm8001_ha, tag);return 0 ; }
Signature · 1 line
2.40.1
Sasha Levin
maintainerPATCH 27/28 smb3: correct places where ENOTSUPP is used instead of preferred EOPNOTSUPP
In reply to Sasha LevinFrom: Steve French <[email protected]>
[ Upstream commit ebc3d4e44a7e05457825e03d0560153687265523 ]
checkpatch flagged a few places with:
WARNING: ENOTSUPP is not a SUSV4 error code, prefer EOPNOTSUPP
Also fixed minor typo
--- fs/smb/client/inode.c | 2 +- fs/smb/client/smb2ops.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-)
fs/smb/client/inode.c +1 -1
@@ -2605,7 +2605,7 @@ int cifs_fiemap(struct inode *inode, struct fiemap_extent_info *fei, u64 start, }cifsFileInfo_put (cfile); -return -ENOTSUPP ; +return -EOPNOTSUPP ; }int cifs_truncate_page (struct address_space *mapping,loff_t from)
fs/smb/client/smb2ops.c +3 -3
@@ -292,7 +292,7 @@ smb2_adjust_credits(struct TCP_Server_Info *server,cifs_server_dbg (VFS ,"request has less credits (%d) than required (%d)" , credits->value, new_val); -return -ENOTSUPP ; +return -EOPNOTSUPP ; }spin_lock (&server->req_lock);
@@ -1155,7 +1155,7 @@ smb2_set_ea(const unsigned int xid, struct cifs_tcon *tcon,/* Use a fudge factor of 256 bytes in case we collide * with a different set_EAs command. */ -if (CIFSMaxBufSize -MAX_SMB2_CREATE_RESPONSE_SIZE - +if (CIFSMaxBufSize -MAX_SMB2_CREATE_RESPONSE_SIZE -MAX_SMB2_CLOSE_RESPONSE_SIZE -256 < used_len + ea_name_len + ea_value_len +1 ) { rc = -ENOSPC ;
@@ -4721,7 +4721,7 @@ handle_read_data(struct TCP_Server_Info *server, struct mid_q_entry *mid,if (shdr->Command !=SMB2_READ ) {cifs_server_dbg (VFS ,"only big read responses are supported\n" ); -return -ENOTSUPP ; +return -EOPNOTSUPP ; } if (server->ops->is_session_expired &&
Signature · 1 line
2.40.1
Sasha Levin
maintainerPATCH 28/28 ata: libata-eh: do not clear ATA_PFLAG_EH_PENDING in ata_eh_reset()
In reply to Sasha LevinFrom: Niklas Cassel <[email protected]>
[ Upstream commit 80cc944eca4f0baa9c381d0706f3160e491437f2 ]
ata_scsi_port_error_handler() starts off by clearing ATA_PFLAG_EH_PENDING, before calling ap->ops->error_handler() (without holding the ap->lock).
If an error IRQ is received while ap->ops->error_handler() is running, the irq handler will set ATA_PFLAG_EH_PENDING.
Once ap->ops->error_handler() returns, ata_scsi_port_error_handler() checks if ATA_PFLAG_EH_PENDING is set, and if it is, another iteration of ATA EH is performed.
The problem is that ATA_PFLAG_EH_PENDING is not only cleared by ata_scsi_port_error_handler(), it is also cleared by ata_eh_reset().
ata_eh_reset() is called by ap->ops->error_handler(). This additional clearing done by ata_eh_reset() breaks the whole retry logic in ata_scsi_port_error_handler(). Thus, if an error IRQ is received while ap->ops->error_handler() is running, the port will currently remain frozen and will never get re-enabled.
The additional clearing in ata_eh_reset() was introduced in commit 1e641060c4b5 ("libata: clear eh_info on reset completion").
Looking at the original error report:
https://marc.info/?l=linux-ide&m=124765325828495&w=2
We can see the following happening:
[ 1.074659] ata3: XXX port freeze [ 1.074700] ata3: XXX hardresetting link, stopping engine [ 1.074746] ata3: XXX flipping SControl
[ 1.411471] ata3: XXX irq_stat=400040 CONN|PHY [ 1.411475] ata3: XXX port freeze
[ 1.420049] ata3: XXX starting engine [ 1.420096] ata3: XXX rc=0, class=1 [ 1.420142] ata3: XXX clearing IRQs for thawing [ 1.420188] ata3: XXX port thawed [ 1.420234] ata3: SATA link up 3.0 Gbps (SStatus 123 SControl 300)
We are not supposed to be able to receive an error IRQ while the port is frozen (PxIE is set to 0, i.e. all IRQs for the port are disabled).
AHCI 1.3.1 section 10.7.1.1 First Tier (IS Register) states:
"Each bit location can be thought of as reporting a '1' if the virtual "interrupt line" for that port is indicating it wishes to generate an interrupt. That is, if a port has one or more interrupt status bit set, and the enables for those status bits are set, then this bit shall be set."
Additionally, AHCI state P:ComInit clearly shows that the state machine will only jump to P:ComInitSetIS (which sets IS.IPS(x) to '1'), if PxIE.PCE is set to '1'. In our case, PxIE is set to 0, so IS.IPS(x) won't get set.
So IS.IPS(x) only gets set if PxIS and PxIE is set.
AHCI 1.3.1 section 10.7.1.1 First Tier (IS Register) also states:
"The bits in this register are read/write clear. It is set by the level of the virtual interrupt line being a set, and cleared by a write of '1' from the software."
So if IS.IPS(x) is set, you need to explicitly clear it by writing a 1 to IS.IPS(x) for that port.
Since PxIE is cleared, the only way to get an interrupt while the port is frozen, is if IS.IPS(x) is set, and the only way IS.IPS(x) can be set when the port is frozen, is if it was set before the port was frozen.
However, since commit 737dd811a3db ("ata: libahci: clear pending interrupt status"), we clear both PxIS and IS.IPS(x) after freezing the port, but before the COMRESET, so the problem that commit 1e641060c4b5 ("libata:
clear eh_info on reset completion") fixed can no longer happen.
Thus, revert commit 1e641060c4b5 ("libata: clear eh_info on reset completion"), so that the retry logic in ata_scsi_port_error_handler() works once again. (The retry logic is still needed, since we can still get an error IRQ _after_ the port has been thawed, but before ata_scsi_port_error_handler() takes the ap->lock in order to check if ATA_PFLAG_EH_PENDING is set.)
--- drivers/ata/libata-eh.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-)
drivers/ata/libata-eh.c +3 -10
@@ -2704,18 +2704,11 @@ int ata_eh_reset(struct ata_link *link, int classify, } } -/* -* Some controllers can't be frozen very well and may set spurious -* error conditions during reset. Clear accumulated error -* information and re-thaw the port if frozen. As reset is the -* final recovery action and we cross check link onlineness against -* device classification later, no hotplug event is lost by this. -*/ +/* clear cached SError */ spin_lock_irqsave (link->ap->lock, flags); -memset (&link->eh_info,0 ,sizeof (link->eh_info)); + link->eh_info.serror =0 ;if (slave) -memset (&slave->eh_info,0 ,sizeof (link->eh_info)); - ap->pflags &= ~ATA_PFLAG_EH_PENDING ; + slave->eh_info.serror =0 ;spin_unlock_irqrestore (link->ap->lock, flags);if (ap->pflags &ATA_PFLAG_FROZEN )
Signature · 1 line
2.40.1