6.5.3-rc1 review
Subsystems (13)
Greg Kroah-Hartman
maintainerPATCH 513/739 RDMA/bnxt_re: Remove a redundant flag
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kalesh AP <[email protected]>
[ Upstream commit fd28c8a8c7a10e7b53851129c6d8dc5945108fe9 ]
After the cited commit, BNXT_RE_FLAG_GOT_MSIX is redundant. Remove it.
--- drivers/infiniband/hw/bnxt_re/bnxt_re.h | 1 - drivers/infiniband/hw/bnxt_re/main.c | 5 ++--- 2 files changed, 2 insertions(+), 4 deletions(-)
drivers/infiniband/hw/bnxt_re/bnxt_re.h +0 -1
@@ -138,7 +138,6 @@ struct bnxt_re_dev {struct list_head list;unsigned long flags;#define BNXT_RE_FLAG_NETDEV_REGISTERED 0 -#define BNXT_RE_FLAG_GOT_MSIX 2#define BNXT_RE_FLAG_HAVE_L2_REF 3#define BNXT_RE_FLAG_RCFW_CHANNEL_EN 4#define BNXT_RE_FLAG_QOS_WORK_REG 5
drivers/infiniband/hw/bnxt_re/main.c +2 -3
@@ -1296,8 +1296,8 @@ static void bnxt_re_dev_uninit(struct bnxt_re_dev *rdev)bnxt_re_net_ring_free (rdev, rdev->rcfw.creq.ring_id, type);bnxt_qplib_free_rcfw_channel (&rdev->rcfw); } -if (test_and_clear_bit (BNXT_RE_FLAG_GOT_MSIX , &rdev->flags)) - rdev->num_msix =0 ; + + rdev->num_msix =0 ;if (rdev->pacing.dbr_pacing)bnxt_re_deinitialize_dbr_pacing (rdev);
@@ -1356,7 +1356,6 @@ static int bnxt_re_dev_init(struct bnxt_re_dev *rdev, u8 wqe_mode)ibdev_dbg (&rdev->ibdev,"Got %d MSI-X vectors\n" , rdev->en_dev->ulp_tbl->msix_requested); rdev->num_msix = rdev->en_dev->ulp_tbl->msix_requested; -set_bit (BNXT_RE_FLAG_GOT_MSIX , &rdev->flags);bnxt_re_query_hwrm_intf_version (rdev);
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 514/739 RDMA/hns: Fix port active speed
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chengchang Tang <[email protected]>
[ Upstream commit df1bcf90a66a10967a3a43510b42cb3566208011 ]
HW supports a variety of different speed, but the current speed is fixed.
The real speed should be querried from ethernet.
--- drivers/infiniband/hw/hns/hns_roce_main.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/infiniband/hw/hns/hns_roce_main.c +5 -2
@@ -219,6 +219,7 @@ static int hns_roce_query_port(struct ib_device *ib_dev, u32 port_num,unsigned long flags;enum ib_mtu mtu;u32 port; +int ret; port = port_num -1 ;
@@ -231,8 +232,10 @@ static int hns_roce_query_port(struct ib_device *ib_dev, u32 port_num,IB_PORT_BOOT_MGMT_SUP ; props->max_msg_sz =HNS_ROCE_MAX_MSG_LEN ; props->pkey_tbl_len =1 ; - props->active_width =IB_WIDTH_4X ; - props->active_speed =1 ; + ret =ib_get_eth_speed (ib_dev, port_num, &props->active_speed, + &props->active_width); +if (ret) +ibdev_warn (ib_dev,"failed to get speed, ret = %d.\n" , ret);spin_lock_irqsave (&hr_dev->iboe.lock, flags);
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 515/739 RDMA/hns: Fix incorrect post-send with direct wqe of wr-list
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Junxian Huang <[email protected]>
[ Upstream commit 706efac4477cdb8be857f6322457de524acc02ff ]
Currently, direct wqe is not supported for wr-list. RoCE driver excludes direct wqe for wr-list by judging whether the number of wr is 1.
For a wr-list where the second wr is a length-error atomic wr, the post-send driver handles the first wr and adds 1 to the wr number counter firstly. While handling the second wr, the driver finds out a length error and terminates the wr handle process, remaining the counter at 1. This causes the driver mistakenly judges there is only 1 wr and thus enters the direct wqe process, carrying the current length-error atomic wqe.
This patch fixes the error by adding a judgement whether the current wr is a bad wr. If so, use the normal doorbell process but not direct wqe despite the wr number is 1.
--- drivers/infiniband/hw/hns/hns_roce_hw_v2.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/infiniband/hw/hns/hns_roce_hw_v2.c +2 -1
@@ -750,7 +750,8 @@ static int hns_roce_v2_post_send(struct ib_qp *ibqp, qp->sq.head += nreq; qp->next_sge = sge_idx; -if (nreq ==1 && (qp->en_flags &HNS_ROCE_QP_CAP_DIRECT_WQE )) +if (nreq ==1 && !ret && + (qp->en_flags &HNS_ROCE_QP_CAP_DIRECT_WQE ))write_dwqe (hr_dev, qp, wqe);else update_sq_db (hr_dev, qp);
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 516/739 RDMA/hns: Fix inaccurate error label name in init instance
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Junxian Huang <[email protected]>
[ Upstream commit c9c0bd3c177d93d80968f720304087ba83fe8f74 ]
This patch fixes inaccurate error label name in init instance.
--- drivers/infiniband/hw/hns/hns_roce_hw_v2.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/infiniband/hw/hns/hns_roce_hw_v2.c +4 -4
@@ -6723,14 +6723,14 @@ static int __hns_roce_hw_v2_init_instance(struct hnae3_handle *handle) ret =hns_roce_init (hr_dev);if (ret) {dev_err (hr_dev->dev,"RoCE Engine init failed!\n" ); - goto error_failed_cfg; + goto error_failed_roce_init; }if (hr_dev->pci_dev->revision ==PCI_REVISION_ID_HIP08 ) { ret =free_mr_init (hr_dev);if (ret) {dev_err (hr_dev->dev,"failed to init free mr!\n" ); - goto error_failed_roce_init; + goto error_failed_free_mr_init; } }
@@ -6738,10 +6738,10 @@ static int __hns_roce_hw_v2_init_instance(struct hnae3_handle *handle)return 0 ; -error_failed_roce_init: +error_failed_free_mr_init:hns_roce_exit (hr_dev); -error_failed_cfg: +error_failed_roce_init:kfree (hr_dev->priv); error_failed_kzalloc:
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 517/739 RDMA/hns: Fix CQ and QP cache affinity
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chengchang Tang <[email protected]>
[ Upstream commit 9e03dbea2b0634b21a45946b4f8097e0dc86ebe1 ]
Currently, the affinity between QP cache and CQ cache is not considered when assigning QPN, it will affect the message rate of HW.
Allocate QPN from QP cache with better CQ affinity to get better performance.
--- drivers/infiniband/hw/hns/hns_roce_device.h | 1 + drivers/infiniband/hw/hns/hns_roce_qp.c | 28 ++++++++++++++++----- 2 files changed, 23 insertions(+), 6 deletions(-)
drivers/infiniband/hw/hns/hns_roce_device.h +1 -0
@@ -97,6 +97,7 @@#define HNS_ROCE_CQ_BANK_NUM 4#define CQ_BANKID_SHIFT 2 +#define CQ_BANKID_MASK GENMASK(1, 0)enum {SERV_TYPE_RC ,
drivers/infiniband/hw/hns/hns_roce_qp.c +22 -6
@@ -170,14 +170,29 @@ static void hns_roce_ib_qp_event(struct hns_roce_qp *hr_qp, } } -static u8 get_least_load_bankid_for_qp (struct hns_roce_bank *bank) +static u8 get_affinity_cq_bank (u8 qp_bank) { -u32 least_load = bank[0 ].inuse; +return (qp_bank >>1 ) &CQ_BANKID_MASK ; +} + +static u8 get_least_load_bankid_for_qp (struct ib_qp_init_attr *init_attr, +struct hns_roce_bank *bank) +{ +#define INVALID_LOAD_QPNUM 0xFFFFFFFF +struct ib_cq *scq = init_attr->send_cq; +u32 least_load =INVALID_LOAD_QPNUM ; +unsigned long cqn =0 ;u8 bankid =0 ;u32 bankcnt;u8 i; -for (i =1 ; i <HNS_ROCE_QP_BANK_NUM ; i++) { +if (scq) + cqn =to_hr_cq (scq)->cqn; + +for (i =0 ; i <HNS_ROCE_QP_BANK_NUM ; i++) { +if (scq && (get_affinity_cq_bank (i) != (cqn &CQ_BANKID_MASK ))) +continue ; + bankcnt = bank[i].inuse;if (bankcnt < least_load) { least_load = bankcnt;
@@ -209,7 +224,8 @@ static int alloc_qpn_with_bankid(struct hns_roce_bank *bank, u8 bankid,return 0 ; } -static int alloc_qpn (struct hns_roce_dev *hr_dev,struct hns_roce_qp *hr_qp) +static int alloc_qpn (struct hns_roce_dev *hr_dev,struct hns_roce_qp *hr_qp, +struct ib_qp_init_attr *init_attr) {struct hns_roce_qp_table *qp_table = &hr_dev->qp_table;unsigned long num =0 ;
@@ -220,7 +236,7 @@ static int alloc_qpn(struct hns_roce_dev *hr_dev, struct hns_roce_qp *hr_qp) num =1 ; }else {mutex_lock (&qp_table->bank_mutex); - bankid =get_least_load_bankid_for_qp (qp_table->bank); + bankid =get_least_load_bankid_for_qp (init_attr, qp_table->bank); ret =alloc_qpn_with_bankid (&qp_table->bank[bankid], bankid, &num);
@@ -1082,7 +1098,7 @@ static int hns_roce_create_qp_common(struct hns_roce_dev *hr_dev, goto err_buf; } - ret =alloc_qpn (hr_dev, hr_qp); + ret =alloc_qpn (hr_dev, hr_qp, init_attr);if (ret) {ibdev_err (ibdev,"failed to alloc QPN, ret = %d.\n" , ret); goto err_qpn;
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 518/739 IB/uverbs: Fix an potential error pointer dereference
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Xiang Yang <[email protected]>
[ Upstream commit 26b7d1a27167e7adf75b150755e05d2bc123ce55 ]
smatch reports the warning below:drivers/infiniband/core/uverbs_std_types_counters.c:110 ib_uverbs_handler_UVERBS_METHOD_COUNTERS_READ() error: 'uattr' dereferencing possible ERR_PTR()
The return value of uattr maybe ERR_PTR(-ENOENT), fix this by checking the value of uattr before using it.
--- drivers/infiniband/core/uverbs_std_types_counters.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/infiniband/core/uverbs_std_types_counters.c +2 -0
@@ -107,6 +107,8 @@ static int UVERBS_HANDLER(UVERBS_METHOD_COUNTERS_READ)(return ret; uattr =uverbs_attr_get (attrs,UVERBS_ATTR_READ_COUNTERS_BUFF ); +if (IS_ERR (uattr)) +return PTR_ERR (uattr); read_attr.ncounters = uattr->ptr_attr.len /sizeof (u64); read_attr.counters_buff =uverbs_zalloc ( attrs,array_size (read_attr.ncounters,sizeof (u64)));
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 519/739 fsi: aspeed: Reset master errors after CFAM reset
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eddie James <[email protected]>
[ Upstream commit 52300909f4670ac552bfeb33c1355b896eac8c06 ]
It has been observed that sometimes the FSI master will return all 0xffs after a CFAM has been taken out of reset, without presenting any error. Resetting the FSI master errors resolves the issue.
--- drivers/fsi/fsi-master-aspeed.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/fsi/fsi-master-aspeed.c +2 -0
@@ -454,6 +454,8 @@ static ssize_t cfam_reset_store(struct device *dev, struct device_attribute *attgpiod_set_value (aspeed->cfam_reset_gpio,1 );usleep_range (900 ,1000 );gpiod_set_value (aspeed->cfam_reset_gpio,0 ); +usleep_range (900 ,1000 ); +opb_writel (aspeed, ctrl_base +FSI_MRESP0 ,cpu_to_be32 (FSI_MRESP_RST_ALL_MASTER ));mutex_unlock (&aspeed->lock);trace_fsi_master_aspeed_cfam_reset (false);
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 520/739 iommu/qcom: Disable and reset context bank before programming
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: AngeloGioacchino Del Regno <[email protected]>
[ Upstream commit 9f3fef23d9b5a858a6e6d5f478bb1b6b76265e76 ]
Writing the new TTBRs, TCRs and MAIRs on a previously enabled
context bank may trigger a context fault, resulting in firmware driven AP resets: change the domain initialization programming sequence to disable the context bank(s) and to also clear the related fault address (CB_FAR) and fault status (CB_FSR) registers before writing new values to TTBR0/1, TCR/TCR2, MAIR0/1.
--- drivers/iommu/arm/arm-smmu/qcom_iommu.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/iommu/arm/arm-smmu/qcom_iommu.c +7 -0
@@ -273,6 +273,13 @@ static int qcom_iommu_init_domain(struct iommu_domain *domain, ctx->secure_init = true; } +/* Disable context bank before programming */ +iommu_writel (ctx,ARM_SMMU_CB_SCTLR ,0 ); + +/* Clear context bank fault address fault status registers */ +iommu_writel (ctx,ARM_SMMU_CB_FAR ,0 ); +iommu_writel (ctx,ARM_SMMU_CB_FSR ,ARM_SMMU_FSR_FAULT ); +/* TTBRs */ iommu_writeq(ctx, ARM_SMMU_CB_TTBR0, pgtbl_cfg.arm_lpae_s1_cfg.ttbr |
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 521/739 tty: serial: qcom-geni-serial: Poll primary sequencer irq status after cancel_tx
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vijaya Krishna Nivarthi <[email protected]>
[ Upstream commit 9c8441330bb399cba6177acce9b0e68c0dbaa597 ]
TX is handled by primary sequencer. After cancelling primary command, poll primary sequencer's irq status instead of that of secondary. While at it, also remove a couple of redundant lines that read from IRQ_EN register and write back same.
--- drivers/tty/serial/qcom_geni_serial.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
drivers/tty/serial/qcom_geni_serial.c +2 -5
@@ -592,7 +592,6 @@ static void qcom_geni_serial_stop_tx_dma(struct uart_port *uport) {struct qcom_geni_serial_port *port =to_dev_port (uport);bool done; -u32 m_irq_en;if (!qcom_geni_serial_main_active (uport))return ;
@@ -604,12 +603,10 @@ static void qcom_geni_serial_stop_tx_dma(struct uart_port *uport) port->tx_remaining =0 ; } - m_irq_en =readl (uport->membase +SE_GENI_M_IRQ_EN ); -writel (m_irq_en, uport->membase +SE_GENI_M_IRQ_EN );geni_se_cancel_m_cmd (&port->se); - done =qcom_geni_serial_poll_bit (uport,SE_GENI_S_IRQ_STATUS , -S_CMD_CANCEL_EN , true); + done =qcom_geni_serial_poll_bit (uport,SE_GENI_M_IRQ_STATUS , +M_CMD_CANCEL_EN , true);if (!done) {geni_se_abort_m_cmd (&port->se); done = qcom_geni_serial_poll_bit(uport, SE_GENI_M_IRQ_STATUS,
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 522/739 iommu/vt-d: Fix to flush cache of PASID directory table
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yanfei Xu <[email protected]>
[ Upstream commit 8a3b8e63f8371c1247b7aa24ff9c5312f1a6948b ]
Even the PCI devices don't support pasid capability, PASID table is mandatory for a PCI device in scalable mode. However flushing cache of pasid directory table for these devices are not taken after pasid table is allocated as the "size" of table is zero. Fix it by calculating the size by page order.
Found this when reading the code, no real problem encountered for now.
--- drivers/iommu/intel/pasid.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iommu/intel/pasid.c +1 -1
@@ -129,7 +129,7 @@ int intel_pasid_alloc_table(struct device *dev) info->pasid_table = pasid_table;if (!ecap_coherent (info->iommu->ecap)) -clflush_cache_range (pasid_table->table, size); +clflush_cache_range (pasid_table->table, (1 << order) *PAGE_SIZE );return 0 ; }
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 523/739 platform/x86: dell-sysman: Fix reference leak
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Armin Wolf <[email protected]>
[ Upstream commit 7295a996fdab7bf83dc3d4078fa8b139b8e0a1bf ]
If a duplicate attribute is found using kset_find_obj(), a reference to that attribute is returned. This means that we need to dispose it accordingly. Use kobject_put() to dispose the duplicate attribute in such a case.
Compile-tested only.
--- drivers/platform/x86/dell/dell-wmi-sysman/sysman.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/platform/x86/dell/dell-wmi-sysman/sysman.c +6 -3
@@ -393,6 +393,7 @@ static int init_bios_attributes(int attr_type, const char *guid)struct kobject *attr_name_kobj;//individual attribute names union acpi_object *obj =NULL ;union acpi_object *elements; +struct kobject *duplicate;struct kset *tmp_set;int min_elements;
@@ -451,9 +452,11 @@ static int init_bios_attributes(int attr_type, const char *guid)else tmp_set = wmi_priv.main_dir_kset; -if (kset_find_obj (tmp_set, elements[ATTR_NAME ].string.pointer)) { -pr_debug ("duplicate attribute name found - %s\n" , - elements[ATTR_NAME ].string.pointer); + duplicate =kset_find_obj (tmp_set, elements[ATTR_NAME ].string.pointer); +if (duplicate) { +pr_debug ("Duplicate attribute name found - %s\n" , + elements[ATTR_NAME ].string.pointer); +kobject_put (duplicate); goto nextobj; }
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 524/739 media: cec: core: add adap_nb_transmit_canceled() callback
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hans Verkuil <[email protected]>
[ Upstream commit da53c36ddd3f118a525a04faa8c47ca471e6c467 ]
A potential deadlock was found by Zheng Zhang with a local syzkaller instance.
The problem is that when a non-blocking CEC transmit is canceled by calling cec_data_cancel, that in turn can call the high-level received() driver callback, which can call cec_transmit_msg() to transmit a new message.
The cec_data_cancel() function is called with the adap->lock mutex held, and cec_transmit_msg() tries to take that same lock.
The root cause is that the received() callback can either be used to pass on a received message (and then adap->lock is not held), or to report a canceled transmit (and then adap->lock is held).
This is confusing, so create a new low-level adap_nb_transmit_canceled callback that reports back that a non-blocking transmit was canceled.
And the received() callback is only called when a message is received, as was the case before commit f9d0ecbf56f4 ("media: cec: correctly pass on reply results") complicated matters.
--- drivers/media/cec/core/cec-adap.c | 4 ++-- include/media/cec.h | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-)
drivers/media/cec/core/cec-adap.c +2 -2
@@ -385,8 +385,8 @@ static void cec_data_cancel(struct cec_data *data, u8 tx_status, u8 rx_status)cec_queue_msg_monitor (adap, &data->msg,1 );if (!data->blocking && data->msg.sequence) -/* Allow drivers to process the message first */ -call_op (adap, received, &data->msg); +/* Allow drivers to react to a canceled transmit */ +call_void_op (adap, adap_nb_transmit_canceled, &data->msg);cec_data_completed (data); }
include/media/cec.h +4 -2
@@ -121,14 +121,16 @@ struct cec_adap_ops {void (*adap_configured)(struct cec_adapter *adap,bool configured);int (*adap_transmit)(struct cec_adapter *adap,u8 attempts,u32 signal_free_time,struct cec_msg *msg); +void (*adap_nb_transmit_canceled)(struct cec_adapter *adap, +const struct cec_msg *msg);void (*adap_status)(struct cec_adapter *adap,struct seq_file *file);void (*adap_free)(struct cec_adapter *adap); -/* Error injection callbacks */ +/* Error injection callbacks, called without adap->lock held */ int (*error_inj_show)(struct cec_adapter *adap,struct seq_file *sf);bool (*error_inj_parse_line)(struct cec_adapter *adap,char *line); -/* High-level CEC message callback */ +/* High-level CEC message callback, called without adap->lock held */ int (*received)(struct cec_adapter *adap,struct cec_msg *msg); };
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 525/739 media: cec: core: add adap_unconfigured() callback
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hans Verkuil <[email protected]>
[ Upstream commit 948a77aaecf202f722cf2264025f9987e5bd5c26 ]
The adap_configured() callback was called with the adap->lock mutex held if the 'configured' argument was false, and without the adap->lock mutex held if that argument was true.
That was very confusing, and so split this up in a adap_unconfigured() callback and a high-level configured() callback.
This also makes it easier to understand when the mutex is held: all low-level adap_* callbacks are called with the mutex held. All other callbacks are called without that mutex held.
--- drivers/media/cec/core/cec-adap.c | 4 ++-- include/media/cec.h | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-)
drivers/media/cec/core/cec-adap.c +2 -2
@@ -1348,7 +1348,7 @@ static void cec_adap_unconfigure(struct cec_adapter *adap)cec_flush (adap);wake_up_interruptible (&adap->kthread_waitq);cec_post_state_event (adap); -call_void_op (adap, adap_configured, false); +call_void_op (adap, adap_unconfigured); }/*
@@ -1539,7 +1539,7 @@ static int cec_config_thread_func(void *arg) adap->kthread_config =NULL ;complete (&adap->config_completion);mutex_unlock (&adap->lock); -call_void_op (adap, adap_configured, true); +call_void_op (adap, configured);return 0 ; unconfigure:
include/media/cec.h +3 -2
@@ -113,12 +113,12 @@ struct cec_fh {#define CEC_FREE_TIME_TO_USEC (ft) ((ft) * 2400)struct cec_adap_ops { -/* Low-level callbacks */ +/* Low-level callbacks, called with adap->lock held */ int (*adap_enable)(struct cec_adapter *adap,bool enable);int (*adap_monitor_all_enable)(struct cec_adapter *adap,bool enable);int (*adap_monitor_pin_enable)(struct cec_adapter *adap,bool enable);int (*adap_log_addr)(struct cec_adapter *adap,u8 logical_addr); -void (*adap_configured)(struct cec_adapter *adap,bool configured); +void (*adap_unconfigured)(struct cec_adapter *adap);int (*adap_transmit)(struct cec_adapter *adap,u8 attempts,u32 signal_free_time,struct cec_msg *msg); void (*adap_nb_transmit_canceled)(struct cec_adapter *adap,
@@ -131,6 +131,7 @@ struct cec_adap_ops {bool (*error_inj_parse_line)(struct cec_adapter *adap,char *line);/* High-level CEC message callback, called without adap->lock held */ +void (*configured)(struct cec_adapter *adap);int (*received)(struct cec_adapter *adap,struct cec_msg *msg); };
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 526/739 media: go7007: Remove redundant if statement
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Colin Ian King <[email protected]>
[ Upstream commit f33cb49081da0ec5af0888f8ecbd566bd326eed1 ]
The if statement that compares msgs[i].len != 3 is always false because it is in a code block where msg[i].len is equal to 3. The check is redundant and can be removed.
As detected by cppcheck static analysis:drivers/media/usb/go7007/go7007-i2c.c:168:20: warning: Opposite inner 'if' condition leads to a dead code block. [oppositeInnerCondition]
--- drivers/media/usb/go7007/go7007-i2c.c | 2 -- 1 file changed, 2 deletions(-)
drivers/media/usb/go7007/go7007-i2c.c +0 -2
@@ -165,8 +165,6 @@ static int go7007_i2c_master_xfer(struct i2c_adapter *adapter, }else if (msgs[i].len ==3 ) {if (msgs[i].flags &I2C_M_RD )return -EIO ; -if (msgs[i].len !=3 ) -return -EIO ;if (go7007_i2c_xfer (go, msgs[i].addr,0 , (msgs[i].buf[0 ] <<8 ) | msgs[i].buf[1 ],0x01 , &msgs[i].buf[2 ]) <0 )
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 527/739 media: venus: hfi_venus: Only consider sys_idle_indicator on V1
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Konrad Dybcio <[email protected]>
[ Upstream commit 6283e4834c69fa93a108efa18c6aa09c7e626f49 ]
As per information from Qualcomm [1], this property is not really supported beyond msm8916 (HFI V1) and some newer HFI versions really dislike receiving it, going as far as crashing the device.
Only consider toggling it (via the module option) on HFIV1. While at it, get rid of the global static variable (which defaulted to zero) which was never explicitly assigned to for V1.
Note: [1] is a reply to the actual message in question, as lore did not properly receive some of the emails..
[1] https://lore.kernel.org/lkml/[email protected]/
--- drivers/media/platform/qcom/venus/hfi_venus.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-)
drivers/media/platform/qcom/venus/hfi_venus.c +6 -12
@@ -131,7 +131,6 @@ struct venus_hfi_device {static bool venus_pkt_debug;int venus_fw_debug =HFI_DEBUG_MSG_ERROR |HFI_DEBUG_MSG_FATAL ; -static bool venus_sys_idle_indicator;static bool venus_fw_low_power_mode = true;static int venus_hw_rsp_timeout =1000 ;static bool venus_fw_coverage;
@@ -927,17 +926,12 @@ static int venus_sys_set_default_properties(struct venus_hfi_device *hdev)if (ret)dev_warn (dev,"setting fw debug msg ON failed (%d)\n" , ret); -/* -* Idle indicator is disabled by default on some 4xx firmware versions, -* enable it explicitly in order to make suspend functional by checking -* WFI (wait-for-interrupt) bit. -*/ -if (IS_V4 (hdev->core) ||IS_V6 (hdev->core)) - venus_sys_idle_indicator = true; - - ret =venus_sys_set_idle_message (hdev, venus_sys_idle_indicator); -if (ret) -dev_warn (dev,"setting idle response ON failed (%d)\n" , ret); +/* HFI_PROPERTY_SYS_IDLE_INDICATOR is not supported beyond 8916 (HFI V1) */ +if (IS_V1 (hdev->core)) { + ret =venus_sys_set_idle_message (hdev, false); +if (ret) +dev_warn (dev,"setting idle response ON failed (%d)\n" , ret); + } ret =venus_sys_set_power_control (hdev, venus_fw_low_power_mode);if (ret)
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 528/739 arm64: defconfig: Drop CONFIG_VIDEO_IMX_MEDIA
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Laurent Pinchart <[email protected]>
[ Upstream commit 0ca2fbab99b12bb81fceaafe5495c00d76789a37 ]
CONFIG_VIDEO_IMX_MEDIA isn't needed on arm64 platforms since commit 9f257f502c2e ("media: imx: Unstage the imx7-media-csi driver") which moved the last arm64 driver depending on that Kconfig symbol out of staging. Drop it from the arm64 defconfig.
--- arch/arm64/configs/defconfig | 1 - 1 file changed, 1 deletion(-)
arch/arm64/configs/defconfig +0 -1
@@ -1129,7 +1129,6 @@ CONFIG_XEN_GNTDEV=y CONFIG_XEN_GRANT_DEV_ALLOC=y CONFIG_STAGING=y CONFIG_STAGING_MEDIA=y -CONFIG_VIDEO_IMX_MEDIA=m CONFIG_VIDEO_MAX96712=m CONFIG_CHROME_PLATFORMS=y CONFIG_CROS_EC=y
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 529/739 media: ipu-bridge: Fix null pointer deref on SSDB/PLD parsing warnings
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hans de Goede <[email protected]>
[ Upstream commit 284be5693163343e1cf17c03917eecd1d6681bcf ]
When ipu_bridge_parse_rotation() and ipu_bridge_parse_orientation() run sensor->adev is not set yet.
So if either of the dev_warn() calls about unknown values are hit this will lead to a NULL pointer deref.
Set sensor->adev earlier, with a borrowed ref to avoid making unrolling on errors harder, to fix this.
--- drivers/media/pci/intel/ipu3/cio2-bridge.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/media/pci/intel/ipu3/cio2-bridge.c +5 -0
@@ -308,6 +308,11 @@ static int cio2_bridge_connect_sensor(const struct cio2_sensor_config *cfg, } sensor = &bridge->sensors[bridge->n_sensors]; +/* +* Borrow our adev ref to the sensor for now, on success +* acpi_dev_get(adev) is done further below. +*/ + sensor->adev = adev; ret = cio2_bridge_read_acpi_buffer(adev, "SSDB", &sensor->ssdb,
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 530/739 media: ipu3-cio2: rename cio2 bridge to ipu bridge and move out of ipu3
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bingbu Cao <[email protected]>
[ Upstream commit 881ca25978c6f536a00205daa8b2452edd057ff9 ]
cio2 bridge was involved along with IPU3. However, in fact all Intel IPUs besides IPU3 CIO2 need this bridge driver. This patch move bridge driver out of ipu3 directory and rename as ipu-bridge. Then it can be worked with IPU3 and other Intel IPUs.
Stable-dep-of: 11e0a7c8e04e ("media: ipu-bridge: Do not use on stack memory for software_node.name field")
---
drivers/media/pci/Kconfig | 2 +-
drivers/media/pci/intel/Kconfig | 21 +++
drivers/media/pci/intel/Makefile | 4 +-
.../{ipu3/cio2-bridge.c => ipu-bridge.c} | 177 +++++++++---------
.../{ipu3/cio2-bridge.h => ipu-bridge.h} | 56 +++---
drivers/media/pci/intel/ipu3/Kconfig | 19 --
drivers/media/pci/intel/ipu3/Makefile | 1 -
drivers/media/pci/intel/ipu3/ipu3-cio2-main.c | 4 +-
drivers/media/pci/intel/ipu3/ipu3-cio2.h | 6 -
9 files changed, 147 insertions(+), 143 deletions(-)
create mode 100644 drivers/media/pci/intel/Kconfig
rename drivers/media/pci/intel/{ipu3/cio2-bridge.c => ipu-bridge.c} (69%)
rename drivers/media/pci/intel/{ipu3/cio2-bridge.h => ipu-bridge.h} (72%)drivers/media/pci/Kconfig +1 -1
@@ -73,7 +73,7 @@ config VIDEO_PCI_SKELETON Enable build of the skeleton PCI driver, used as a reference when developing new drivers. -source "drivers/media/pci/intel/ipu3/Kconfig" +source "drivers/media/pci/intel/Kconfig" endif #MEDIA_PCI_SUPPORT endif #PCI
drivers/media/pci/intel/Kconfig new file +21 -0
@@ -0,0 +1,21 @@ +# SPDX-License-Identifier: GPL-2.0-only +config IPU_BRIDGE + bool "Intel IPU Sensors Bridge" + depends on VIDEO_IPU3_CIO2 && ACPI + depends on I2C + help + This extension provides an API for the Intel IPU driver to create + connections to cameras that are hidden in the SSDB buffer in ACPI. + It can be used to enable support for cameras in detachable / hybrid + devices that ship with Windows. + + Say Y here if your device is a detachable / hybrid laptop that comes + with Windows installed by the OEM, for example: + + - Microsoft Surface models (except Surface Pro 3) + - The Lenovo Miix line (for example the 510, 520, 710 and 720) + - Dell 7285 + + If in doubt, say N here. + +source "drivers/media/pci/intel/ipu3/Kconfig"
drivers/media/pci/intel/Makefile +2 -2
@@ -1,6 +1,6 @@ # SPDX-License-Identifier: GPL-2.0-only # -# Makefile for the IPU3 cio2 and ImGU drivers +# Makefile for the IPU drivers # - +obj-$(CONFIG_IPU_BRIDGE) += ipu-bridge.o obj-y += ipu3/
drivers/media/pci/intel/ipu-bridge.c renamed from drivers/media/pci/intel/ipu3/cio2-bridge.c +89 -88
417 lines not on this page · raw message
drivers/media/pci/intel/ipu-bridge.h renamed from drivers/media/pci/intel/ipu3/cio2-bridge.h +31 -25
127 lines not on this page · raw message
drivers/media/pci/intel/ipu3/Kconfig +0 -19
@@ -17,22 +17,3 @@ config VIDEO_IPU3_CIO2 Say Y or M here if you have a Skylake/Kaby Lake SoC with MIPI CSI-2 connected camera. The module will be called ipu3-cio2. - -config CIO2_BRIDGE - bool "IPU3 CIO2 Sensors Bridge" - depends on VIDEO_IPU3_CIO2 && ACPI - depends on I2C - help - This extension provides an API for the ipu3-cio2 driver to create - connections to cameras that are hidden in the SSDB buffer in ACPI. - It can be used to enable support for cameras in detachable / hybrid - devices that ship with Windows. - - Say Y here if your device is a detachable / hybrid laptop that comes - with Windows installed by the OEM, for example: - - - Microsoft Surface models (except Surface Pro 3) - - The Lenovo Miix line (for example the 510, 520, 710 and 720) - - Dell 7285 - - If in doubt, say N here.
drivers/media/pci/intel/ipu3/Makefile +0 -1
@@ -2,4 +2,3 @@ obj-$(CONFIG_VIDEO_IPU3_CIO2) += ipu3-cio2.o ipu3-cio2-y += ipu3-cio2-main.o -ipu3-cio2-$(CONFIG_CIO2_BRIDGE) += cio2-bridge.o
drivers/media/pci/intel/ipu3/ipu3-cio2-main.c +3 -1
@@ -29,6 +29,7 @@#include <media/v4l2-ioctl.h> #include <media/videobuf2-dma-sg.h> +#include "../ipu-bridge.h" #include "ipu3-cio2.h" struct ipu3_cio2_fmt {
@@ -1724,7 +1725,7 @@ static int cio2_pci_probe(struct pci_dev *pci_dev,return -EINVAL ; } - r =cio2_bridge_init (pci_dev); + r =ipu_bridge_init (pci_dev);if (r)return r; }
@@ -2057,3 +2058,4 @@ MODULE_AUTHOR("Yuning Pu <[email protected]>");MODULE_AUTHOR ("Yong Zhi <[email protected]>" );MODULE_LICENSE ("GPL v2" );MODULE_DESCRIPTION ("IPU3 CIO2 driver" ); +MODULE_IMPORT_NS (INTEL_IPU_BRIDGE );
drivers/media/pci/intel/ipu3/ipu3-cio2.h +0 -6
@@ -459,10 +459,4 @@ static inline struct cio2_queue *vb2q_to_cio2_queue(struct vb2_queue *vq) return container_of(vq, struct cio2_queue, vbq); } -#if IS_ENABLED (CONFIG_CIO2_BRIDGE ) -int cio2_bridge_init (struct pci_dev *cio2); -#else -static inline int cio2_bridge_init (struct pci_dev *cio2) {return 0 ; } -#endif -#endif
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 531/739 media: ipu-bridge: Do not use on stack memory for software_node.name field
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hans de Goede <[email protected]>
[ Upstream commit 11e0a7c8e04ee5f406f2baa27761746cbedcfa11 ]
Commit 567f97bd381f ("media: ipu3-cio2: support multiple sensors and VCMs with same HID") introduced an on stack vcm_name and then uses this for the name field of the software_node struct used for the vcm.
But the software_node struct is much longer lived then the current stack-frame, so this is no good.
Instead extend the ipu_node_names struct with an extra field to store the vcm software_node name and use that.
Note this also changes the length of the allocated buffer from ACPI_ID_LEN + 4 to 16. the name is filled with "<ipu_vcm_types[x]>-%u" where ipu_vcm_types[x] is not an ACPI_ID. The maximum length of the strings in the ipu_vcm_types[] array is 11 + 5 bytes for "-255\0" means 16 bytes are needed in the worst case scenario.
--- drivers/media/pci/intel/ipu-bridge.c | 7 +++---- drivers/media/pci/intel/ipu-bridge.h | 1 + 2 files changed, 4 insertions(+), 4 deletions(-)
drivers/media/pci/intel/ipu-bridge.c +3 -4
@@ -220,7 +220,6 @@ static void ipu_bridge_create_connection_swnodes(struct ipu_bridge *bridge, struct ipu_sensor *sensor) {struct software_node *nodes = sensor->swnodes; -char vcm_name[ACPI_ID_LEN +4 ];ipu_bridge_init_swnode_names (sensor);
@@ -240,10 +239,10 @@ static void ipu_bridge_create_connection_swnodes(struct ipu_bridge *bridge, sensor->ipu_properties);if (sensor->ssdb.vcmtype) {/* append ssdb.link to distinguish VCM nodes with same HID */ -snprintf (vcm_name,sizeof (vcm_name),"%s-%u" , - ipu_vcm_types[sensor->ssdb.vcmtype -1 ], +snprintf (sensor->node_names.vcm,sizeof (sensor->node_names.vcm), +"%s-%u" , ipu_vcm_types[sensor->ssdb.vcmtype -1 ], sensor->ssdb.link); - nodes[SWNODE_VCM ] =NODE_VCM (vcm_name); + nodes[SWNODE_VCM ] =NODE_VCM (sensor->node_names.vcm); }ipu_bridge_init_swnode_group (sensor);
drivers/media/pci/intel/ipu-bridge.h +1 -0
@@ -104,6 +104,7 @@ struct ipu_node_names {char port[7 ];char endpoint[11 ];char remote_port[7 ]; +char vcm[16 ]; };struct ipu_sensor_config {
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 532/739 docs: ABI: fix spelling/grammar in SBEFIFO timeout interface
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Randy Dunlap <[email protected]>
[ Upstream commit 2cd9ec2a51474d4c0b4d2a061f2de7da34eff476 ]
Correct spelling problems as identified by codespell. Correct one grammar error.
--- Documentation/ABI/testing/sysfs-bus-fsi-devices-sbefifo | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
Documentation/ABI/testing/sysfs-bus-fsi-devices-sbefifo +3 -3
@@ -5,6 +5,6 @@ Description: Indicates whether or not this SBE device has experienced a timeout; i.e. the SBE did not respond within the time allotted by the driver. A value of 1 indicates that a timeout has - ocurred and no transfers have completed since the timeout. A - value of 0 indicates that no timeout has ocurred, or if one - has, more recent transfers have completed successful. + occurred and no transfers have completed since the timeout. A + value of 0 indicates that no timeout has occurred, or if one + has, more recent transfers have completed successfully.
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 533/739 USB: gadget: core: Add missing kerneldoc for vbus_work
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alan Stern <[email protected]>
[ Upstream commit 159a98afc88e88f588077afe818081d67f50a5e0 ]
Add a missing kerneldoc description of the vbus_work field in struct usb_udc.
--- drivers/usb/gadget/udc/core.c | 1 + 1 file changed, 1 insertion(+)
drivers/usb/gadget/udc/core.c +1 -0
@@ -40,6 +40,7 @@ static const struct bus_type gadget_bus_type;* @allow_connect: Indicates whether UDC is allowed to be pulled up. * Set/cleared by gadget_(un)bind_driver() after gadget driver is bound or * unbound. +* @vbus_work: work routine to handle VBUS status change notifications. * @connect_lock: protects udc->started, gadget->connect, * gadget->allow_connect and gadget->deactivate. The routines * usb_gadget_connect_locked(), usb_gadget_disconnect_locked(),
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 534/739 USB: gadget: f_mass_storage: Fix unused variable warning
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alan Stern <[email protected]>
[ Upstream commit 55c3e571d2a0aabef4f1354604443f1c415d2e85 ]
Fix a "variable set but not used" warning in f_mass_storage.c. rc is
used if verbose debugging is enabled but not otherwise.
--- drivers/usb/gadget/function/f_mass_storage.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/gadget/function/f_mass_storage.c +1 -1
@@ -927,7 +927,7 @@ static void invalidate_sub(struct fsg_lun *curlun) {struct file *filp = curlun->filp;struct inode *inode =file_inode (filp); -unsigned long rc; +unsigned long __maybe_unused rc; rc =invalidate_mapping_pages (inode->i_mapping,0 ,-1 );VLDBG (curlun,"invalidate_mapping_pages -> %ld\n" , rc);
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 535/739 drivers: base: Free devm resources when unregistering a device
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Gow <[email protected]>
[ Upstream commit 699fb50d99039a50e7494de644f96c889279aca3 ]
In the current code, devres_release_all() only gets called if the device has a bus and has been probed.
This leads to issues when using bus-less or driver-less devices where the device might never get freed if a managed resource holds a reference to the device. This is happening in the DRM framework for example.
We should thus call devres_release_all() in the device_del() function to make sure that the device-managed actions are properly executed when the device is unregistered, even if it has neither a bus nor a driver.
This is effectively the same change than commit 2f8d16a996da ("devres:
release resources on device_del()") that got reverted by commit a525a3ddeaca ("driver core: free devres in device_release") over memory leaks concerns.
This patch effectively combines the two commits mentioned above to release the resources both on device_del() and device_release() and get the best of both worlds.
--- drivers/base/core.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
drivers/base/core.c +11 -0
@@ -3817,6 +3817,17 @@ void device_del(struct device *dev)device_platform_notify_remove (dev);device_links_purge (dev); +/* +* If a device does not have a driver attached, we need to clean +* up any managed resources. We do this in device_release(), but +* it's never called (and we leak the device) if a managed +* resource holds a reference to the device. So release all +* managed resources here, like we do in driver_detach(). We +* still need to do so again in device_release() in case someone +* adds a new resource after this point, though. +*/ +devres_release_all (dev); +bus_notify (dev,BUS_NOTIFY_REMOVED_DEVICE );kobject_uevent (&dev->kobj,KOBJ_REMOVE ); glue_dir =get_glue_dir (dev);
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 536/739 HID: input: Support devices sending Eraser without Invert
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Illia Ostapyshyn <[email protected]>
[ Upstream commit 276e14e6c3993317257e1787e93b7166fbc30905 ]
Some digitizers (notably XP-Pen Artist 24) do not report the Invert usage when erasing. This causes the device to be permanently stuck with the BTN_TOOL_RUBBER tool after sending Eraser, as Invert is the only usage that can release the tool. In this state, Touch and Inrange are no longer reported to userspace, rendering the pen unusable.
Prior to commit 87562fcd1342 ("HID: input: remove the need for HID_QUIRK_INVERT"), BTN_TOOL_RUBBER was never set and Eraser events were simply translated into BTN_TOUCH without causing an inconsistent state.
Introduce HID_QUIRK_NOINVERT for such digitizers and detect them during hidinput_configure_usage(). This quirk causes the tool to be released as soon as Eraser is reported as not set. Set BTN_TOOL_RUBBER in input->keybit when mapping Eraser.
--- drivers/hid/hid-input.c | 18 ++++++++++++++++-- include/linux/hid.h | 1 + 2 files changed, 17 insertions(+), 2 deletions(-)
drivers/hid/hid-input.c +16 -2
@@ -988,6 +988,7 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fielreturn ;case 0x3c :/* Invert */ + device->quirks &= ~HID_QUIRK_NOINVERT ;map_key_clear (BTN_TOOL_RUBBER );break ;
@@ -1013,9 +1014,13 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fielcase 0x45 :/* ERASER */ /* * This event is reported when eraser tip touches the surface. -* Actual eraser (BTN_TOOL_RUBBER) is set by Invert usage when -* tool gets in proximity. +* Actual eraser (BTN_TOOL_RUBBER) is set and released either +* by Invert if tool reports proximity or by Eraser directly. */ +if (!test_bit (BTN_TOOL_RUBBER , input->keybit)) { + device->quirks |=HID_QUIRK_NOINVERT ; +set_bit (BTN_TOOL_RUBBER , input->keybit); + }map_key_clear (BTN_TOUCH );break ;
@@ -1580,6 +1585,15 @@ void hidinput_hid_event(struct hid_device *hid, struct hid_field *field, structelse if (report->tool !=BTN_TOOL_RUBBER )/* value is off, tool is not rubber, ignore */ return ; +else if (*quirks &HID_QUIRK_NOINVERT && + !test_bit (BTN_TOUCH , input->key)) { +/* +* There is no invert to release the tool, let hid_input +* send BTN_TOUCH with scancode and release the tool after. +*/ +hid_report_release_tool (report, input,BTN_TOOL_RUBBER ); +return ; + }/* let hid-input set BTN_TOUCH */ break ;
include/linux/hid.h +1 -0
@@ -360,6 +360,7 @@ struct hid_item {#define HID_QUIRK_NO_OUTPUT_REPORTS_ON_INTR_EP BIT(18)#define HID_QUIRK_HAVE_SPECIAL_DRIVER BIT(19)#define HID_QUIRK_INCREMENT_USAGE_ON_DUPLICATE BIT(20) +#define HID_QUIRK_NOINVERT BIT(21)#define HID_QUIRK_FULLSPEED_INTERVAL BIT(28)#define HID_QUIRK_NO_INIT_REPORTS BIT(29)#define HID_QUIRK_NO_IGNORE BIT(30)
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 537/739 HID: nvidia-shield: Remove led_classdev_unregister in thunderstrike_create
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rahul Rameshbabu <[email protected]>
[ Upstream commit cb818a047f2b95f3d9e08568ff7f8f513832ff2f ]
Avoid calling thunderstrike_led_set_brightness from thunderstrike_create when led_classdev_unregister is called. led_classdev_unregister was called from thunderstrike_create in the error path. Calling thunderstrike_led_set_brightness in this situation is unsafe.
--- drivers/hid/hid-nvidia-shield.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-)
drivers/hid/hid-nvidia-shield.c +7 -6
@@ -513,21 +513,22 @@ static struct shield_device *thunderstrike_create(struct hid_device *hdev)hid_set_drvdata (hdev, shield_dev); + ts->haptics_dev =shield_haptics_create (shield_dev, thunderstrike_play_effect); +if (IS_ERR (ts->haptics_dev)) +return ERR_CAST (ts->haptics_dev); + ret =thunderstrike_led_create (ts);if (ret) {hid_err (hdev,"Failed to create Thunderstrike LED instance\n" ); -return ERR_PTR (ret); - } - - ts->haptics_dev =shield_haptics_create (shield_dev, thunderstrike_play_effect); -if (IS_ERR (ts->haptics_dev)) goto err; + }hid_info (hdev,"Registered Thunderstrike controller\n" );return shield_dev; err: -led_classdev_unregister (&ts->led_dev); +if (ts->haptics_dev) +input_unregister_device (ts->haptics_dev);return ERR_CAST (ts->haptics_dev); }
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 538/739 media: ov5640: Enable MIPI interface in ov5640_set_power_mipi()
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marek Vasut <[email protected]>
[ Upstream commit 98cb72d3b9c5e03b10fa993752ecfcbd9c572d8c ]
Set OV5640_REG_IO_MIPI_CTRL00 bit 2 to 1 instead of 0, since 1 means MIPI CSI2 interface, while 0 means CPI parallel interface.
In the ov5640_set_power_mipi() the interface should obviously be set to MIPI CSI2 since this functions is used to power up the sensor when operated in MIPI CSI2 mode. The sensor should not be in CPI mode in that case.
This fixes a corner case where capturing the first frame on i.MX8MN with CSI/ISI resulted in corrupted frame.
--- drivers/media/i2c/ov5640.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/media/i2c/ov5640.c +2 -2
@@ -2542,9 +2542,9 @@ static int ov5640_set_power_mipi(struct ov5640_dev *sensor, bool on)* "ov5640_set_stream_mipi()") * [4] = 0 : Power up MIPI HS Tx * [3] = 0 : Power up MIPI LS Rx -* [2] = 0 : MIPI interface disabled +* [2] = 1 : MIPI interface enabled */ - ret =ov5640_write_reg (sensor,OV5640_REG_IO_MIPI_CTRL00 ,0x40 ); + ret =ov5640_write_reg (sensor,OV5640_REG_IO_MIPI_CTRL00 ,0x44 );if (ret)return ret;
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 539/739 media: ov5640: Fix initial RESETB state and annotate timings
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marek Vasut <[email protected]>
[ Upstream commit a210df337c5f5c2cd82f36c9dbb154ec63365c80 ]
The initial state of RESETB input signal of OV5640 should be asserted, i.e. the sensor should be in reset. This is not the case, make it so.
Since the subsequent assertion of RESETB signal is no longer necessary and the timing of the power sequencing could be slightly adjusted, add annotations to the delays which match OV5640 datasheet rev. 2.03, both:
figure 2-3 power up timing with internal DVDD figure 2-4 power up timing with external DVDD source
The 5..10ms delay between PWDN assertion and RESETB assertion is not even documented in the power sequencing diagram, and with this reset fix, it is no longer even necessary.
--- drivers/media/i2c/ov5640.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-)
drivers/media/i2c/ov5640.c +4 -7
@@ -2452,16 +2452,13 @@ static void ov5640_power(struct ov5640_dev *sensor, bool enable)static void ov5640_powerup_sequence (struct ov5640_dev *sensor) {if (sensor->pwdn_gpio) { -gpiod_set_value_cansleep (sensor->reset_gpio,0 ); +gpiod_set_value_cansleep (sensor->reset_gpio,1 );/* camera power cycle */ ov5640_power (sensor, false); -usleep_range (5000 ,10000 ); +usleep_range (5000 ,10000 );/* t2 */ ov5640_power (sensor, true); -usleep_range (5000 ,10000 ); - -gpiod_set_value_cansleep (sensor->reset_gpio,1 ); -usleep_range (1000 ,2000 ); +usleep_range (1000 ,2000 );/* t3 */ gpiod_set_value_cansleep (sensor->reset_gpio,0 ); }else {
@@ -2469,7 +2466,7 @@ static void ov5640_powerup_sequence(struct ov5640_dev *sensor)ov5640_write_reg (sensor,OV5640_REG_SYS_CTRL0 ,OV5640_REG_SYS_CTRL0_SW_RST ); } -usleep_range (20000 ,25000 ); +usleep_range (20000 ,25000 );/* t4 */ /* * software standby: allows registers programming;
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 540/739 media: Documentation: Fix [GS]_ROUTING documentation
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tomi Valkeinen <[email protected]>
[ Upstream commit 997a6b01cd97b74684728d5af6511c333f25957d ]
Add mention that successful VIDIOC_SUBDEV_G_ROUTING call will update 'num_routes' and remove mention about non-existing streams, which is incorrect.
--- .../userspace-api/media/v4l/vidioc-subdev-g-routing.rst | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
Documentation/userspace-api/media/v4l/vidioc-subdev-g-routing.rst +4 -3
@@ -58,6 +58,9 @@ the subdevice exposes, drivers return the ENOSPC error code and adjust the value of the ``num_routes`` field. Application should then reserve enough memory for all the route entries and call ``VIDIOC_SUBDEV_G_ROUTING`` again. +On a successful ``VIDIOC_SUBDEV_G_ROUTING`` call the driver updates the +``num_routes`` field to reflect the actual number of routes returned. + .. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| .. c:type:: v4l2_subdev_routing
@@ -138,9 +141,7 @@ ENOSPC EINVAL The sink or source pad identifiers reference a non-existing pad, or reference - pads of different types (ie. the sink_pad identifiers refers to a source pad) - or the sink or source stream identifiers reference a non-existing stream on - the sink or source pad. + pads of different types (ie. the sink_pad identifiers refers to a source pad). E2BIG The application provided ``num_routes`` for ``VIDIOC_SUBDEV_S_ROUTING`` is
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 541/739 media: ov2680: Remove auto-gain and auto-exposure controls
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hans de Goede <[email protected]>
[ Upstream commit 7b5a42e6ae71927359ea67a2c22570ba97fa4059 ]
Quoting the OV2680 datasheet:
"3.2 exposure and gain control
In the OV2680, the exposure time and gain are set manually from an external controller. The OV2680 supports manual gain and exposure control only for normal applications, no auto mode."
And indeed testing with the atomisp_ov2680 fork of ov2680.c has shown that auto-exposure and auto-gain do not work.
Note that the code setting the auto-exposure flag was broken, callers of ov2680_exposure_set() were directly passing !!ctrls->auto_exp->val as "bool auto_exp" value, but ctrls->auto_exp is a menu control with:
enum v4l2_exposure_auto_type {
V4L2_EXPOSURE_AUTO = 0,
V4L2_EXPOSURE_MANUAL = 1,
...So instead of passing !!ctrls->auto_exp->val they should have been passing ctrls->auto_exp->val == V4L2_EXPOSURE_AUTO, iow the passed value was inverted of what it should have been.
Also remove ov2680_g_volatile_ctrl() since without auto support the gain and exposure controls are not volatile.
This also fixes the control values not being properly applied in ov2680_mode_set(). The 800x600 mode register-list also sets gain, exposure and vflip overriding the last set ctrl values.
ov2680_mode_set() does call ov2680_gain_set() and ov2680_exposure_set() but did this before writing the mode register-list, so these values would still be overridden by the mode register-list.
Add a v4l2_ctrl_handler_setup() call after writing the mode register-list to restore all ctrl values. Also remove the ctrls->gain->is_new check from ov2680_gain_set() so that the gain always gets restored properly.
Last since ov2680_mode_set() now calls v4l2_ctrl_handler_setup(), remove the v4l2_ctrl_handler_setup() call after ov2680_mode_restore() since ov2680_mode_restore() calls ov2680_mode_set().
--- drivers/media/i2c/ov2680.c | 161 ++++--------------------------------- 1 file changed, 17 insertions(+), 144 deletions(-)
drivers/media/i2c/ov2680.c +17 -144
@@ -85,15 +85,8 @@ struct ov2680_mode_info {struct ov2680_ctrls {struct v4l2_ctrl_handler handler; -struct { -struct v4l2_ctrl *auto_exp; -struct v4l2_ctrl *exposure; - }; -struct { -struct v4l2_ctrl *auto_gain; -struct v4l2_ctrl *gain; - }; - +struct v4l2_ctrl *exposure; +struct v4l2_ctrl *gain;struct v4l2_ctrl *hflip;struct v4l2_ctrl *vflip;struct v4l2_ctrl *test_pattern;
@@ -143,6 +136,7 @@ static const struct reg_value ov2680_setting_30fps_QUXGA_800_600[] = { {0x380e, 0x02}, {0x380f, 0x84}, {0x3811, 0x04}, {0x3813, 0x04}, {0x3814, 0x31}, {0x3815, 0x31}, {0x3820, 0xc0}, {0x4008, 0x00}, {0x4009, 0x03}, {0x4837, 0x1e}, {0x3501, 0x4e}, {0x3502, 0xe0}, + {0x3503, 0x03}, }; static const struct reg_value ov2680_setting_30fps_720P_1280_720[] = {
@@ -405,69 +399,15 @@ static int ov2680_test_pattern_set(struct ov2680_dev *sensor, int value)return 0 ; } -static int ov2680_gain_set (struct ov2680_dev *sensor,bool auto_gain) -{ -struct ov2680_ctrls *ctrls = &sensor->ctrls; -u32 gain; -int ret; - - ret =ov2680_mod_reg (sensor,OV2680_REG_R_MANUAL ,BIT (1 ), - auto_gain ?0 :BIT (1 )); -if (ret <0 ) -return ret; - -if (auto_gain || !ctrls->gain->is_new) -return 0 ; - - gain = ctrls->gain->val; - - ret =ov2680_write_reg16 (sensor,OV2680_REG_GAIN_PK , gain); - -return 0 ; -} - -static int ov2680_gain_get (struct ov2680_dev *sensor) -{ -u32 gain; -int ret; - - ret =ov2680_read_reg16 (sensor,OV2680_REG_GAIN_PK , &gain); -if (ret) -return ret; - -return gain; -} - -static int ov2680_exposure_set (struct ov2680_dev *sensor,bool auto_exp) +static int ov2680_gain_set (struct ov2680_dev *sensor,u32 gain) { -struct ov2680_ctrls *ctrls = &sensor->ctrls; -u32 exp; -int ret; - - ret =ov2680_mod_reg (sensor,OV2680_REG_R_MANUAL ,BIT (0 ), - auto_exp ?0 :BIT (0 )); -if (ret <0 ) -return ret; - -if (auto_exp || !ctrls->exposure->is_new) -return 0 ; - - exp = (u32 )ctrls->exposure->val; - exp <<=4 ; - -return ov2680_write_reg24 (sensor,OV2680_REG_EXPOSURE_PK_HIGH , exp); +return ov2680_write_reg16 (sensor,OV2680_REG_GAIN_PK , gain); } -static int ov2680_exposure_get (struct ov2680_dev *sensor) +static int ov2680_exposure_set (struct ov2680_dev *sensor,u32 exp) { -int ret; -u32 exp; - - ret =ov2680_read_reg24 (sensor,OV2680_REG_EXPOSURE_PK_HIGH , &exp); -if (ret) -return ret; - -return exp >>4 ; +return ov2680_write_reg24 (sensor,OV2680_REG_EXPOSURE_PK_HIGH , + exp <<4 ); }static int ov2680_stream_enable (struct ov2680_dev *sensor)
@@ -482,33 +422,17 @@ static int ov2680_stream_disable(struct ov2680_dev *sensor)static int ov2680_mode_set (struct ov2680_dev *sensor) { -struct ov2680_ctrls *ctrls = &sensor->ctrls;int ret; - ret =ov2680_gain_set (sensor, false); -if (ret <0 ) -return ret; - - ret =ov2680_exposure_set (sensor, false); + ret =ov2680_load_regs (sensor, sensor->current_mode);if (ret <0 )return ret; - ret =ov2680_load_regs (sensor, sensor->current_mode); +/* Restore value of all ctrls */ + ret =__v4l2_ctrl_handler_setup (&sensor->ctrls.handler);if (ret <0 )return ret; -if (ctrls->auto_gain->val) { - ret =ov2680_gain_set (sensor, true); -if (ret <0 ) -return ret; - } - -if (ctrls->auto_exp->val ==V4L2_EXPOSURE_AUTO ) { - ret =ov2680_exposure_set (sensor, true); -if (ret <0 ) -return ret; - } - sensor->mode_pending_changes = false;return 0 ;
@@ -590,15 +514,10 @@ static int ov2680_s_power(struct v4l2_subdev *sd, int on)else ret =ov2680_power_off (sensor); -mutex_unlock (&sensor->lock); - -if (on && ret ==0 ) { - ret =v4l2_ctrl_handler_setup (&sensor->ctrls.handler); -if (ret <0 ) -return ret; - +if (on && ret ==0 ) ret =ov2680_mode_restore (sensor); - } + +mutex_unlock (&sensor->lock);return ret; }
@@ -794,52 +713,19 @@ static int ov2680_enum_frame_interval(struct v4l2_subdev *sd,return 0 ; } -static int ov2680_g_volatile_ctrl (struct v4l2_ctrl *ctrl) -{ -struct v4l2_subdev *sd =ctrl_to_sd (ctrl); -struct ov2680_dev *sensor =to_ov2680_dev (sd); -struct ov2680_ctrls *ctrls = &sensor->ctrls; -int val; - -if (!sensor->is_enabled) -return 0 ; - -switch (ctrl->id) { -case V4L2_CID_GAIN : - val =ov2680_gain_get (sensor); -if (val <0 ) -return val; - ctrls->gain->val = val; -break ; -case V4L2_CID_EXPOSURE : - val =ov2680_exposure_get (sensor); -if (val <0 ) -return val; - ctrls->exposure->val = val; -break ; - } - -return 0 ; -} -static int ov2680_s_ctrl (struct v4l2_ctrl *ctrl) {struct v4l2_subdev *sd =ctrl_to_sd (ctrl);struct ov2680_dev *sensor =to_ov2680_dev (sd); -struct ov2680_ctrls *ctrls = &sensor->ctrls;if (!sensor->is_enabled)return 0 ;switch (ctrl->id) { -case V4L2_CID_AUTOGAIN : -return ov2680_gain_set (sensor, !!ctrl->val);case V4L2_CID_GAIN : -return ov2680_gain_set (sensor, !!ctrls->auto_gain->val); -case V4L2_CID_EXPOSURE_AUTO : -return ov2680_exposure_set (sensor, !!ctrl->val); +return ov2680_gain_set (sensor, ctrl->val);case V4L2_CID_EXPOSURE : -return ov2680_exposure_set (sensor, !!ctrls->auto_exp->val); +return ov2680_exposure_set (sensor, ctrl->val);case V4L2_CID_VFLIP :if (sensor->is_streaming)return -EBUSY ;
@@ -864,7 +750,6 @@ static int ov2680_s_ctrl(struct v4l2_ctrl *ctrl) }static const struct v4l2_ctrl_ops ov2680_ctrl_ops = { - .g_volatile_ctrl = ov2680_g_volatile_ctrl, .s_ctrl = ov2680_s_ctrl, };
@@ -936,7 +821,7 @@ static int ov2680_v4l2_register(struct ov2680_dev *sensor)if (ret <0 )return ret; -v4l2_ctrl_handler_init (hdl,7 ); +v4l2_ctrl_handler_init (hdl,5 ); hdl->lock = &sensor->lock;
@@ -948,16 +833,9 @@ static int ov2680_v4l2_register(struct ov2680_dev *sensor)ARRAY_SIZE (test_pattern_menu) -1 , 0, 0, test_pattern_menu); - ctrls->auto_exp =v4l2_ctrl_new_std_menu (hdl, ops, -V4L2_CID_EXPOSURE_AUTO , -V4L2_EXPOSURE_MANUAL ,0 , -V4L2_EXPOSURE_AUTO ); - ctrls->exposure =v4l2_ctrl_new_std (hdl, ops,V4L2_CID_EXPOSURE ,0 ,32767 ,1 ,0 ); - ctrls->auto_gain =v4l2_ctrl_new_std (hdl, ops,V4L2_CID_AUTOGAIN , -0 ,1 ,1 ,1 ); ctrls->gain =v4l2_ctrl_new_std (hdl, ops,V4L2_CID_GAIN ,0 ,2047 ,1 ,0 );if (hdl->error) {
@@ -965,14 +843,9 @@ static int ov2680_v4l2_register(struct ov2680_dev *sensor) goto cleanup_entity; } - ctrls->gain->flags |=V4L2_CTRL_FLAG_VOLATILE ; - ctrls->exposure->flags |=V4L2_CTRL_FLAG_VOLATILE ; ctrls->vflip->flags |=V4L2_CTRL_FLAG_MODIFY_LAYOUT ; ctrls->hflip->flags |=V4L2_CTRL_FLAG_MODIFY_LAYOUT ; -v4l2_ctrl_auto_cluster (2 , &ctrls->auto_gain,0 , true); -v4l2_ctrl_auto_cluster (2 , &ctrls->auto_exp,1 , true); - sensor->sd.ctrl_handler = hdl; ret =v4l2_async_register_subdev (&sensor->sd);
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 542/739 media: ov2680: Fix ov2680_bayer_order()
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hans de Goede <[email protected]>
[ Upstream commit 50a7bad4e0a37d7018ab6fe843dd84bc6b2ecf72 ]
The index into ov2680_hv_flip_bayer_order[] should be 0-3, but ov2680_bayer_order() was using 0 + BIT(2) + (BIT(2) << 1) as max index, while the intention was to use: 0 + 1 + 2 as max index.
Fix the index calculation in ov2680_bayer_order(), while at it also just use the ctrl values rather then reading them back using a slow i2c-read transaction.
This also allows making the function void, since there now are no more i2c-reads to error check.
Note the check for the ctrls being NULL is there to allow adding an ov2680_fill_format() helper later, which will call ov2680_set_bayer_order() during probe() before the ctrls are created.
[Sakari Ailus: Change all users of ov2680_set_bayer_order() here]
--- drivers/media/i2c/ov2680.c | 33 ++++++++++++++------------------- 1 file changed, 14 insertions(+), 19 deletions(-)
drivers/media/i2c/ov2680.c +14 -19
@@ -315,26 +315,17 @@ static void ov2680_power_down(struct ov2680_dev *sensor)usleep_range (5000 ,10000 ); } -static int ov2680_bayer_order (struct ov2680_dev *sensor) +static void ov2680_set_bayer_order (struct ov2680_dev *sensor) { -u32 format1; -u32 format2; -u32 hv_flip; -int ret; - - ret =ov2680_read_reg (sensor,OV2680_REG_FORMAT1 , &format1); -if (ret <0 ) -return ret; +int hv_flip =0 ; - ret =ov2680_read_reg (sensor,OV2680_REG_FORMAT2 , &format2); -if (ret <0 ) -return ret; +if (sensor->ctrls.vflip && sensor->ctrls.vflip->val) + hv_flip +=1 ; - hv_flip = (format2 &BIT (2 ) <<1 ) | (format1 &BIT (2 )); +if (sensor->ctrls.hflip && sensor->ctrls.hflip->val) + hv_flip +=2 ; sensor->fmt.code = ov2680_hv_flip_bayer_order[hv_flip]; - -return 0 ; }static int ov2680_vflip_enable (struct ov2680_dev *sensor)
@@ -345,7 +336,8 @@ static int ov2680_vflip_enable(struct ov2680_dev *sensor)if (ret <0 )return ret; -return ov2680_bayer_order (sensor); +ov2680_set_bayer_order (sensor); +return 0 ; }static int ov2680_vflip_disable (struct ov2680_dev *sensor)
@@ -356,7 +348,8 @@ static int ov2680_vflip_disable(struct ov2680_dev *sensor)if (ret <0 )return ret; -return ov2680_bayer_order (sensor); +ov2680_set_bayer_order (sensor); +return 0 ; }static int ov2680_hflip_enable (struct ov2680_dev *sensor)
@@ -367,7 +360,8 @@ static int ov2680_hflip_enable(struct ov2680_dev *sensor)if (ret <0 )return ret; -return ov2680_bayer_order (sensor); +ov2680_set_bayer_order (sensor); +return 0 ; }static int ov2680_hflip_disable (struct ov2680_dev *sensor)
@@ -378,7 +372,8 @@ static int ov2680_hflip_disable(struct ov2680_dev *sensor)if (ret <0 )return ret; -return ov2680_bayer_order (sensor); +ov2680_set_bayer_order (sensor); +return 0 ; }static int ov2680_test_pattern_set (struct ov2680_dev *sensor,int value)
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 543/739 media: ov2680: Fix vflip / hflip set functions
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hans de Goede <[email protected]>
[ Upstream commit d5d08ad330c9ccebc5e066fda815423a290f48b0 ]
ov2680_vflip_disable() / ov2680_hflip_disable() pass BIT(0) instead of 0 as value to ov2680_mod_reg().
While fixing this also:
1. Stop having separate enable/disable functions for hflip / vflip
2. Move the is_streaming check, which is unique to hflip / vflip into the ov2680_set_?flip() functions.
for a nice code cleanup.
--- drivers/media/i2c/ov2680.c | 50 +++++++++----------------------------- 1 file changed, 12 insertions(+), 38 deletions(-)
drivers/media/i2c/ov2680.c +12 -38
@@ -328,23 +328,15 @@ static void ov2680_set_bayer_order(struct ov2680_dev *sensor) sensor->fmt.code = ov2680_hv_flip_bayer_order[hv_flip]; } -static int ov2680_vflip_enable (struct ov2680_dev *sensor) +static int ov2680_set_vflip (struct ov2680_dev *sensor,s32 val) {int ret; - ret =ov2680_mod_reg (sensor,OV2680_REG_FORMAT1 ,BIT (2 ),BIT (2 )); -if (ret <0 ) -return ret; - -ov2680_set_bayer_order (sensor); -return 0 ; -} - -static int ov2680_vflip_disable (struct ov2680_dev *sensor) -{ -int ret; +if (sensor->is_streaming) +return -EBUSY ; - ret =ov2680_mod_reg (sensor,OV2680_REG_FORMAT1 ,BIT (2 ),BIT (0 )); + ret =ov2680_mod_reg (sensor,OV2680_REG_FORMAT1 , +BIT (2 ), val ?BIT (2 ) :0 );if (ret <0 )return ret;
@@ -352,23 +344,15 @@ static int ov2680_vflip_disable(struct ov2680_dev *sensor)return 0 ; } -static int ov2680_hflip_enable (struct ov2680_dev *sensor) +static int ov2680_set_hflip (struct ov2680_dev *sensor,s32 val) {int ret; - ret =ov2680_mod_reg (sensor,OV2680_REG_FORMAT2 ,BIT (2 ),BIT (2 )); -if (ret <0 ) -return ret; - -ov2680_set_bayer_order (sensor); -return 0 ; -} - -static int ov2680_hflip_disable (struct ov2680_dev *sensor) -{ -int ret; +if (sensor->is_streaming) +return -EBUSY ; - ret =ov2680_mod_reg (sensor,OV2680_REG_FORMAT2 ,BIT (2 ),BIT (0 )); + ret =ov2680_mod_reg (sensor,OV2680_REG_FORMAT2 , +BIT (2 ), val ?BIT (2 ) :0 );if (ret <0 )return ret;
@@ -722,19 +706,9 @@ static int ov2680_s_ctrl(struct v4l2_ctrl *ctrl)case V4L2_CID_EXPOSURE :return ov2680_exposure_set (sensor, ctrl->val);case V4L2_CID_VFLIP : -if (sensor->is_streaming) -return -EBUSY ; -if (ctrl->val) -return ov2680_vflip_enable (sensor); -else -return ov2680_vflip_disable (sensor); +return ov2680_set_vflip (sensor, ctrl->val);case V4L2_CID_HFLIP : -if (sensor->is_streaming) -return -EBUSY ; -if (ctrl->val) -return ov2680_hflip_enable (sensor); -else -return ov2680_hflip_disable (sensor); +return ov2680_set_hflip (sensor, ctrl->val);case V4L2_CID_TEST_PATTERN :return ov2680_test_pattern_set (sensor, ctrl->val);default :
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 544/739 media: ov2680: Remove VIDEO_V4L2_SUBDEV_API ifdef-s
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hans de Goede <[email protected]>
[ Upstream commit 49c282d5a8c5f4d1d9088622bec792294c716010 ]
VIDEO_V4L2_SUBDEV_API is now automatically selected in Kconfig for all sensor drivers. Remove the ifdef CONFIG_VIDEO_V4L2_SUBDEV_API checks.
This is a preparation patch for fixing ov2680_set_fmt() which == V4L2_SUBDEV_FORMAT_TRY calls not properly filling in the passed in v4l2_mbus_framefmt struct.
--- drivers/media/i2c/ov2680.c | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-)
drivers/media/i2c/ov2680.c +2 -14
@@ -562,7 +562,6 @@ static int ov2680_get_fmt(struct v4l2_subdev *sd, {struct ov2680_dev *sensor =to_ov2680_dev (sd);struct v4l2_mbus_framefmt *fmt =NULL ; -int ret =0 ;if (format->pad !=0 )return -EINVAL ;
@@ -570,22 +569,17 @@ static int ov2680_get_fmt(struct v4l2_subdev *sd,mutex_lock (&sensor->lock);if (format->which ==V4L2_SUBDEV_FORMAT_TRY ) { -#ifdef CONFIG_VIDEO_V4L2_SUBDEV_API fmt =v4l2_subdev_get_try_format (&sensor->sd, sd_state, format->pad); -#else - ret = -EINVAL ; -#endif }else { fmt = &sensor->fmt; } -if (fmt) - format->format = *fmt; + format->format = *fmt;mutex_unlock (&sensor->lock); -return ret; +return 0 ; } static int ov2680_set_fmt(struct v4l2_subdev *sd,
@@ -594,9 +588,7 @@ static int ov2680_set_fmt(struct v4l2_subdev *sd, {struct ov2680_dev *sensor =to_ov2680_dev (sd);struct v4l2_mbus_framefmt *fmt = &format->format; -#ifdef CONFIG_VIDEO_V4L2_SUBDEV_API struct v4l2_mbus_framefmt *try_fmt; -#endif const struct ov2680_mode_info *mode;int ret =0 ;
@@ -619,10 +611,8 @@ static int ov2680_set_fmt(struct v4l2_subdev *sd, }if (format->which ==V4L2_SUBDEV_FORMAT_TRY ) { -#ifdef CONFIG_VIDEO_V4L2_SUBDEV_API try_fmt =v4l2_subdev_get_try_format (sd, sd_state,0 ); format->format = *try_fmt; -#endif goto unlock; }
@@ -780,9 +770,7 @@ static int ov2680_v4l2_register(struct ov2680_dev *sensor)v4l2_i2c_subdev_init (&sensor->sd, sensor->i2c_client, &ov2680_subdev_ops); -#ifdef CONFIG_VIDEO_V4L2_SUBDEV_API sensor->sd.flags =V4L2_SUBDEV_FL_HAS_DEVNODE ; -#endif sensor->pad.flags =MEDIA_PAD_FL_SOURCE ; sensor->sd.entity.function =MEDIA_ENT_F_CAM_SENSOR ;
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 545/739 media: ov2680: Dont take the lock for try_fmt calls
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hans de Goede <[email protected]>
[ Upstream commit e521b9cc1a49de677f4fc65909ce4877fbf7b113 ]
On ov2680_set_fmt() calls with format->which == V4L2_SUBDEV_FORMAT_TRY, ov2680_set_fmt() does not talk to the sensor.
So in this case there is no need to lock the sensor->lock mutex or to check that the sensor is streaming.
--- drivers/media/i2c/ov2680.c | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-)
drivers/media/i2c/ov2680.c +9 -11
@@ -595,24 +595,22 @@ static int ov2680_set_fmt(struct v4l2_subdev *sd,if (format->pad !=0 )return -EINVAL ; -mutex_lock (&sensor->lock); - -if (sensor->is_streaming) { - ret = -EBUSY ; - goto unlock; - } - mode =v4l2_find_nearest_size (ov2680_mode_data,ARRAY_SIZE (ov2680_mode_data), width, height, fmt->width, fmt->height); -if (!mode) { - ret = -EINVAL ; - goto unlock; - } +if (!mode) +return -EINVAL ;if (format->which ==V4L2_SUBDEV_FORMAT_TRY ) { try_fmt =v4l2_subdev_get_try_format (sd, sd_state,0 ); format->format = *try_fmt; +return 0 ; + } + +mutex_lock (&sensor->lock); + +if (sensor->is_streaming) { + ret = -EBUSY ; goto unlock; }
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 546/739 media: ov2680: Add ov2680_fill_format() helper function
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hans de Goede <[email protected]>
[ Upstream commit 6d6849b2203f3244b575ba01d3e41ee19aa2cadf ]
Add a ov2680_fill_format() helper function and use this everywhere were a v4l2_mbus_framefmt struct needs to be filled in so that the driver always fills it consistently.
This is a preparation patch for fixing ov2680_set_fmt() which == V4L2_SUBDEV_FORMAT_TRY calls not properly filling in the passed in v4l2_mbus_framefmt struct.
Note that for ov2680_init_cfg() this now simply always fills the try_fmt struct of the passed in sd_state. This is correct because ov2680_init_cfg() is never called with a NULL sd_state so the old sd_state check is not necessary.
--- drivers/media/i2c/ov2680.c | 49 +++++++++++++++++++++----------------- 1 file changed, 27 insertions(+), 22 deletions(-)
drivers/media/i2c/ov2680.c +27 -22
@@ -54,6 +54,9 @@#define OV2680_WIDTH_MAX 1600#define OV2680_HEIGHT_MAX 1200 +#define OV2680_DEFAULT_WIDTH 800 +#define OV2680_DEFAULT_HEIGHT 600 +enum ov2680_mode_id {OV2680_MODE_QUXGA_800_600 ,OV2680_MODE_720P_1280_720 ,
@@ -315,7 +318,8 @@ static void ov2680_power_down(struct ov2680_dev *sensor)usleep_range (5000 ,10000 ); } -static void ov2680_set_bayer_order (struct ov2680_dev *sensor) +static void ov2680_set_bayer_order (struct ov2680_dev *sensor, +struct v4l2_mbus_framefmt *fmt) {int hv_flip =0 ;
@@ -325,7 +329,19 @@ static void ov2680_set_bayer_order(struct ov2680_dev *sensor)if (sensor->ctrls.hflip && sensor->ctrls.hflip->val) hv_flip +=2 ; - sensor->fmt.code = ov2680_hv_flip_bayer_order[hv_flip]; + fmt->code = ov2680_hv_flip_bayer_order[hv_flip]; +} + +static void ov2680_fill_format (struct ov2680_dev *sensor, +struct v4l2_mbus_framefmt *fmt, +unsigned int width,unsigned int height) +{ +memset (fmt,0 ,sizeof (*fmt)); + fmt->width = width; + fmt->height = height; + fmt->field =V4L2_FIELD_NONE ; + fmt->colorspace =V4L2_COLORSPACE_SRGB ; +ov2680_set_bayer_order (sensor, fmt); }static int ov2680_set_vflip (struct ov2680_dev *sensor,s32 val)
@@ -340,7 +356,7 @@ static int ov2680_set_vflip(struct ov2680_dev *sensor, s32 val)if (ret <0 )return ret; -ov2680_set_bayer_order (sensor); +ov2680_set_bayer_order (sensor, &sensor->fmt);return 0 ; }
@@ -356,7 +372,7 @@ static int ov2680_set_hflip(struct ov2680_dev *sensor, s32 val)if (ret <0 )return ret; -ov2680_set_bayer_order (sensor); +ov2680_set_bayer_order (sensor, &sensor->fmt);return 0 ; }
@@ -614,10 +630,7 @@ static int ov2680_set_fmt(struct v4l2_subdev *sd, goto unlock; } - fmt->width = mode->width; - fmt->height = mode->height; - fmt->code = sensor->fmt.code; - fmt->colorspace = sensor->fmt.colorspace; +ov2680_fill_format (sensor, fmt, mode->width, mode->height); sensor->current_mode = mode; sensor->fmt = format->format;
@@ -632,16 +645,11 @@ static int ov2680_set_fmt(struct v4l2_subdev *sd,static int ov2680_init_cfg (struct v4l2_subdev *sd,struct v4l2_subdev_state *sd_state) { -struct v4l2_subdev_format fmt = { - .which = sd_state ?V4L2_SUBDEV_FORMAT_TRY - :V4L2_SUBDEV_FORMAT_ACTIVE , - .format = { - .width =800 , - .height =600 , - } - }; +struct ov2680_dev *sensor =to_ov2680_dev (sd); -return ov2680_set_fmt (sd, sd_state, &fmt); +ov2680_fill_format (sensor, &sd_state->pads[0 ].try_fmt, +OV2680_DEFAULT_WIDTH ,OV2680_DEFAULT_HEIGHT ); +return 0 ; } static int ov2680_enum_frame_size(struct v4l2_subdev *sd,
@@ -740,11 +748,8 @@ static int ov2680_mode_init(struct ov2680_dev *sensor)const struct ov2680_mode_info *init_mode;/* set initial mode */ - sensor->fmt.code =MEDIA_BUS_FMT_SBGGR10_1X10 ; - sensor->fmt.width =800 ; - sensor->fmt.height =600 ; - sensor->fmt.field =V4L2_FIELD_NONE ; - sensor->fmt.colorspace =V4L2_COLORSPACE_SRGB ; +ov2680_fill_format (sensor, &sensor->fmt, +OV2680_DEFAULT_WIDTH ,OV2680_DEFAULT_HEIGHT ); sensor->frame_interval.denominator =OV2680_FRAME_RATE ; sensor->frame_interval.numerator =1 ;
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 547/739 media: ov2680: Fix ov2680_set_fmt() which == V4L2_SUBDEV_FORMAT_TRY not working
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hans de Goede <[email protected]>
[ Upstream commit c0e97a4b4f20639f74cd5809b42ba6cbf9736a7d ]
ov2680_set_fmt() which == V4L2_SUBDEV_FORMAT_TRY was getting the try_fmt v4l2_mbus_framefmt struct from the passed in sd_state and then storing the contents of that into the return by reference format->format struct.
While the right thing to do would be filling format->format based on the just looked up mode and then store the results of that in sd_state->pads[0].try_fmt .
Before the previous change introducing ov2680_fill_format() this resulted in ov2680_set_fmt() which == V4L2_SUBDEV_FORMAT_TRY always returning the zero-ed out sd_state->pads[0].try_fmt in format->format breaking callers using this.
After the introduction of ov2680_fill_format() which at least initializes sd_state->pads[0].try_fmt properly, format->format is now always being filled with the default 800x600 mode set by ov2680_init_cfg() independent of the actual requested mode.
Move the filling of format->format with ov2680_fill_format() to before the if (which == V4L2_SUBDEV_FORMAT_TRY) and then store the filled in format->format in sd_state->pads[0].try_fmt to fix this.
Note this removes the fmt local variable because IMHO having a local variable which points to a sub-struct of one of the function arguments just leads to confusion when reading the code.
--- drivers/media/i2c/ov2680.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-)
drivers/media/i2c/ov2680.c +7 -6
@@ -603,7 +603,6 @@ static int ov2680_set_fmt(struct v4l2_subdev *sd, struct v4l2_subdev_format *format) {struct ov2680_dev *sensor =to_ov2680_dev (sd); -struct v4l2_mbus_framefmt *fmt = &format->format;struct v4l2_mbus_framefmt *try_fmt;const struct ov2680_mode_info *mode;int ret =0 ;
@@ -612,14 +611,18 @@ static int ov2680_set_fmt(struct v4l2_subdev *sd,return -EINVAL ; mode =v4l2_find_nearest_size (ov2680_mode_data, -ARRAY_SIZE (ov2680_mode_data), width, - height, fmt->width, fmt->height); +ARRAY_SIZE (ov2680_mode_data), + width, height, + format->format.width, + format->format.height);if (!mode)return -EINVAL ; +ov2680_fill_format (sensor, &format->format, mode->width, mode->height); +if (format->which ==V4L2_SUBDEV_FORMAT_TRY ) { try_fmt =v4l2_subdev_get_try_format (sd, sd_state,0 ); - format->format = *try_fmt; + *try_fmt = format->format;return 0 ; }
@@ -630,8 +633,6 @@ static int ov2680_set_fmt(struct v4l2_subdev *sd, goto unlock; } -ov2680_fill_format (sensor, fmt, mode->width, mode->height); - sensor->current_mode = mode; sensor->fmt = format->format; sensor->mode_pending_changes = true;
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 548/739 media: ov2680: Fix regulators being left enabled on ov2680_power_on() errors
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hans de Goede <[email protected]>
[ Upstream commit 84b4bd7e0d98166aa32fd470e672721190492eae ]
When the ov2680_power_on() "sensor soft reset failed" path is hit during probe() the WARN() about putting an enabled regulator at drivers/regulator/core.c:2398 triggers 3 times (once for each regulator), filling dmesg with backtraces.
Fix this by properly disabling the regulators on ov2680_power_on() errors.
--- drivers/media/i2c/ov2680.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/media/i2c/ov2680.c +6 -2
@@ -475,7 +475,7 @@ static int ov2680_power_on(struct ov2680_dev *sensor) ret =ov2680_write_reg (sensor,OV2680_REG_SOFT_RESET ,0x01 );if (ret !=0 ) {dev_err (dev,"sensor soft reset failed\n" ); -return ret; + goto err_disable_regulators; }usleep_range (1000 ,2000 ); }else {
@@ -485,7 +485,7 @@ static int ov2680_power_on(struct ov2680_dev *sensor) ret =clk_prepare_enable (sensor->xvclk);if (ret <0 ) -return ret; + goto err_disable_regulators; sensor->is_enabled = true;
@@ -495,6 +495,10 @@ static int ov2680_power_on(struct ov2680_dev *sensor)ov2680_stream_disable (sensor);return 0 ; + +err_disable_regulators: +regulator_bulk_disable (OV2680_NUM_SUPPLIES , sensor->supplies); +return ret; }static int ov2680_s_power (struct v4l2_subdev *sd,int on)
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 549/739 media: i2c: rdacm21: Fix uninitialized value
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jacopo Mondi <[email protected]>
[ Upstream commit 33c7ae8f49e3413c81e879e1fdfcea4c5516e37b ]
Fix the following smatch warning:
drivers/media/i2c/rdacm21.c:373 ov10640_check_id() error: uninitialized symbol 'val'.
Initialize 'val' to 0 in the ov10640_check_id() function.
--- drivers/media/i2c/rdacm21.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/i2c/rdacm21.c +1 -1
@@ -351,7 +351,7 @@ static void ov10640_power_up(struct rdacm21_device *dev)static int ov10640_check_id (struct rdacm21_device *dev) {unsigned int i; -u8 val; +u8 val =0 ;/* Read OV10640 ID to test communications. */ for (i =0 ; i <OV10640_PID_TIMEOUT ; ++i) {
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 550/739 f2fs: fix spelling in ABI documentation
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Randy Dunlap <[email protected]>
[ Upstream commit c709d099a0d2befa2b16c249ef8df722b43e6c28 ]
Correct spelling problems as identified by codespell.
--- Documentation/ABI/testing/sysfs-fs-f2fs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
Documentation/ABI/testing/sysfs-fs-f2fs +4 -4
@@ -54,9 +54,9 @@ Description: Controls the in-place-update policy. 0x00 DISABLE disable IPU(=default option in LFS mode) 0x01 FORCE all the time 0x02 SSR if SSR mode is activated - 0x04 UTIL if FS utilization is over threashold + 0x04 UTIL if FS utilization is over threshold 0x08 SSR_UTIL if SSR mode is activated and FS utilization is over - threashold + threshold 0x10 FSYNC activated in fsync path only for high performance flash storages. IPU will be triggered only if the # of dirty pages over min_fsync_blocks.
@@ -117,7 +117,7 @@ Date: December 2021 Contact: "Konstantin Vyshetsky" <[email protected]> Description: Controls the number of discards a thread will issue at a time. Higher number will allow the discard thread to finish its work - faster, at the cost of higher latency for incomming I/O. + faster, at the cost of higher latency for incoming I/O. What: /sys/fs/f2fs/<disk>/min_discard_issue_time Date: December 2021
@@ -334,7 +334,7 @@ Description: This indicates how many GC can be failed for the pinned state. 2048 trials is set by default. What: /sys/fs/f2fs/<disk>/extension_list -Date: Feburary 2018 +Date: February 2018 Contact: "Chao Yu" <[email protected]> Description: Used to control configure extension list: - Query: cat /sys/fs/f2fs/<disk>/extension_list
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 551/739 f2fs: fix to avoid mmap vs set_compress_option case
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chao Yu <[email protected]>
[ Upstream commit b5ab3276eb69cacf44ecfb11b2bfab73096ff4e4 ]
Compression option in inode should not be changed after they have been used, however, it may happen in below race case:
Thread A Thread B
- f2fs_ioc_set_compress_option
- check f2fs_is_mmap_file()
- check get_dirty_pages()
- check F2FS_HAS_BLOCKS()
- f2fs_file_mmap
- set_inode_flag(FI_MMAP_FILE)
- fault
- do_page_mkwrite
- f2fs_vm_page_mkwrite
- f2fs_get_block_locked
- fault_dirty_shared_page
- set_page_dirty
- update i_compress_algorithm
- update i_log_cluster_size
- update i_cluster_size
Avoid such race condition by covering f2fs_file_mmap() w/ i_sem lock, meanwhile add mmap file check condition in f2fs_may_compress() as well.
--- fs/f2fs/f2fs.h | 3 ++- fs/f2fs/file.c | 23 ++++++++++++++++++----- 2 files changed, 20 insertions(+), 6 deletions(-)
fs/f2fs/f2fs.h +2 -1
@@ -4483,7 +4483,8 @@ static inline bool f2fs_low_mem_mode(struct f2fs_sb_info *sbi)static inline bool f2fs_may_compress (struct inode *inode) {if (IS_SWAPFILE (inode) ||f2fs_is_pinned_file (inode) || -f2fs_is_atomic_file (inode) ||f2fs_has_inline_data (inode)) +f2fs_is_atomic_file (inode) ||f2fs_has_inline_data (inode) || +f2fs_is_mmap_file (inode))return false;return S_ISREG (inode->i_mode) ||S_ISDIR (inode->i_mode); }
fs/f2fs/file.c +18 -5
@@ -526,7 +526,11 @@ static int f2fs_file_mmap(struct file *file, struct vm_area_struct *vma)file_accessed (file); vma->vm_ops = &f2fs_file_vm_ops; + +f2fs_down_read (&F2FS_I (inode)->i_sem);set_inode_flag (inode,FI_MMAP_FILE ); +f2fs_up_read (&F2FS_I (inode)->i_sem); +return 0 ; }
@@ -1919,12 +1923,19 @@ static int f2fs_setflags_common(struct inode *inode, u32 iflags, u32 mask)int err =f2fs_convert_inline_inode (inode);if (err)return err; -if (!f2fs_may_compress (inode)) -return -EINVAL ; -if (S_ISREG (inode->i_mode) &&F2FS_HAS_BLOCKS (inode)) + +f2fs_down_write (&F2FS_I (inode)->i_sem); +if (!f2fs_may_compress (inode) || + (S_ISREG (inode->i_mode) && +F2FS_HAS_BLOCKS (inode))) { +f2fs_up_write (&F2FS_I (inode)->i_sem);return -EINVAL ; -if (set_compress_context (inode)) -return -EOPNOTSUPP ; + } + err =set_compress_context (inode); +f2fs_up_write (&F2FS_I (inode)->i_sem); + +if (err) +return err; } }
@@ -3976,6 +3987,7 @@ static int f2fs_ioc_set_compress_option(struct file *filp, unsigned long arg)file_start_write (filp);inode_lock (inode); +f2fs_down_write (&F2FS_I (inode)->i_sem);if (f2fs_is_mmap_file (inode) ||get_dirty_pages (inode)) { ret = -EBUSY ; goto out;
@@ -3995,6 +4007,7 @@ static int f2fs_ioc_set_compress_option(struct file *filp, unsigned long arg)f2fs_warn (sbi,"compression algorithm is successfully set, " "but current kernel doesn't support this algorithm." ); out: +f2fs_up_write (&F2FS_I (inode)->i_sem);inode_unlock (inode);file_end_write (filp);
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 552/739 f2fs: dont reopen the main block device in f2fs_scan_devices
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christoph Hellwig <[email protected]>
[ Upstream commit 51bf8d3c81992ae57beeaf22df78ed7c2782af9d ]
f2fs_scan_devices reopens the main device since the very beginning, which has always been useless, and also means that we don't pass the right holder for the reopen, which now leads to a warning as the core super.c holder ops aren't passed in for the reopen.
--- fs/f2fs/super.c | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-)
fs/f2fs/super.c +8 -12
@@ -1561,7 +1561,8 @@ static void destroy_device_list(struct f2fs_sb_info *sbi)int i;for (i =0 ; i < sbi->s_ndevs; i++) { -blkdev_put (FDEV (i).bdev, sbi->sb->s_type); +if (i >0 ) +blkdev_put (FDEV (i).bdev, sbi->sb->s_type);#ifdef CONFIG_BLK_DEV_ZONED kvfree (FDEV (i).blkz_seq);#endif
@@ -4190,16 +4191,12 @@ static int f2fs_scan_devices(struct f2fs_sb_info *sbi) sbi->aligned_blksize = true;for (i =0 ; i < max_devices; i++) { - -if (i >0 && !RDEV (i).path[0 ]) +if (i ==0 ) +FDEV (0 ).bdev = sbi->sb->s_bdev; +else if (!RDEV (i).path[0 ])break ; -if (max_devices ==1 ) { -/* Single zoned block device mount */ -FDEV (0 ).bdev = -blkdev_get_by_dev (sbi->sb->s_bdev->bd_dev, mode, - sbi->sb->s_type,NULL ); - }else { +if (max_devices >1 ) {/* Multi-device mount */ memcpy (FDEV (i).path,RDEV (i).path,MAX_PATH_LEN ); FDEV(i).total_segments =
@@ -4215,10 +4212,9 @@ static int f2fs_scan_devices(struct f2fs_sb_info *sbi)FDEV (i).end_blk =FDEV (i).start_blk + (FDEV (i).total_segments << sbi->log_blocks_per_seg) -1 ; +FDEV (i).bdev =blkdev_get_by_path (FDEV (i).path, + mode, sbi->sb->s_type,NULL ); } -FDEV (i).bdev =blkdev_get_by_path (FDEV (i).path, mode, - sbi->sb->s_type, -NULL ); }if (IS_ERR (FDEV (i).bdev))return PTR_ERR (FDEV (i).bdev);
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 553/739 f2fs: check zone type before sending async reset zone command
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shin'ichiro Kawasaki <[email protected]>
[ Upstream commit 3cb88bc15937990177df1f7eac6f22ebbed19312 ]
The commit 25f9080576b9 ("f2fs: add async reset zone command support") introduced "async reset zone commands" by calling __submit_zone_reset_cmd() in async discard operations. However, __submit_zone_reset_cmd() is called regardless of zone type of discard target zone. When devices have conventional zones, zone reset commands are sent to the conventional zones and cause I/O errors.
Avoid the I/O errors by checking that the discard target zone type is sequential write required. If not, handle the discard operation in same manner as non-zoned, regular block devices. For that purpose, add a new helper function f2fs_bdev_index() which gets index of the zone reset target device.
--- fs/f2fs/f2fs.h | 16 ++++++++++++++++ fs/f2fs/segment.c | 39 ++++++++++++++++++++++++++++----------- 2 files changed, 44 insertions(+), 11 deletions(-)
fs/f2fs/f2fs.h +16 -0
@@ -4423,6 +4423,22 @@ static inline bool f2fs_blkz_is_seq(struct f2fs_sb_info *sbi, int devi, }#endif +static inline int f2fs_bdev_index (struct f2fs_sb_info *sbi, +struct block_device *bdev) +{ +int i; + +if (!f2fs_is_multi_device (sbi)) +return 0 ; + +for (i =0 ; i < sbi->s_ndevs; i++) +if (FDEV (i).bdev == bdev) +return i; + +WARN_ON (1 ); +return -1 ; +} +static inline bool f2fs_hw_should_discard (struct f2fs_sb_info *sbi) {return f2fs_sb_has_blkzoned (sbi);
fs/f2fs/segment.c +28 -11
@@ -1258,8 +1258,16 @@ static int __submit_discard_cmd(struct f2fs_sb_info *sbi,#ifdef CONFIG_BLK_DEV_ZONED if (f2fs_sb_has_blkzoned (sbi) &&bdev_is_zoned (bdev)) { -__submit_zone_reset_cmd (sbi, dc, flag, wait_list, issued); -return 0 ; +int devi =f2fs_bdev_index (sbi, bdev); + +if (devi <0 ) +return -EINVAL ; + +if (f2fs_blkz_is_seq (sbi, devi, dc->di.start)) { +__submit_zone_reset_cmd (sbi, dc, flag, + wait_list, issued); +return 0 ; + } }#endif
@@ -1785,15 +1793,24 @@ static void f2fs_wait_discard_bio(struct f2fs_sb_info *sbi, block_t blkaddr) dc =__lookup_discard_cmd (sbi, blkaddr);#ifdef CONFIG_BLK_DEV_ZONED if (dc &&f2fs_sb_has_blkzoned (sbi) &&bdev_is_zoned (dc->bdev)) { -/* force submit zone reset */ -if (dc->state ==D_PREP ) -__submit_zone_reset_cmd (sbi, dc,REQ_SYNC , - &dcc->wait_list,NULL ); - dc->ref++; -mutex_unlock (&dcc->cmd_lock); -/* wait zone reset */ -__wait_one_discard_bio (sbi, dc); -return ; +int devi =f2fs_bdev_index (sbi, dc->bdev); + +if (devi <0 ) { +mutex_unlock (&dcc->cmd_lock); +return ; + } + +if (f2fs_blkz_is_seq (sbi, devi, dc->di.start)) { +/* force submit zone reset */ +if (dc->state ==D_PREP ) +__submit_zone_reset_cmd (sbi, dc,REQ_SYNC , + &dcc->wait_list,NULL ); + dc->ref++; +mutex_unlock (&dcc->cmd_lock); +/* wait zone reset */ +__wait_one_discard_bio (sbi, dc); +return ; + } }#endif if (dc) {
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 554/739 f2fs: Only lfs mode is allowed with zoned block device feature
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chunhai Guo <[email protected]>
[ Upstream commit 2bd4df8fcbc72f58ce3c62ed021ab291ca42de0b ]
Now f2fs support four block allocation modes: lfs, adaptive, fragment:segment, fragment:block. Only lfs mode is allowed with zoned block device feature.
--- fs/f2fs/super.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
fs/f2fs/super.c +5 -5
@@ -862,11 +862,6 @@ static int parse_options(struct super_block *sb, char *options, bool is_remount)if (!name)return -ENOMEM ;if (!strcmp (name,"adaptive" )) { -if (f2fs_sb_has_blkzoned (sbi)) { -f2fs_warn (sbi,"adaptive mode is not allowed with zoned block device feature" ); -kfree (name); -return -EINVAL ; - }F2FS_OPTION (sbi).fs_mode =FS_MODE_ADAPTIVE ; }else if (!strcmp (name,"lfs" )) {F2FS_OPTION (sbi).fs_mode =FS_MODE_LFS ;
@@ -1331,6 +1326,11 @@ static int parse_options(struct super_block *sb, char *options, bool is_remount)F2FS_OPTION (sbi).discard_unit = DISCARD_UNIT_SECTION; } + +if (F2FS_OPTION (sbi).fs_mode !=FS_MODE_LFS ) { +f2fs_info (sbi,"Only lfs mode is allowed with zoned block device feature" ); +return -EINVAL ; + }#else f2fs_err (sbi,"Zoned block device support is not enabled" );return -EINVAL ;
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 555/739 Revert "f2fs: fix to do sanity check on extent cache correctly"
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chao Yu <[email protected]>
[ Upstream commit 958ccbbf1ce716d77c7cfa79ace50a421c1eed73 ]
syzbot reports a f2fs bug as below:
UBSAN: array-index-out-of-bounds in fs/f2fs/f2fs.h:3275:19 index 1409 is out of range for type '__le32[923]' (aka 'unsigned int[923]') Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x1e7/0x2d0 lib/dump_stack.c:106 ubsan_epilogue lib/ubsan.c:217 [inline] __ubsan_handle_out_of_bounds+0x11c/0x150 lib/ubsan.c:348 inline_data_addr fs/f2fs/f2fs.h:3275 [inline] __recover_inline_status fs/f2fs/inode.c:113 [inline] do_read_inode fs/f2fs/inode.c:480 [inline] f2fs_iget+0x4730/0x48b0 fs/f2fs/inode.c:604 f2fs_fill_super+0x640e/0x80c0 fs/f2fs/super.c:4601 mount_bdev+0x276/0x3b0 fs/super.c:1391 legacy_get_tree+0xef/0x190 fs/fs_context.c:611 vfs_get_tree+0x8c/0x270 fs/super.c:1519 do_new_mount+0x28f/0xae0 fs/namespace.c:3335 do_mount fs/namespace.c:3675 [inline] __do_sys_mount fs/namespace.c:3884 [inline] __se_sys_mount+0x2d9/0x3c0 fs/namespace.c:3861 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x41/0xc0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd
The issue was bisected to:
commit d48a7b3a72f121655d95b5157c32c7d555e44c05
Author: Chao Yu <[email protected]> Date: Mon Jan 9 03:49:20 2023 +0000
f2fs: fix to do sanity check on extent cache correctly
The root cause is we applied both v1 and v2 of the patch, v2 is the right fix, so it needs to revert v1 in order to fix reported issue.
v1:
commit d48a7b3a72f1 ("f2fs: fix to do sanity check on extent cache correctly")
https://lore.kernel.org/lkml/[email protected]/
v2:
commit 269d11948100 ("f2fs: fix to do sanity check on extent cache correctly")
https://lore.kernel.org/lkml/[email protected]/
--- fs/f2fs/inode.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
fs/f2fs/inode.c +6 -6
@@ -475,6 +475,12 @@ static int do_read_inode(struct inode *inode) fi->i_inline_xattr_size =0 ; } +if (!sanity_check_inode (inode, node_page)) { +f2fs_put_page (node_page,1 ); +f2fs_handle_error (sbi,ERROR_CORRUPTED_INODE ); +return -EFSCORRUPTED ; + } +/* check data exist */ if (f2fs_has_inline_data (inode) && !f2fs_exist_data (inode))__recover_inline_status (inode, node_page);
@@ -544,12 +550,6 @@ static int do_read_inode(struct inode *inode)f2fs_init_read_extent_tree (inode, node_page);f2fs_init_age_extent_tree (inode); -if (!sanity_check_inode (inode, node_page)) { -f2fs_put_page (node_page,1 ); -f2fs_handle_error (sbi,ERROR_CORRUPTED_INODE ); -return -EFSCORRUPTED ; - } -if (!sanity_check_extent_cache (inode)) {f2fs_put_page (node_page,1 );f2fs_handle_error (sbi,ERROR_CORRUPTED_INODE );
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 556/739 f2fs: fix to account gc stats correctly
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chao Yu <[email protected]>
[ Upstream commit 9bf1dcbdfdc8892d9cfeaeab02519c0ecf17fe51 ]
As reported, status debugfs entry shows inconsistent GC stats as below:
GC calls: 6008 (BG: 6161)
- data segments : 3053 (BG: 3053)
- node segments : 2955 (BG: 2955)
Total GC calls is larger than BGGC calls, the reason is:
- f2fs_stat_info.call_count accounts total migrated section count by f2fs_gc()
- f2fs_stat_info.bg_gc accounts total call times of f2fs_gc() from background gc_thread
Another issue is gc_foreground_calls sysfs entry shows total GC call count rather than FGGC call count.
This patch changes as below for fix:
- account GC calls and migrated segment count separately
- support to account migrated section count if it enables large section mode
- fix to show correct value in gc_foreground_calls sysfs entry
--- fs/f2fs/debug.c | 24 ++++++++++++++++++------ fs/f2fs/f2fs.h | 42 +++++++++++++++++++++--------------------- fs/f2fs/file.c | 4 ++++ fs/f2fs/gc.c | 13 +++++++------ fs/f2fs/segment.c | 1 + fs/f2fs/super.c | 1 + fs/f2fs/sysfs.c | 4 ++-- 7 files changed, 54 insertions(+), 35 deletions(-)
fs/f2fs/debug.c +18 -6
@@ -511,12 +511,24 @@ static int stat_show(struct seq_file *s, void *v)seq_printf (s," - Total : %4d\n" , si->nr_total_ckpt);seq_printf (s," - Cur time : %4d(ms)\n" , si->cur_ckpt_time);seq_printf (s," - Peak time : %4d(ms)\n" , si->peak_ckpt_time); -seq_printf (s,"GC calls: %d (BG: %d)\n" , - si->call_count, si->bg_gc); -seq_printf (s," - data segments : %d (%d)\n" , - si->data_segs, si->bg_data_segs); -seq_printf (s," - node segments : %d (%d)\n" , - si->node_segs, si->bg_node_segs); +seq_printf (s,"GC calls: %d (gc_thread: %d)\n" , + si->gc_call_count[BACKGROUND ] + + si->gc_call_count[FOREGROUND ], + si->gc_call_count[BACKGROUND ]); +if (__is_large_section (sbi)) { +seq_printf (s," - data sections : %d (BG: %d)\n" , + si->gc_secs[DATA ][BG_GC ] + si->gc_secs[DATA ][FG_GC ], + si->gc_secs[DATA ][BG_GC ]); +seq_printf (s," - node sections : %d (BG: %d)\n" , + si->gc_secs[NODE ][BG_GC ] + si->gc_secs[NODE ][FG_GC ], + si->gc_secs[NODE ][BG_GC ]); + } +seq_printf (s," - data segments : %d (BG: %d)\n" , + si->gc_segs[DATA ][BG_GC ] + si->gc_segs[DATA ][FG_GC ], + si->gc_segs[DATA ][BG_GC ]); +seq_printf (s," - node segments : %d (BG: %d)\n" , + si->gc_segs[NODE ][BG_GC ] + si->gc_segs[NODE ][FG_GC ], + si->gc_segs[NODE ][BG_GC ]);seq_puts (s," - Reclaimed segs :\n" );seq_printf (s," - Normal : %d\n" , sbi->gc_reclaimed_segs[GC_NORMAL ]);seq_printf (s," - Idle CB : %d\n" , sbi->gc_reclaimed_segs[GC_IDLE_CB ]);
fs/f2fs/f2fs.h +21 -21
84 lines not on this page · raw message
fs/f2fs/file.c +4 -0
@@ -1728,6 +1728,7 @@ static int f2fs_expand_inode_data(struct inode *inode, loff_t offset,if (has_not_enough_free_secs (sbi,0 ,GET_SEC_FROM_SEG (sbi,overprovision_segments (sbi)))) {f2fs_down_write (&sbi->gc_lock); +stat_inc_gc_call_count (sbi,FOREGROUND ); err =f2fs_gc (sbi, &gc_control);if (err && err != -ENODATA ) goto out_err;
@@ -2476,6 +2477,7 @@ static int f2fs_ioc_gc(struct file *filp, unsigned long arg) gc_control.init_gc_type = sync ?FG_GC :BG_GC ; gc_control.err_gc_skipped = sync; +stat_inc_gc_call_count (sbi,FOREGROUND ); ret =f2fs_gc (sbi, &gc_control); out:mnt_drop_write_file (filp);
@@ -2519,6 +2521,7 @@ static int __f2fs_ioc_gc_range(struct file *filp, struct f2fs_gc_range *range) } gc_control.victim_segno =GET_SEGNO (sbi, range->start); +stat_inc_gc_call_count (sbi,FOREGROUND ); ret =f2fs_gc (sbi, &gc_control);if (ret) {if (ret == -EBUSY )
@@ -3001,6 +3004,7 @@ static int f2fs_ioc_flush_device(struct file *filp, unsigned long arg) sm->last_victim[ALLOC_NEXT ] = end_segno +1 ; gc_control.victim_segno = start_segno; +stat_inc_gc_call_count (sbi,FOREGROUND ); ret =f2fs_gc (sbi, &gc_control);if (ret == -EAGAIN ) ret =0 ;
fs/f2fs/gc.c +7 -6
@@ -121,8 +121,8 @@ static int gc_thread_func(void *data)else increase_sleep_time (gc_th, &wait_ms); do_gc: -if (!foreground) -stat_inc_bggc_count (sbi->stat_info); +stat_inc_gc_call_count (sbi, foreground ? +FOREGROUND :BACKGROUND ); sync_mode =F2FS_OPTION (sbi).bggc_mode ==BGGC_MODE_SYNC ;
@@ -1685,6 +1685,7 @@ static int do_garbage_collect(struct f2fs_sb_info *sbi,int seg_freed =0 , migrated =0 ;unsigned char type =IS_DATASEG (get_seg_entry (sbi, segno)->type) ?SUM_TYPE_DATA :SUM_TYPE_NODE ; +unsigned char data_type = (type ==SUM_TYPE_DATA ) ?DATA :NODE ;int submitted =0 ;if (__is_large_section (sbi))
@@ -1766,7 +1767,7 @@ static int do_garbage_collect(struct f2fs_sb_info *sbi, segno, gc_type, force_migrate); -stat_inc_seg_count (sbi, type, gc_type); +stat_inc_gc_seg_count (sbi, data_type, gc_type); sbi->gc_reclaimed_segs[sbi->gc_mode]++; migrated++;
@@ -1783,12 +1784,12 @@ static int do_garbage_collect(struct f2fs_sb_info *sbi, }if (submitted) -f2fs_submit_merged_write (sbi, - (type ==SUM_TYPE_NODE ) ?NODE :DATA ); +f2fs_submit_merged_write (sbi, data_type);blk_finish_plug (&plug); -stat_inc_call_count (sbi->stat_info); +if (migrated) +stat_inc_gc_sec_count (sbi, data_type, gc_type);return seg_freed; }
fs/f2fs/segment.c +1 -0
@@ -433,6 +433,7 @@ void f2fs_balance_fs(struct f2fs_sb_info *sbi, bool need) .err_gc_skipped = false, .nr_free_secs = 1 };f2fs_down_write (&sbi->gc_lock); +stat_inc_gc_call_count (sbi,FOREGROUND );f2fs_gc (sbi, &gc_control); } }
fs/f2fs/super.c +1 -0
@@ -2206,6 +2206,7 @@ static int f2fs_disable_checkpoint(struct f2fs_sb_info *sbi) .nr_free_secs = 1 };f2fs_down_write (&sbi->gc_lock); +stat_inc_gc_call_count (sbi,FOREGROUND ); err =f2fs_gc (sbi, &gc_control);if (err == -ENODATA ) { err =0 ;
fs/f2fs/sysfs.c +2 -2
@@ -974,8 +974,8 @@ F2FS_SBI_GENERAL_RO_ATTR(unusable_blocks_per_sec);#ifdef CONFIG_F2FS_STAT_FS STAT_INFO_RO_ATTR (cp_foreground_calls, cp_count);STAT_INFO_RO_ATTR (cp_background_calls, bg_cp_count); -STAT_INFO_RO_ATTR (gc_foreground_calls, call_count); -STAT_INFO_RO_ATTR (gc_background_calls, bg_gc); +STAT_INFO_RO_ATTR (gc_foreground_calls, gc_call_count[FOREGROUND ]); +STAT_INFO_RO_ATTR (gc_background_calls, gc_call_count[BACKGROUND ]);#endif /* FAULT_INFO ATTR */
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 557/739 f2fs: fix to account cp stats correctly
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chao Yu <[email protected]>
[ Upstream commit eb61c2cca2eb2110cc7b61a7bc15b3850977a778 ]
cp_foreground_calls sysfs entry shows total CP call count rather than foreground CP call count, fix it.
--- fs/f2fs/checkpoint.c | 2 +- fs/f2fs/debug.c | 9 ++++++++- fs/f2fs/f2fs.h | 25 ++++++++++++++----------- fs/f2fs/gc.c | 5 +++++ fs/f2fs/recovery.c | 1 + fs/f2fs/segment.c | 3 ++- fs/f2fs/super.c | 8 +++++++- fs/f2fs/sysfs.c | 14 ++++++++++++-- 8 files changed, 50 insertions(+), 17 deletions(-)
fs/f2fs/checkpoint.c +1 -1
@@ -1701,9 +1701,9 @@ int f2fs_write_checkpoint(struct f2fs_sb_info *sbi, struct cp_control *cpc) }f2fs_restore_inmem_curseg (sbi); +stat_inc_cp_count (sbi); stop:unblock_operations (sbi); -stat_inc_cp_count (sbi->stat_info);if (cpc->reason &CP_RECOVERY )f2fs_notice (sbi,"checkpoint: version = %llx" , ckpt_ver);
fs/f2fs/debug.c +8 -1
@@ -215,6 +215,9 @@ static void update_general_status(struct f2fs_sb_info *sbi) si->valid_blks[type] += blks; } +for (i =0 ; i <MAX_CALL_TYPE ; i++) + si->cp_call_count[i] =atomic_read (&sbi->cp_call_count[i]); +for (i =0 ; i <2 ; i++) { si->segment_count[i] = sbi->segment_count[i]; si->block_count[i] = sbi->block_count[i];
@@ -497,7 +500,9 @@ static int stat_show(struct seq_file *s, void *v)seq_printf (s," - Prefree: %d\n - Free: %d (%d)\n\n" , si->prefree_count, si->free_segs, si->free_secs);seq_printf (s,"CP calls: %d (BG: %d)\n" , - si->cp_count, si->bg_cp_count); + si->cp_call_count[TOTAL_CALL ], + si->cp_call_count[BACKGROUND ]); +seq_printf (s,"CP count: %d\n" , si->cp_count);seq_printf (s," - cp blocks : %u\n" , si->meta_count[META_CP ]);seq_printf (s," - sit blocks : %u\n" , si->meta_count[META_SIT ]);
@@ -699,6 +704,8 @@ int f2fs_build_stats(struct f2fs_sb_info *sbi)atomic_set (&sbi->inplace_count,0 );for (i =META_CP ; i <META_MAX ; i++)atomic_set (&sbi->meta_count[i],0 ); +for (i =0 ; i <MAX_CALL_TYPE ; i++) +atomic_set (&sbi->cp_call_count[i],0 );atomic_set (&sbi->max_aw_cnt,0 );
fs/f2fs/f2fs.h +14 -11
@@ -1383,6 +1383,13 @@ enum errors_option { MOUNT_ERRORS_PANIC, /* panic on errors */ }; +enum { +BACKGROUND , +FOREGROUND , +MAX_CALL_TYPE , +TOTAL_CALL =FOREGROUND , +}; +static inline int f2fs_test_bit (unsigned int nr,char *addr);static inline void f2fs_set_bit (unsigned int nr,char *addr);static inline void f2fs_clear_bit (unsigned int nr,char *addr);
@@ -1695,6 +1702,7 @@ struct f2fs_sb_info {unsigned int io_skip_bggc;/* skip background gc for in-flight IO */ unsigned int other_skip_bggc;/* skip background gc for other reasons */ unsigned int ndirty_inode[NR_INODE_TYPE ];/* # of dirty inodes */ +atomic_t cp_call_count[MAX_CALL_TYPE ];/* # of cp call */ #endif spinlock_t stat_lock;/* lock for stat operations */
@@ -3860,12 +3868,6 @@ void f2fs_destroy_recovery_cache(void);/* * debug.c */ -enum { -BACKGROUND , -FOREGROUND , -MAX_CALL_TYPE -}; - #ifdef CONFIG_F2FS_STAT_FS struct f2fs_stat_info { struct list_head stat_list;
@@ -3912,7 +3914,7 @@ struct f2fs_stat_info {int dirty_count, node_pages, meta_pages, compress_pages;int compress_page_hit;int prefree_count, free_segs, free_secs; -int cp_count, bg_cp_count; +int cp_call_count[MAX_CALL_TYPE ], cp_count;int gc_call_count[MAX_CALL_TYPE ];int gc_segs[2 ][2 ];int gc_secs[2 ][2 ];
@@ -3937,8 +3939,9 @@ static inline struct f2fs_stat_info *F2FS_STAT(struct f2fs_sb_info *sbi)return (struct f2fs_stat_info *)sbi->stat_info; } -#define stat_inc_cp_count (si) ((si)->cp_count++) -#define stat_inc_bg_cp_count (si) ((si)->bg_cp_count++) +#define stat_inc_cp_call_count (sbi, foreground) \ + atomic_inc(&sbi->cp_call_count[(foreground)]) +#define stat_inc_cp_count (si) (F2FS_STAT(sbi)->cp_count++)#define stat_io_skip_bggc_count (sbi) ((sbi)->io_skip_bggc++)#define stat_other_skip_bggc_count (sbi) ((sbi)->other_skip_bggc++)#define stat_inc_dirty_inode (sbi, type) ((sbi)->ndirty_inode[type]++)
@@ -4055,8 +4058,8 @@ void __init f2fs_create_root_stats(void);void f2fs_destroy_root_stats (void );void f2fs_update_sit_info (struct f2fs_sb_info *sbi);#else -#define stat_inc_cp_count (si) do { } while (0) -#define stat_inc_bg_cp_count (si) do { } while (0) +#define stat_inc_cp_call_count (sbi, foreground) do { } while (0) +#define stat_inc_cp_count (sbi) do { } while (0)#define stat_io_skip_bggc_count (sbi) do { } while (0)#define stat_other_skip_bggc_count (sbi) do { } while (0)#define stat_inc_dirty_inode (sbi, type) do { } while (0)
fs/f2fs/gc.c +5 -0
@@ -1840,6 +1840,7 @@ int f2fs_gc(struct f2fs_sb_info *sbi, struct f2fs_gc_control *gc_control)* secure free segments which doesn't need fggc any more. */ if (prefree_segments (sbi)) { +stat_inc_cp_call_count (sbi,TOTAL_CALL ); ret =f2fs_write_checkpoint (sbi, &cpc);if (ret) goto stop;
@@ -1888,6 +1889,7 @@ int f2fs_gc(struct f2fs_sb_info *sbi, struct f2fs_gc_control *gc_control) round++;if (skipped_round >MAX_SKIP_GC_COUNT && skipped_round *2 >= round) { +stat_inc_cp_call_count (sbi,TOTAL_CALL ); ret =f2fs_write_checkpoint (sbi, &cpc); goto stop; }
@@ -1903,6 +1905,7 @@ int f2fs_gc(struct f2fs_sb_info *sbi, struct f2fs_gc_control *gc_control)*/ if (free_sections (sbi) <= upper_secs +NR_GC_CHECKPOINT_SECS &&prefree_segments (sbi)) { +stat_inc_cp_call_count (sbi,TOTAL_CALL ); ret =f2fs_write_checkpoint (sbi, &cpc);if (ret) goto stop;
@@ -2030,6 +2033,7 @@ static int free_segment_range(struct f2fs_sb_info *sbi,if (gc_only) goto out; +stat_inc_cp_call_count (sbi,TOTAL_CALL ); err =f2fs_write_checkpoint (sbi, &cpc);if (err) goto out;
@@ -2222,6 +2226,7 @@ int f2fs_resize_fs(struct file *filp, __u64 block_count)clear_sbi_flag (sbi,SBI_IS_RESIZEFS );set_sbi_flag (sbi,SBI_IS_DIRTY ); +stat_inc_cp_call_count (sbi,TOTAL_CALL ); err =f2fs_write_checkpoint (sbi, &cpc);if (err) {update_fs_metadata (sbi, secs);
fs/f2fs/recovery.c +1 -0
@@ -924,6 +924,7 @@ int f2fs_recover_fsync_data(struct f2fs_sb_info *sbi, bool check_only)struct cp_control cpc = { .reason =CP_RECOVERY , }; +stat_inc_cp_call_count (sbi,TOTAL_CALL ); err =f2fs_write_checkpoint (sbi, &cpc); } }
fs/f2fs/segment.c +2 -1
@@ -511,8 +511,8 @@ void f2fs_balance_fs_bg(struct f2fs_sb_info *sbi, bool from_bg)mutex_unlock (&sbi->flush_lock); } +stat_inc_cp_call_count (sbi,BACKGROUND );f2fs_sync_fs (sbi->sb,1 ); -stat_inc_bg_cp_count (sbi->stat_info); } static int __submit_flush_wait(struct f2fs_sb_info *sbi,
@@ -3246,6 +3246,7 @@ int f2fs_trim_fs(struct f2fs_sb_info *sbi, struct fstrim_range *range) goto out;f2fs_down_write (&sbi->gc_lock); +stat_inc_cp_call_count (sbi,TOTAL_CALL ); err =f2fs_write_checkpoint (sbi, &cpc);f2fs_up_write (&sbi->gc_lock);if (err)
fs/f2fs/super.c +7 -1
@@ -1601,6 +1601,7 @@ static void f2fs_put_super(struct super_block *sb)struct cp_control cpc = { .reason =CP_UMOUNT , }; +stat_inc_cp_call_count (sbi,TOTAL_CALL ); err =f2fs_write_checkpoint (sbi, &cpc); }
@@ -1610,6 +1611,7 @@ static void f2fs_put_super(struct super_block *sb)struct cp_control cpc = { .reason =CP_UMOUNT |CP_TRIMMED , }; +stat_inc_cp_call_count (sbi,TOTAL_CALL ); err =f2fs_write_checkpoint (sbi, &cpc); }
@@ -1706,8 +1708,10 @@ int f2fs_sync_fs(struct super_block *sb, int sync)if (unlikely (is_sbi_flag_set (sbi,SBI_POR_DOING )))return -EAGAIN ; -if (sync) +if (sync) { +stat_inc_cp_call_count (sbi,TOTAL_CALL ); err =f2fs_issue_checkpoint (sbi); + }return err; }
@@ -2232,6 +2236,7 @@ static int f2fs_disable_checkpoint(struct f2fs_sb_info *sbi)f2fs_down_write (&sbi->gc_lock); cpc.reason =CP_PAUSE ;set_sbi_flag (sbi,SBI_CP_DISABLED ); +stat_inc_cp_call_count (sbi,TOTAL_CALL ); err =f2fs_write_checkpoint (sbi, &cpc);if (err) goto out_unlock;
@@ -4868,6 +4873,7 @@ static void kill_f2fs_super(struct super_block *sb)struct cp_control cpc = { .reason =CP_UMOUNT , }; +stat_inc_cp_call_count (sbi,TOTAL_CALL );f2fs_write_checkpoint (sbi, &cpc); }
fs/f2fs/sysfs.c +12 -2
@@ -356,6 +356,16 @@ static ssize_t f2fs_sbi_show(struct f2fs_attr *a,if (!strcmp (a->attr.name,"revoked_atomic_block" ))return sysfs_emit (buf,"%llu\n" , sbi->revoked_atomic_block); +#ifdef CONFIG_F2FS_STAT_FS +if (!strcmp (a->attr.name,"cp_foreground_calls" )) +return sysfs_emit (buf,"%d\n" , +atomic_read (&sbi->cp_call_count[TOTAL_CALL ]) - +atomic_read (&sbi->cp_call_count[BACKGROUND ])); +if (!strcmp (a->attr.name,"cp_background_calls" )) +return sysfs_emit (buf,"%d\n" , +atomic_read (&sbi->cp_call_count[BACKGROUND ])); +#endif + ui = (unsigned int *)(ptr + a->offset);return sysfs_emit (buf,"%u\n" , *ui);
@@ -972,8 +982,8 @@ F2FS_SBI_GENERAL_RO_ATTR(unusable_blocks_per_sec);/* STAT_INFO ATTR */ #ifdef CONFIG_F2FS_STAT_FS -STAT_INFO_RO_ATTR (cp_foreground_calls, cp_count); -STAT_INFO_RO_ATTR (cp_background_calls, bg_cp_count); +STAT_INFO_RO_ATTR (cp_foreground_calls, cp_call_count[FOREGROUND ]); +STAT_INFO_RO_ATTR (cp_background_calls, cp_call_count[BACKGROUND ]);STAT_INFO_RO_ATTR (gc_foreground_calls, gc_call_count[FOREGROUND ]);STAT_INFO_RO_ATTR (gc_background_calls, gc_call_count[BACKGROUND ]);#endif
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 558/739 cgroup:namespace: Remove unused cgroup_namespaces_init()
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lu Jialin <[email protected]>
[ Upstream commit 82b90b6c5b38e457c7081d50dff11ecbafc1e61a ]
cgroup_namspace_init() just return 0. Therefore, there is no need to call it during start_kernel. Just remove it.
--- kernel/cgroup/namespace.c | 6 ------ 1 file changed, 6 deletions(-)
kernel/cgroup/namespace.c +0 -6
@@ -149,9 +149,3 @@ const struct proc_ns_operations cgroupns_operations = { .install = cgroupns_install, .owner = cgroupns_owner, }; - -static __init int cgroup_namespaces_init (void ) -{ -return 0 ; -} -subsys_initcall (cgroup_namespaces_init);
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 559/739 coresight: trbe: Allocate platform data per device
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Suzuki K Poulose <[email protected]>
[ Upstream commit 39744738a67de9153d73e11817937c0004feab2e ]
Coresight TRBE driver shares a single platform data (which is empty btw). However, with the commit 4e8fe7e5c3a5
("coresight: Store pointers to connections rather than an array of them") the coresight core would free up the pdata, resulting in multiple attempts to free the same pdata for TRBE instances. Fix this by allocating a pdata per coresight_device.
--- drivers/hwtracing/coresight/coresight-trbe.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-)
drivers/hwtracing/coresight/coresight-trbe.c +4 -7
@@ -1244,10 +1244,13 @@ static void arm_trbe_register_coresight_cpu(struct trbe_drvdata *drvdata, int cpif (!desc.name) goto cpu_clear; + desc.pdata =coresight_get_platform_data (dev); +if (IS_ERR (desc.pdata)) + goto cpu_clear; + desc.type =CORESIGHT_DEV_TYPE_SINK ; desc.subtype.sink_subtype =CORESIGHT_DEV_SUBTYPE_SINK_PERCPU_SYSMEM ; desc.ops = &arm_trbe_cs_ops; - desc.pdata =dev_get_platdata (dev); desc.groups = arm_trbe_groups; desc.dev = dev; trbe_csdev =coresight_register (&desc);
@@ -1479,7 +1482,6 @@ static void arm_trbe_remove_irq(struct trbe_drvdata *drvdata)static int arm_trbe_device_probe (struct platform_device *pdev) { -struct coresight_platform_data *pdata;struct trbe_drvdata *drvdata;struct device *dev = &pdev->dev;int ret;
@@ -1494,12 +1496,7 @@ static int arm_trbe_device_probe(struct platform_device *pdev)if (!drvdata)return -ENOMEM ; - pdata =coresight_get_platform_data (dev); -if (IS_ERR (pdata)) -return PTR_ERR (pdata); -dev_set_drvdata (dev, drvdata); - dev->platform_data = pdata; drvdata->pdev = pdev; ret =arm_trbe_probe_irq (pdev, drvdata);if (ret)
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 560/739 coresight: platform: acpi: Ignore the absence of graph
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Suzuki K Poulose <[email protected]>
[ Upstream commit 3a2888aa1f962c55ca36119aebe67355c7bf54e4 ]
Some components may not have graph connections for describing the trace path. e.g., ETE, where it could directly use the per CPU TRBE. Ignore the absence of graph connections
Stable-dep-of: 1a9e02673e25 ("coresight: Fix memory leak in acpi_buffer->pointer")
--- drivers/hwtracing/coresight/coresight-platform.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/hwtracing/coresight/coresight-platform.c +5 -1
@@ -669,8 +669,12 @@ static int acpi_coresight_parse_graph(struct device *dev,struct coresight_connection *new_conn; graph =acpi_get_coresight_graph (adev); +/* +* There are no graph connections, which is fine for some components. +* e.g., ETE +*/ if (!graph) -return -ENOENT ; +return 0 ; nlinks = graph->package.elements[2 ].integer.value;if (!nlinks)
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 561/739 coresight: Fix memory leak in acpi_buffer->pointer
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Junhao He <[email protected]>
[ Upstream commit 1a9e02673e2550f5612099e64e8761f0c8fc0f50 ]
There are memory leaks reported by kmemleak:
...
unreferenced object 0xffff00213c141000 (size 1024):
comm "systemd-udevd", pid 2123, jiffies 4294909467 (age 6062.160s) hex dump (first 32 bytes):
04 00 00 00 02 00 00 00 18 10 14 3c 21 00 ff ff ...........<!...
00 00 00 00 00 00 00 00 03 00 00 00 10 00 00 00 ................
backtrace:
[<000000004b7c9001>] __kmem_cache_alloc_node+0x2f8/0x348
[<00000000b0fc7ceb>] __kmalloc+0x58/0x108
[<0000000064ff4695>] acpi_os_allocate+0x2c/0x68
[<000000007d57d116>] acpi_ut_initialize_buffer+0x54/0xe0
[<0000000024583908>] acpi_evaluate_object+0x388/0x438
[<0000000017b2e72b>] acpi_evaluate_object_typed+0xe8/0x240
[<000000005df0eac2>] coresight_get_platform_data+0x1b4/0x988 [coresight]...
The ACPI buffer memory (buf.pointer) should be freed. But the buffer is also used after returning from acpi_get_dsd_graph(). Move the temporary variables buf to acpi_coresight_parse_graph(), and free it before the function return to prevent memory leak.
--- .../hwtracing/coresight/coresight-platform.c | 40 ++++++++++++------- 1 file changed, 26 insertions(+), 14 deletions(-)
drivers/hwtracing/coresight/coresight-platform.c +26 -14
@@ -494,19 +494,18 @@ static inline bool acpi_validate_dsd_graph(const union acpi_object *graph)/* acpi_get_dsd_graph - Find the _DSD Graph property for the given device. */ static const union acpi_object * -acpi_get_dsd_graph (struct acpi_device *adev) +acpi_get_dsd_graph (struct acpi_device *adev,struct acpi_buffer *buf) {int i; -struct acpi_buffer buf = {ACPI_ALLOCATE_BUFFER };acpi_status status;const union acpi_object *dsd; status =acpi_evaluate_object_typed (adev->handle,"_DSD" ,NULL , - &buf,ACPI_TYPE_PACKAGE ); + buf,ACPI_TYPE_PACKAGE );if (ACPI_FAILURE (status))return NULL ; - dsd = buf.pointer; + dsd = buf->pointer;/* * _DSD property consists tuples { Prop_UUID, Package() }
@@ -557,12 +556,12 @@ acpi_validate_coresight_graph(const union acpi_object *cs_graph)* returns NULL. */ static const union acpi_object * -acpi_get_coresight_graph (struct acpi_device *adev) +acpi_get_coresight_graph (struct acpi_device *adev,struct acpi_buffer *buf) {const union acpi_object *graph_list, *graph;int i, nr_graphs; - graph_list =acpi_get_dsd_graph (adev); + graph_list =acpi_get_dsd_graph (adev, buf);if (!graph_list)return graph_list;
@@ -663,22 +662,24 @@ static int acpi_coresight_parse_graph(struct device *dev,struct acpi_device *adev, struct coresight_platform_data *pdata) { + int ret = 0;int i, nlinks;const union acpi_object *graph;struct coresight_connection conn, zero_conn = {};struct coresight_connection *new_conn; +struct acpi_buffer buf = {ACPI_ALLOCATE_BUFFER ,NULL }; - graph =acpi_get_coresight_graph (adev); + graph =acpi_get_coresight_graph (adev, &buf);/* * There are no graph connections, which is fine for some components. * e.g., ETE */ if (!graph) -return 0 ; + goto free; nlinks = graph->package.elements[2 ].integer.value;if (!nlinks) -return 0 ; + goto free;for (i =0 ; i < nlinks; i++) {const union acpi_object *link = &graph->package.elements[3 + i];
@@ -686,17 +687,28 @@ static int acpi_coresight_parse_graph(struct device *dev, conn = zero_conn; dir =acpi_coresight_parse_link (adev, link, &conn); -if (dir <0 ) -return dir; +if (dir <0 ) { + ret = dir; + goto free; + }if (dir ==ACPI_CORESIGHT_LINK_MASTER ) { new_conn =coresight_add_out_conn (dev, pdata, &conn); -if (IS_ERR (new_conn)) -return PTR_ERR (new_conn); +if (IS_ERR (new_conn)) { + ret =PTR_ERR (new_conn); + goto free; + } } } -return 0 ; +free: +/* +* When ACPI fails to alloc a buffer, it will free the buffer +* created via ACPI_ALLOCATE_BUFFER and set to NULL. +* ACPI_FREE can handle NULL pointers, so free it directly. +*/ +ACPI_FREE (buf.pointer); +return ret; }/*
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 562/739 coresight: trbe: Fix TRBE potential sleep in atomic context
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Junhao He <[email protected]>
[ Upstream commit c0a232f1e19e378c5c4e5973a996392942c80090 ]
smp_call_function_single() will allocate an IPI interrupt vector to the target processor and send a function call request to the interrupt vector. After the target processor receives the IPI interrupt, it will execute arm_trbe_remove_coresight_cpu() call request in the interrupt handler.
According to the device_unregister() stack information, if other process is useing the device, the down_write() may sleep, and trigger deadlocks or unexpected errors.
arm_trbe_remove_coresight_cpu
coresight_unregister
device_unregister
device_del
kobject_del
__kobject_del
sysfs_remove_dir
kernfs_remove
down_write ---------> it may sleepAdd a helper arm_trbe_disable_cpu() to disable TRBE precpu irq and reset per TRBE.
Simply call arm_trbe_remove_coresight_cpu() directly without useing the smp_call_function_single(), which is the same as registering the TRBE coresight device.
--- drivers/hwtracing/coresight/coresight-trbe.c | 32 +++++++++++--------- 1 file changed, 17 insertions(+), 15 deletions(-)
drivers/hwtracing/coresight/coresight-trbe.c +17 -15
@@ -1225,6 +1225,16 @@ static void arm_trbe_enable_cpu(void *info)enable_percpu_irq (drvdata->irq,IRQ_TYPE_NONE ); } +static void arm_trbe_disable_cpu (void *info) +{ +struct trbe_drvdata *drvdata = info; +struct trbe_cpudata *cpudata =this_cpu_ptr (drvdata->cpudata); + +disable_percpu_irq (drvdata->irq); +trbe_reset_local (cpudata); +} + +static void arm_trbe_register_coresight_cpu (struct trbe_drvdata *drvdata,int cpu) {struct trbe_cpudata *cpudata =per_cpu_ptr (drvdata->cpudata, cpu);
@@ -1329,18 +1339,12 @@ static void arm_trbe_probe_cpu(void *info)cpumask_clear_cpu (cpu, &drvdata->supported_cpus); } -static void arm_trbe_remove_coresight_cpu (void *info) +static void arm_trbe_remove_coresight_cpu (struct trbe_drvdata *drvdata,int cpu) { -int cpu =smp_processor_id (); -struct trbe_drvdata *drvdata = info; -struct trbe_cpudata *cpudata =per_cpu_ptr (drvdata->cpudata, cpu);struct coresight_device *trbe_csdev =coresight_get_percpu_sink (cpu); -disable_percpu_irq (drvdata->irq); -trbe_reset_local (cpudata);if (trbe_csdev) {coresight_unregister (trbe_csdev); - cpudata->drvdata =NULL ;coresight_set_percpu_sink (cpu,NULL ); } }
@@ -1369,8 +1373,10 @@ static int arm_trbe_remove_coresight(struct trbe_drvdata *drvdata) {int cpu; -for_each_cpu (cpu, &drvdata->supported_cpus) -smp_call_function_single (cpu, arm_trbe_remove_coresight_cpu, drvdata,1 ); +for_each_cpu (cpu, &drvdata->supported_cpus) { +smp_call_function_single (cpu, arm_trbe_disable_cpu, drvdata,1 ); +arm_trbe_remove_coresight_cpu (drvdata, cpu); + }free_percpu (drvdata->cpudata);return 0 ; }
@@ -1409,12 +1415,8 @@ static int arm_trbe_cpu_teardown(unsigned int cpu, struct hlist_node *node) { struct trbe_drvdata *drvdata = hlist_entry_safe(node, struct trbe_drvdata, hotplug_node); -if (cpumask_test_cpu (cpu, &drvdata->supported_cpus)) { -struct trbe_cpudata *cpudata =per_cpu_ptr (drvdata->cpudata, cpu); - -disable_percpu_irq (drvdata->irq); -trbe_reset_local (cpudata); - } +if (cpumask_test_cpu (cpu, &drvdata->supported_cpus)) +arm_trbe_disable_cpu (drvdata);return 0 ; }
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 563/739 Revert "f2fs: do not issue small discard commands during checkpoint"
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chao Yu <[email protected]>
[ Upstream commit 005abf9e5e0d4dcfce318ae5dbcac32b7bf6b647 ]
Previously, we have two mechanisms to cache & submit small discards:
a) set max small discard number in /sys/fs/f2fs/vdb/max_small_discards, and checkpoint will cache small discard candidates w/ configured maximum number.
b) call FITRIM ioctl, also, checkpoint in f2fs_trim_fs() will cache small discard candidates w/ configured discard granularity, but w/o limitation of number. FSTRIM interface is asynchronized, so it won't submit discard directly.
Finally, discard thread will submit them in background periodically.
However, after commit 9ac00e7cef10 ("f2fs: do not issue small discard commands during checkpoint"), the mechanism a) is broken, since no matter how we configure the sysfs entry /sys/fs/f2fs/vdb/max_small_discards, checkpoint will not cache small discard candidates any more.
echo 0 > /sys/fs/f2fs/vdb/max_small_discards xfs_io -f /mnt/f2fs/file -c "pwrite 0 2m" -c "fsync" xfs_io /mnt/f2fs/file -c "fpunch 0 4k"
sync
cat /proc/fs/f2fs/vdb/discard_plist_info |head -2
echo 100 > /sys/fs/f2fs/vdb/max_small_discards rm /mnt/f2fs/filexfs_io -f /mnt/f2fs/file -c "pwrite 0 2m" -c "fsync" xfs_io /mnt/f2fs/file -c "fpunch 0 4k"
sync
cat /proc/fs/f2fs/vdb/discard_plist_info |head -2
Before the patch:
Discard pend list(Show diacrd_cmd count on each entry, .:not exist):
0 . . . . . . . .
Discard pend list(Show diacrd_cmd count on each entry, .:not exist):
0 3 1 . . . . . .
After the patch:
Discard pend list(Show diacrd_cmd count on each entry, .:not exist):
0 . . . . . . . .
Discard pend list(Show diacrd_cmd count on each entry, .:not exist):
0 . . . . . . . .
This patch reverts commit 9ac00e7cef10 ("f2fs: do not issue small discard commands during checkpoint") in order to fix this issue.
--- fs/f2fs/segment.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/f2fs/segment.c +1 -1
@@ -2211,7 +2211,7 @@ void f2fs_clear_prefree_segments(struct f2fs_sb_info *sbi, len = next_pos - cur_pos;if (f2fs_sb_has_blkzoned (sbi) || - !force || len < cpc->trim_minlen) + (force && len < cpc->trim_minlen)) goto skip; f2fs_issue_discard(sbi, entry->start_blkaddr + cur_pos,
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 564/739 RDMA/irdma: Prevent zero-length STAG registration
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christopher Bednarz <[email protected]>
[ Upstream commit bb6d73d9add68ad270888db327514384dfa44958 ]
Currently irdma allows zero-length STAGs to be programmed in HW during the kernel mode fast register flow. Zero-length MR or STAG registration disable HW memory length checks.
Improve gaps in bounds checking in irdma by preventing zero-length STAG or MR registrations except if the IB_PD_UNSAFE_GLOBAL_RKEY is set.
This addresses the disclosure CVE-2023-25775.
--- drivers/infiniband/hw/irdma/ctrl.c | 6 ++++++ drivers/infiniband/hw/irdma/type.h | 2 ++ drivers/infiniband/hw/irdma/verbs.c | 10 ++++++++-- 3 files changed, 16 insertions(+), 2 deletions(-)
drivers/infiniband/hw/irdma/ctrl.c +6 -0
@@ -1061,6 +1061,9 @@ static int irdma_sc_alloc_stag(struct irdma_sc_dev *dev,u64 hdr;enum irdma_page_size page_size; +if (!info->total_len && !info->all_memory) +return -EINVAL ; +if (info->page_size ==0x40000000 ) page_size =IRDMA_PAGE_SIZE_1G ;else if (info->page_size ==0x200000 )
@@ -1126,6 +1129,9 @@ static int irdma_sc_mr_reg_non_shared(struct irdma_sc_dev *dev,u8 addr_type;enum irdma_page_size page_size; +if (!info->total_len && !info->all_memory) +return -EINVAL ; +if (info->page_size ==0x40000000 ) page_size =IRDMA_PAGE_SIZE_1G ;else if (info->page_size ==0x200000 )
drivers/infiniband/hw/irdma/type.h +2 -0
@@ -971,6 +971,7 @@ struct irdma_allocate_stag_info { bool remote_access:1; bool use_hmc_fcn_index:1; bool use_pf_rid:1; + bool all_memory:1;u8 hmc_fcn_index; };
@@ -998,6 +999,7 @@ struct irdma_reg_ns_stag_info { bool use_hmc_fcn_index:1;u8 hmc_fcn_index; bool use_pf_rid:1; + bool all_memory:1; };struct irdma_fast_reg_stag_info {
drivers/infiniband/hw/irdma/verbs.c +8 -2
@@ -2552,7 +2552,8 @@ static int irdma_hw_alloc_stag(struct irdma_device *iwdev, struct irdma_mr *iwmr) {struct irdma_allocate_stag_info *info; -struct irdma_pd *iwpd =to_iwpd (iwmr->ibmr.pd); +struct ib_pd *pd = iwmr->ibmr.pd; +struct irdma_pd *iwpd =to_iwpd (pd);int status;struct irdma_cqp_request *cqp_request;struct cqp_cmds_info *cqp_info;
@@ -2568,6 +2569,7 @@ static int irdma_hw_alloc_stag(struct irdma_device *iwdev, info->stag_idx = iwmr->stag >>IRDMA_CQPSQ_STAG_IDX_S ; info->pd_id = iwpd->sc_pd.pd_id; info->total_len = iwmr->len; + info->all_memory = pd->flags &IB_PD_UNSAFE_GLOBAL_RKEY ; info->remote_access = true; cqp_info->cqp_cmd =IRDMA_OP_ALLOC_STAG ; cqp_info->post_sq =1 ;
@@ -2615,6 +2617,8 @@ static struct ib_mr *irdma_alloc_mr(struct ib_pd *pd, enum ib_mr_type mr_type, iwmr->type =IRDMA_MEMREG_TYPE_MEM ; palloc = &iwpbl->pble_alloc; iwmr->page_cnt = max_num_sg; +/* Use system PAGE_SIZE as the sg page sizes are unknown at this point */ + iwmr->len = max_num_sg *PAGE_SIZE ; err_code =irdma_get_pble (iwdev->rf->pble_rsrc, palloc, iwmr->page_cnt, false);if (err_code)
@@ -2694,7 +2698,8 @@ static int irdma_hwreg_mr(struct irdma_device *iwdev, struct irdma_mr *iwmr, {struct irdma_pbl *iwpbl = &iwmr->iwpbl;struct irdma_reg_ns_stag_info *stag_info; -struct irdma_pd *iwpd =to_iwpd (iwmr->ibmr.pd); +struct ib_pd *pd = iwmr->ibmr.pd; +struct irdma_pd *iwpd =to_iwpd (pd);struct irdma_pble_alloc *palloc = &iwpbl->pble_alloc;struct irdma_cqp_request *cqp_request;struct cqp_cmds_info *cqp_info;
@@ -2713,6 +2718,7 @@ static int irdma_hwreg_mr(struct irdma_device *iwdev, struct irdma_mr *iwmr, stag_info->total_len = iwmr->len; stag_info->access_rights =irdma_get_mr_access (access); stag_info->pd_id = iwpd->sc_pd.pd_id; + stag_info->all_memory = pd->flags &IB_PD_UNSAFE_GLOBAL_RKEY ;if (stag_info->access_rights &IRDMA_ACCESS_FLAGS_ZERO_BASED ) stag_info->addr_type =IRDMA_ADDR_TYPE_ZERO_BASED ;else
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 565/739 scsi: core: Use 32-bit hostnum in scsi_host_lookup()
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tony Battersby <[email protected]>
[ Upstream commit 62ec2092095b678ff89ce4ba51c2938cd1e8e630 ]
Change scsi_host_lookup() hostnum argument type from unsigned short to unsigned int to match the type used everywhere else.
--- drivers/scsi/hosts.c | 4 ++-- include/scsi/scsi_host.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)
drivers/scsi/hosts.c +2 -2
@@ -537,7 +537,7 @@ EXPORT_SYMBOL(scsi_host_alloc);static int __scsi_host_match (struct device *dev,const void *data) {struct Scsi_Host *p; -const unsigned short *hostnum = data; +const unsigned int *hostnum = data; p =class_to_shost (dev);return p->host_no == *hostnum;
@@ -554,7 +554,7 @@ static int __scsi_host_match(struct device *dev, const void *data)* that scsi_host_get() took. The put_device() below dropped * the reference from class_find_device(). **/ -struct Scsi_Host *scsi_host_lookup (unsigned short hostnum) +struct Scsi_Host *scsi_host_lookup (unsigned int hostnum) {struct device *cdev;struct Scsi_Host *shost =NULL ;
include/scsi/scsi_host.h +1 -1
@@ -769,7 +769,7 @@ extern void scsi_remove_host(struct Scsi_Host *);extern struct Scsi_Host *scsi_host_get (struct Scsi_Host *);extern int scsi_host_busy (struct Scsi_Host *shost);extern void scsi_host_put (struct Scsi_Host *t); -extern struct Scsi_Host *scsi_host_lookup (unsigned short ); +extern struct Scsi_Host *scsi_host_lookup (unsigned int hostnum);extern const char *scsi_host_state_name (enum scsi_host_state );extern void scsi_host_complete_all_commands (struct Scsi_Host *shost,enum scsi_host_status status);
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 566/739 scsi: fcoe: Fix potential deadlock on &fip->ctlr_lock
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chengfeng Ye <[email protected]>
[ Upstream commit 1a1975551943f681772720f639ff42fbaa746212 ]
There is a long call chain that &fip->ctlr_lock is acquired by isr fnic_isr_msix_wq_copy() under hard IRQ context. Thus other process context code acquiring the lock should disable IRQ, otherwise deadlock could happen if the IRQ preempts the execution while the lock is held in process context on the same CPU.
[ISR]fnic_isr_msix_wq_copy()
-> fnic_wq_copy_cmpl_handler()
-> fnic_fcpio_cmpl_handler()
-> fnic_fcpio_flogi_reg_cmpl_handler()
-> fnic_flush_tx()
-> fnic_send_frame()
-> fcoe_ctlr_els_send()
-> spin_lock_bh(&fip->ctlr_lock)
[Process Context]
1. fcoe_ctlr_timer_work()
-> fcoe_ctlr_flogi_send()
-> spin_lock_bh(&fip->ctlr_lock)
2. fcoe_ctlr_recv_work()
-> fcoe_ctlr_recv_handler()
-> fcoe_ctlr_recv_els()
-> fcoe_ctlr_announce()
-> spin_lock_bh(&fip->ctlr_lock)
3. fcoe_ctlr_recv_work()
-> fcoe_ctlr_recv_handler()
-> fcoe_ctlr_recv_els()
-> fcoe_ctlr_flogi_retry()
-> spin_lock_bh(&fip->ctlr_lock)
4. -> fcoe_xmit()
-> fcoe_ctlr_els_send()
-> spin_lock_bh(&fip->ctlr_lock)
spin_lock_bh() is not enough since fnic_isr_msix_wq_copy() is a hardirq.
These flaws were found by an experimental static analysis tool I am developing for irq-related deadlock.
The patch fix the potential deadlocks by spin_lock_irqsave() to disable hard irq.
--- drivers/scsi/fcoe/fcoe_ctlr.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-)
drivers/scsi/fcoe/fcoe_ctlr.c +12 -8
@@ -319,16 +319,17 @@ static void fcoe_ctlr_announce(struct fcoe_ctlr *fip) {struct fcoe_fcf *sel;struct fcoe_fcf *fcf; +unsigned long flags;mutex_lock (&fip->ctlr_mutex); -spin_lock_bh (&fip->ctlr_lock); +spin_lock_irqsave (&fip->ctlr_lock, flags);kfree_skb (fip->flogi_req); fip->flogi_req =NULL ;list_for_each_entry (fcf, &fip->fcfs, list) fcf->flogi_sent =0 ; -spin_unlock_bh (&fip->ctlr_lock); +spin_unlock_irqrestore (&fip->ctlr_lock, flags); sel = fip->sel_fcf;if (sel &ðer_addr_equal (sel->fcf_mac, fip->dest_addr))
@@ -699,6 +700,7 @@ int fcoe_ctlr_els_send(struct fcoe_ctlr *fip, struct fc_lport *lport, {struct fc_frame *fp;struct fc_frame_header *fh; +unsigned long flags;u16 old_xid;u8 op;u8 mac[ETH_ALEN ];
@@ -732,11 +734,11 @@ int fcoe_ctlr_els_send(struct fcoe_ctlr *fip, struct fc_lport *lport, op =FIP_DT_FLOGI ;if (fip->mode ==FIP_MODE_VN2VN )break ; -spin_lock_bh (&fip->ctlr_lock); +spin_lock_irqsave (&fip->ctlr_lock, flags);kfree_skb (fip->flogi_req); fip->flogi_req = skb; fip->flogi_req_send =1 ; -spin_unlock_bh (&fip->ctlr_lock); +spin_unlock_irqrestore (&fip->ctlr_lock, flags);schedule_work (&fip->timer_work);return -EINPROGRESS ;case ELS_FDISC :
@@ -1705,10 +1707,11 @@ static int fcoe_ctlr_flogi_send_locked(struct fcoe_ctlr *fip)static int fcoe_ctlr_flogi_retry (struct fcoe_ctlr *fip) {struct fcoe_fcf *fcf; +unsigned long flags;int error;mutex_lock (&fip->ctlr_mutex); -spin_lock_bh (&fip->ctlr_lock); +spin_lock_irqsave (&fip->ctlr_lock, flags);LIBFCOE_FIP_DBG (fip,"re-sending FLOGI - reselect\n" ); fcf =fcoe_ctlr_select (fip);if (!fcf || fcf->flogi_sent) {
@@ -1719,7 +1722,7 @@ static int fcoe_ctlr_flogi_retry(struct fcoe_ctlr *fip)fcoe_ctlr_solicit (fip,NULL ); error =fcoe_ctlr_flogi_send_locked (fip); } -spin_unlock_bh (&fip->ctlr_lock); +spin_unlock_irqrestore (&fip->ctlr_lock, flags);mutex_unlock (&fip->ctlr_mutex);return error; }
@@ -1736,8 +1739,9 @@ static int fcoe_ctlr_flogi_retry(struct fcoe_ctlr *fip)static void fcoe_ctlr_flogi_send (struct fcoe_ctlr *fip) {struct fcoe_fcf *fcf; +unsigned long flags; -spin_lock_bh (&fip->ctlr_lock); +spin_lock_irqsave (&fip->ctlr_lock, flags); fcf = fip->sel_fcf;if (!fcf || !fip->flogi_req_send) goto unlock;
@@ -1764,7 +1768,7 @@ static void fcoe_ctlr_flogi_send(struct fcoe_ctlr *fip) }else /* XXX */ LIBFCOE_FIP_DBG (fip,"No FCF selected - defer send\n" ); unlock: -spin_unlock_bh (&fip->ctlr_lock); +spin_unlock_irqrestore (&fip->ctlr_lock, flags); }/**
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 567/739 interconnect: qcom: sm8450: Enable sync_state
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Konrad Dybcio <[email protected]>
[ Upstream commit 16862f1b2110eca6330e5be6d804e1a08e06a202 ]
Enable sync_state on sm8450 so that the interconnect votes actually mean anything and aren't just pinned to INT_MAX.
--- drivers/interconnect/qcom/sm8450.c | 1 + 1 file changed, 1 insertion(+)
drivers/interconnect/qcom/sm8450.c +1 -0
@@ -1886,6 +1886,7 @@ static struct platform_driver qnoc_driver = { .driver = { .name = "qnoc-sm8450", .of_match_table = qnoc_of_match, + .sync_state = icc_sync_state, }, };
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 568/739 interconnect: qcom: bcm-voter: Improve enable_mask handling
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Konrad Dybcio <[email protected]>
[ Upstream commit a1f4170dec440f023601d57e49227b784074d218 ]
We don't need all the complex arithmetic for BCMs utilizing enable_mask, as all we need to do is to determine whether there's any user (or keepalive) asking for it to be on.
Separate the logic for such BCMs for a small speed boost.
Stable-dep-of: 1a70ca71547b ("interconnect: qcom: bcm-voter: Use enable_maks for keepalive voting")
--- drivers/interconnect/qcom/bcm-voter.c | 43 ++++++++++++++++++++++----- 1 file changed, 36 insertions(+), 7 deletions(-)
drivers/interconnect/qcom/bcm-voter.c +36 -7
@@ -58,6 +58,36 @@ static u64 bcm_div(u64 num, u32 base)return num; } +/* BCMs with enable_mask use one-hot-encoding for on/off signaling */ +static void bcm_aggregate_mask (struct qcom_icc_bcm *bcm) +{ +struct qcom_icc_node *node; +int bucket, i; + +for (bucket =0 ; bucket <QCOM_ICC_NUM_BUCKETS ; bucket++) { + bcm->vote_x[bucket] =0 ; + bcm->vote_y[bucket] =0 ; + +for (i =0 ; i < bcm->num_nodes; i++) { + node = bcm->nodes[i]; + +/* If any vote in this bucket exists, keep the BCM enabled */ +if (node->sum_avg[bucket] || node->max_peak[bucket]) { + bcm->vote_x[bucket] =0 ; + bcm->vote_y[bucket] = bcm->enable_mask; +break ; + } + } + } + +if (bcm->keepalive) { + bcm->vote_x[QCOM_ICC_BUCKET_AMC ] =1 ; + bcm->vote_x[QCOM_ICC_BUCKET_WAKE ] =1 ; + bcm->vote_y[QCOM_ICC_BUCKET_AMC ] =1 ; + bcm->vote_y[QCOM_ICC_BUCKET_WAKE ] =1 ; + } +} +static void bcm_aggregate (struct qcom_icc_bcm *bcm) {struct qcom_icc_node *node;
@@ -83,11 +113,6 @@ static void bcm_aggregate(struct qcom_icc_bcm *bcm) temp = agg_peak[bucket] * bcm->vote_scale; bcm->vote_y[bucket] =bcm_div (temp, bcm->aux_data.unit); - -if (bcm->enable_mask && (bcm->vote_x[bucket] || bcm->vote_y[bucket])) { - bcm->vote_x[bucket] =0 ; - bcm->vote_y[bucket] = bcm->enable_mask; - } } if (bcm->keepalive && bcm->vote_x[QCOM_ICC_BUCKET_AMC] == 0 &&
@@ -260,8 +285,12 @@ int qcom_icc_bcm_voter_commit(struct bcm_voter *voter)return 0 ;mutex_lock (&voter->lock); -list_for_each_entry (bcm, &voter->commit_list, list) -bcm_aggregate (bcm); +list_for_each_entry (bcm, &voter->commit_list, list) { +if (bcm->enable_mask) +bcm_aggregate_mask (bcm); +else +bcm_aggregate (bcm); + }/* * Pre sort the BCMs based on VCD for ease of generating a command list
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 569/739 interconnect: qcom: bcm-voter: Use enable_maks for keepalive voting
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Konrad Dybcio <[email protected]>
[ Upstream commit 1a70ca71547be051769f0628aa09717694f508f0 ]
BCMs with an enable_mask expect to only have that specific value written to them. The current implementation only works by miracle for BCMs with enable mask == BIT(0), as the minimal vote we've been using so far just so happens to be equal to that.
Use the correct value with keepalive voting.
--- drivers/interconnect/qcom/bcm-voter.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/interconnect/qcom/bcm-voter.c +4 -4
@@ -81,10 +81,10 @@ static void bcm_aggregate_mask(struct qcom_icc_bcm *bcm) }if (bcm->keepalive) { - bcm->vote_x[QCOM_ICC_BUCKET_AMC ] =1 ; - bcm->vote_x[QCOM_ICC_BUCKET_WAKE ] =1 ; - bcm->vote_y[QCOM_ICC_BUCKET_AMC ] =1 ; - bcm->vote_y[QCOM_ICC_BUCKET_WAKE ] =1 ; + bcm->vote_x[QCOM_ICC_BUCKET_AMC ] = bcm->enable_mask; + bcm->vote_x[QCOM_ICC_BUCKET_WAKE ] = bcm->enable_mask; + bcm->vote_y[QCOM_ICC_BUCKET_AMC ] = bcm->enable_mask; + bcm->vote_y[QCOM_ICC_BUCKET_WAKE ] = bcm->enable_mask; } }
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 570/739 dt-bindings: usb: samsung,exynos-dwc3: fix order of clocks on Exynos5433
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Krzysztof Kozlowski <[email protected]>
[ Upstream commit 8d4ff1351801bd646c9fed7aedb9705250f2c87b ]
The Exynos5433 DTSI had always different order of DWC USB3 controller clocks than the binding. The order in the binding was introduced in the commit 949ea75b7ba4 ("dt-bindings: usb: samsung,exynos-dwc3: convert to dtschema") converting to DT schema. The Linux driver does not care about order and was always getting clocks by name. Therefore assume the DTS is the preferred order and correct the binding.
--- Documentation/devicetree/bindings/usb/samsung,exynos-dwc3.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Documentation/devicetree/bindings/usb/samsung,exynos-dwc3.yaml +1 -1
@@ -82,8 +82,8 @@ allOf: items: - const: aclk - const: susp_clk - - const: pipe_pclk - const: phyclk + - const: pipe_pclk - if: properties:
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 571/739 dt-bindings: usb: samsung,exynos-dwc3: Fix Exynos5433 compatible
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sam Protsenko <[email protected]>
[ Upstream commit 26f4f8358d89c0d9972a30abdb3f3a425ef49e38 ]
The correct compatible for Exynos5433 is "samsung,exynos5433-dwusb3". Fix the typo in its usage.
--- Documentation/devicetree/bindings/usb/samsung,exynos-dwc3.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Documentation/devicetree/bindings/usb/samsung,exynos-dwc3.yaml +1 -1
@@ -72,7 +72,7 @@ allOf: properties: compatible: contains: - const: samsung,exynos54333-dwusb3 + const: samsung,exynos5433-dwusb3 then: properties: clocks:
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 572/739 serial: tegra: handle clk prepare error in tegra_uart_hw_init()
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yi Yang <[email protected]>
[ Upstream commit 5abd01145d0cc6cd1b7c2fe6ee0b9ea0fa13671e ]
In tegra_uart_hw_init(), the return value of clk_prepare_enable() should be checked since it might fail.
--- drivers/tty/serial/serial-tegra.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/tty/serial/serial-tegra.c +5 -1
@@ -998,7 +998,11 @@ static int tegra_uart_hw_init(struct tegra_uart_port *tup) tup->ier_shadow =0 ; tup->current_baud =0 ; -clk_prepare_enable (tup->uart_clk); + ret =clk_prepare_enable (tup->uart_clk); +if (ret) { +dev_err (tup->uport.dev,"could not enable clk\n" ); +return ret; + }/* Reset the UART controller to clear all previous status.*/ reset_control_assert (tup->rst);
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 573/739 Documentation: devices.txt: Remove ttyIOC*
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christophe Leroy <[email protected]>
[ Upstream commit e327fdc262345ca37b358a51ff0c0046ab1b8d15 ]
IOC4 serial driver was removed, remove associated devices from documentation.
--- Documentation/admin-guide/devices.txt | 9 --------- 1 file changed, 9 deletions(-)
Documentation/admin-guide/devices.txt +0 -9
@@ -2692,14 +2692,8 @@ 46 = /dev/ttyCPM0 PPC CPM (SCC or SMC) - port 0 ... 49 = /dev/ttyCPM5 PPC CPM (SCC or SMC) - port 3 - 50 = /dev/ttyIOC0 Altix serial card - ... - 81 = /dev/ttyIOC31 Altix serial card 82 = /dev/ttyVR0 NEC VR4100 series SIU 83 = /dev/ttyVR1 NEC VR4100 series DSIU - 84 = /dev/ttyIOC84 Altix ioc4 serial card - ... - 115 = /dev/ttyIOC115 Altix ioc4 serial card 116 = /dev/ttySIOC0 Altix ioc3 serial card ... 147 = /dev/ttySIOC31 Altix ioc3 serial card
@@ -2762,9 +2756,6 @@ 46 = /dev/cucpm0 Callout device for ttyCPM0 ... 49 = /dev/cucpm5 Callout device for ttyCPM5 - 50 = /dev/cuioc40 Callout device for ttyIOC40 - ... - 81 = /dev/cuioc431 Callout device for ttyIOC431 82 = /dev/cuvr0 Callout device for ttyVR0 83 = /dev/cuvr1 Callout device for ttyVR1
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 574/739 Documentation: devices.txt: Remove ttySIOC*
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christophe Leroy <[email protected]>
[ Upstream commit 27681960f05515555441d7bf58d565cbc68137f3 ]
IOC3 serial driver was removed, remove associated devices from documentation.
--- Documentation/admin-guide/devices.txt | 3 --- 1 file changed, 3 deletions(-)
Documentation/admin-guide/devices.txt +0 -3
@@ -2694,9 +2694,6 @@ 49 = /dev/ttyCPM5 PPC CPM (SCC or SMC) - port 3 82 = /dev/ttyVR0 NEC VR4100 series SIU 83 = /dev/ttyVR1 NEC VR4100 series DSIU - 116 = /dev/ttySIOC0 Altix ioc3 serial card - ... - 147 = /dev/ttySIOC31 Altix ioc3 serial card 148 = /dev/ttyPSC0 PPC PSC - port 0 ... 153 = /dev/ttyPSC5 PPC PSC - port 5
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 575/739 Documentation: devices.txt: Fix minors for ttyCPM*
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christophe Leroy <[email protected]>
[ Upstream commit 4b91dcc2f601cc2098b5fead71344704ddcff8b7 ]
ttyCPM* devices belong to CPM_UART driver at the first place and that driver provides 6 ports.
--- Documentation/admin-guide/devices.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Documentation/admin-guide/devices.txt +2 -2
@@ -2691,7 +2691,7 @@ 45 = /dev/ttyMM1 Marvell MPSC - port 1 (obsolete unused) 46 = /dev/ttyCPM0 PPC CPM (SCC or SMC) - port 0 ... - 49 = /dev/ttyCPM5 PPC CPM (SCC or SMC) - port 3 + 51 = /dev/ttyCPM5 PPC CPM (SCC or SMC) - port 5 82 = /dev/ttyVR0 NEC VR4100 series SIU 83 = /dev/ttyVR1 NEC VR4100 series DSIU 148 = /dev/ttyPSC0 PPC PSC - port 0
@@ -2752,7 +2752,7 @@ 43 = /dev/ttycusmx2 Callout device for ttySMX2 46 = /dev/cucpm0 Callout device for ttyCPM0 ... - 49 = /dev/cucpm5 Callout device for ttyCPM5 + 51 = /dev/cucpm5 Callout device for ttyCPM5 82 = /dev/cuvr0 Callout device for ttyVR0 83 = /dev/cuvr1 Callout device for ttyVR1
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 576/739 amba: bus: fix refcount leak
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peng Fan <[email protected]>
[ Upstream commit e312cbdc11305568554a9e18a2ea5c2492c183f3 ]
commit 5de1540b7bc4 ("drivers/amba: create devices from device tree") increases the refcount of of_node, but not releases it in amba_device_release, so there is refcount leak. By using of_node_put to avoid refcount leak.
--- drivers/amba/bus.c | 1 + 1 file changed, 1 insertion(+)
drivers/amba/bus.c +1 -0
@@ -528,6 +528,7 @@ static void amba_device_release(struct device *dev) {struct amba_device *d =to_amba_device (dev); +of_node_put (d->dev.of_node);if (d->res.parent)release_resource (&d->res);mutex_destroy (&d->periphid_lock);
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 577/739 Revert "IB/isert: Fix incorrect release of isert connection"
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Leon Romanovsky <[email protected]>
[ Upstream commit dfe261107c080709459c32695847eec96238852b ]
Commit: 699826f4e30a ("IB/isert: Fix incorrect release of isert connection") is causing problems on OPA when DEVICE_REMOVAL is happening.
------------[ cut here ]------------ WARNING: CPU: 52 PID: 2117247 at drivers/infiniband/core/cq.c:359 ib_cq_pool_cleanup+0xac/0xb0 [ib_core] Modules linked in: nfsd nfs_acl target_core_user uio tcm_fc libfc
scsi_transport_fc tcm_loop target_core_pscsi target_core_iblock target_core_file rpcsec_gss_krb5 auth_rpcgss nfsv4 dns_resolver nfs lockd grace fscache netfs rfkill rpcrdma rdma_ucm ib_srpt sunrpc ib_isert iscsi_target_mod target_core_mod opa_vnic ib_iser libiscsi ib_umad scsi_transport_iscsi rdma_cm ib_ipoib iw_cm ib_cm hfi1(-) rdmavt ib_uverbs intel_rapl_msr intel_rapl_common sb_edac ib_core x86_pkg_temp_thermal intel_powerclamp coretemp i2c_i801 mxm_wmi rapl iTCO_wdt ipmi_si iTCO_vendor_support mei_me ipmi_devintf mei intel_cstate ioatdma intel_uncore i2c_smbus joydev pcspkr lpc_ich ipmi_msghandler acpi_power_meter acpi_pad xfs libcrc32c sr_mod sd_mod cdrom t10_pi sg crct10dif_pclmul crc32_pclmul crc32c_intel drm_kms_helper drm_shmem_helper ahci libahci ghash_clmulni_intel igb drm libata dca i2c_algo_bit wmi fuse
CPU: 52 PID: 2117247 Comm: modprobe Not tainted 6.5.0-rc1+ #1 Hardware name: Intel Corporation S2600CWR/S2600CW, BIOS SE5C610.86B.01.01.0014.121820151719 12/18/2015 RIP: 0010:ib_cq_pool_cleanup+0xac/0xb0 [ib_core] Code: ff 48 8b 43 40 48 8d 7b 40 48 83 e8 40 4c 39 e7 75 b3 49 83
c4 10 4d 39 fc 75 94 5b 5d 41 5c 41 5d 41 5e 41 5f c3 cc cc cc cc <0f> 0b eb a1 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 0f 1f
RSP: 0018:ffffc10bea13fc80 EFLAGS: 00010206
RAX: 000000000000010c RBX: ffff9bf5c7e66c00 RCX: 000000008020001d
RDX: 000000008020001e RSI: fffff175221f9900 RDI: ffff9bf5c7e67640
RBP: ffff9bf5c7e67600 R08: ffff9bf5c7e64400 R09: 000000008020001d
R10: 0000000040000000 R11: 0000000000000000 R12: ffff9bee4b1e8a18
R13: dead000000000122 R14: dead000000000100 R15: ffff9bee4b1e8a38
FS: 00007ff1e6d38740(0000) GS:ffff9bfd9fb00000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00005652044ecc68 CR3: 0000000889b5c005 CR4: 00000000001706e0
Call Trace: <TASK> ? __warn+0x80/0x130 ? ib_cq_pool_cleanup+0xac/0xb0 [ib_core] ? report_bug+0x195/0x1a0 ? handle_bug+0x3c/0x70 ? exc_invalid_op+0x14/0x70 ? asm_exc_invalid_op+0x16/0x20 ? ib_cq_pool_cleanup+0xac/0xb0 [ib_core] disable_device+0x9d/0x160 [ib_core] __ib_unregister_device+0x42/0xb0 [ib_core] ib_unregister_device+0x22/0x30 [ib_core] rvt_unregister_device+0x20/0x90 [rdmavt] hfi1_unregister_ib_device+0x16/0xf0 [hfi1] remove_one+0x55/0x1a0 [hfi1] pci_device_remove+0x36/0xa0 device_release_driver_internal+0x193/0x200 driver_detach+0x44/0x90 bus_remove_driver+0x69/0xf0 pci_unregister_driver+0x2a/0xb0 hfi1_mod_cleanup+0xc/0x3c [hfi1] __do_sys_delete_module.constprop.0+0x17a/0x2f0 ? exit_to_user_mode_prepare+0xc4/0xd0 ? syscall_trace_enter.constprop.0+0x126/0x1a0 do_syscall_64+0x5c/0x90 ? syscall_exit_to_user_mode+0x12/0x30 ? do_syscall_64+0x69/0x90 ? syscall_exit_work+0x103/0x130 ? syscall_exit_to_user_mode+0x12/0x30 ? do_syscall_64+0x69/0x90 ? exc_page_fault+0x65/0x150 entry_SYSCALL_64_after_hwframe+0x6e/0xd8 RIP: 0033:0x7ff1e643f5ab Code: 73 01 c3 48 8b 0d 75 a8 1b 00 f7 d8 64 89 01 48 83 c8 ff c3
66 2e 0f 1f 84 00 00 00 00 00 90 f3 0f 1e fa b8 b0 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d 45 a8 1b 00 f7 d8 64 89 01 48
RSP: 002b:00007ffec9103cc8 EFLAGS: 00000206 ORIG_RAX: 00000000000000b0
RAX: ffffffffffffffda RBX: 00005615267fdc50 RCX: 00007ff1e643f5ab
RDX: 0000000000000000 RSI: 0000000000000800 RDI: 00005615267fdcb8
RBP: 00005615267fdc50 R08: 0000000000000000 R09: 0000000000000000
R10: 00007ff1e659eac0 R11: 0000000000000206 R12: 00005615267fdcb8
R13: 0000000000000000 R14: 00005615267fdcb8 R15: 00007ffec9105ff8
</TASK> ---[ end trace 0000000000000000 ]---
And...
restrack: ------------[ cut here ]------------ infiniband hfi1_0: BUG: RESTRACK detected leak of resources
restrack: Kernel PD object allocated by ib_isert is not freed
restrack: Kernel CQ object allocated by ib_core is not freed
restrack: Kernel QP object allocated by rdma_cm is not freed
restrack: ------------[ cut here ]------------
--- drivers/infiniband/ulp/isert/ib_isert.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/infiniband/ulp/isert/ib_isert.c +2 -0
@@ -2570,6 +2570,8 @@ static void isert_wait_conn(struct iscsit_conn *conn)isert_put_unsol_pending_cmds (conn);isert_wait4cmds (conn);isert_wait4logout (isert_conn); + +queue_work (isert_release_wq, &isert_conn->release_work); }static void isert_free_conn (struct iscsit_conn *conn)
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 578/739 RDMA/siw: Balance the reference of cep->kref in the error path
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Guoqing Jiang <[email protected]>
[ Upstream commit b056327bee09e6b86683d3f709a438ccd6031d72 ]
The siw_connect can go to err in below after cep is allocated successfully:
1. If siw_cm_alloc_work returns failure. In this case socket is not assoicated with cep so siw_cep_put can't be called by siw_socket_disassoc. We need to call siw_cep_put twice since cep->kref is increased once after it was initialized.
2. If siw_cm_queue_work can't find a work, which means siw_cep_get is not called in siw_cm_queue_work, so cep->kref is increased twice by siw_cep_get and when associate socket with cep after it was initialized. So we need to call siw_cep_put three times (one in siw_socket_disassoc).
3. siw_send_mpareqrep returns error, this scenario is similar as 2.
So we need to remove one siw_cep_put in the error path.
--- drivers/infiniband/sw/siw/siw_cm.c | 1 - 1 file changed, 1 deletion(-)
drivers/infiniband/sw/siw/siw_cm.c +0 -1
@@ -1501,7 +1501,6 @@ int siw_connect(struct iw_cm_id *id, struct iw_cm_conn_param *params) cep->cm_id =NULL ; id->rem_ref (id); -siw_cep_put (cep); qp->cep =NULL ;siw_cep_put (cep);
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 579/739 RDMA/siw: Correct wrong debug message
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Guoqing Jiang <[email protected]>
[ Upstream commit bee024d20451e4ce04ea30099cad09f7f75d288b ]
We need to print num_sle first then pbl->max_buf per the condition. Also replace mem->pbl with pbl while at it.
--- drivers/infiniband/sw/siw/siw_verbs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/infiniband/sw/siw/siw_verbs.c +1 -1
@@ -1494,7 +1494,7 @@ int siw_map_mr_sg(struct ib_mr *base_mr, struct scatterlist *sl, int num_sle,if (pbl->max_buf < num_sle) {siw_dbg_mem (mem,"too many SGE's: %d > %d\n" , - mem->pbl->max_buf, num_sle); + num_sle, pbl->max_buf);return -ENOMEM ; }for_each_sg (sl, slp, num_sle, i) {
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 580/739 RDMA/efa: Fix wrong resources deallocation order
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yonatan Nachum <[email protected]>
[ Upstream commit dc202c57e9a1423aed528e4b8dc949509cd32191 ]
When trying to destroy QP or CQ, we first decrease the refcount and potentially free memory regions allocated for the object and then request the device to destroy the object. If the device fails, the object isn't fully destroyed so the user/IB core can try to destroy the object again which will lead to underflow when trying to decrease an already zeroed refcount.
Deallocate resources in reverse order of allocating them to safely free them.
--- drivers/infiniband/hw/efa/efa_verbs.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/infiniband/hw/efa/efa_verbs.c +3 -3
@@ -449,12 +449,12 @@ int efa_destroy_qp(struct ib_qp *ibqp, struct ib_udata *udata)ibdev_dbg (&dev->ibdev,"Destroy qp[%u]\n" , ibqp->qp_num); -efa_qp_user_mmap_entries_remove (qp); - err =efa_destroy_qp_handle (dev, qp->qp_handle);if (err)return err; +efa_qp_user_mmap_entries_remove (qp); +if (qp->rq_cpu_addr) { ibdev_dbg(&dev->ibdev, "qp->cpu_addr[0x%p] freed: size[%lu], dma[%pad]\n",
@@ -1013,8 +1013,8 @@ int efa_destroy_cq(struct ib_cq *ibcq, struct ib_udata *udata)"Destroy cq[%d] virt[0x%p] freed: size[%lu], dma[%pad]\n" , cq->cq_idx, cq->cpu_addr, cq->size, &cq->dma_addr); -efa_cq_user_mmap_entries_remove (cq);efa_destroy_cq_idx (dev, cq->cq_idx); +efa_cq_user_mmap_entries_remove (cq);if (cq->eq) {xa_erase (&dev->cqs_xa, cq->cq_idx);synchronize_irq (cq->eq->irq.irqn);
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 581/739 HID: logitech-dj: Fix error handling in logi_dj_recv_switch_to_dj_mode()
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nikita Zhandarovich <[email protected]>
[ Upstream commit 6f20d3261265885f6a6be4cda49d7019728760e0 ]
Presently, if a call to logi_dj_recv_send_report() fails, we do not learn about the error until after sending short HID_OUTPUT_REPORT with hid_hw_raw_request().
To handle this somewhat unlikely issue, return on error in logi_dj_recv_send_report() (minding ugly sleep workaround) and take into account the result of hid_hw_raw_request().
Found by Linux Verification Center (linuxtesting.org) with static analysis tool SVACE.
--- drivers/hid/hid-logitech-dj.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/hid/hid-logitech-dj.c +4 -1
@@ -1285,6 +1285,9 @@ static int logi_dj_recv_switch_to_dj_mode(struct dj_receiver_dev *djrcv_dev,* 50 msec should gives enough time to the receiver to be ready. */ msleep (50 ); + +if (retval) +return retval; }/*
@@ -1306,7 +1309,7 @@ static int logi_dj_recv_switch_to_dj_mode(struct dj_receiver_dev *djrcv_dev, buf[5 ] =0x09 ; buf[6 ] =0x00 ; -hid_hw_raw_request (hdev,REPORT_ID_HIDPP_SHORT , buf, + retval =hid_hw_raw_request (hdev,REPORT_ID_HIDPP_SHORT , buf,HIDPP_REPORT_SHORT_LENGTH ,HID_OUTPUT_REPORT ,HID_REQ_SET_REPORT );
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 582/739 nvmem: core: Return NULL when no nvmem layout is found
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Miquel Raynal <[email protected]>
[ Upstream commit 81e1d9a39569d315f747c2af19ce502cd08645ed ]
Currently, of_nvmem_layout_get_container() returns NULL on error, or an error pointer if either CONFIG_NVMEM or CONFIG_OF is turned off. We should likely avoid this kind of mix for two reasons: to clarify the intend and anyway fix the !CONFIG_OF which will likely always if we use this helper somewhere else. Let's just return NULL when no layout is found, we don't need an error value here.
--- include/linux/nvmem-consumer.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/nvmem-consumer.h +1 -1
@@ -256,7 +256,7 @@ static inline struct nvmem_device *of_nvmem_device_get(struct device_node *np,static inline struct device_node *of_nvmem_layout_get_container (struct nvmem_device *nvmem) { -return ERR_PTR (-EOPNOTSUPP ); +return NULL ; }#endif /* CONFIG_NVMEM && CONFIG_OF */
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 583/739 riscv: Require FRAME_POINTER for some configurations
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Björn Töpel <[email protected]>
[ Upstream commit 9f944d2e0ab39296bfadb29167dc333815ba9f48 ]
Some V configurations implicitly turn on '-fno-omit-frame-pointer', but leaving FRAME_POINTER disabled. This makes it hard to reason about the FRAME_POINTER config, and also triggers build failures introduced in by the commit in the Fixes: tag.
Select FRAME_POINTER explicitly for these configurations.
--- arch/riscv/Kconfig | 1 + arch/riscv/Makefile | 3 --- 2 files changed, 1 insertion(+), 3 deletions(-)
arch/riscv/Kconfig +1 -0
@@ -62,6 +62,7 @@ config RISCV select COMMON_CLK select CPU_PM if CPU_IDLE || HIBERNATION select EDAC_SUPPORT + select FRAME_POINTER if PERF_EVENTS || (FUNCTION_TRACER && !DYNAMIC_FTRACE) select GENERIC_ARCH_TOPOLOGY select GENERIC_ATOMIC64 if !64BIT select GENERIC_CLOCKEVENTS_BROADCAST if SMP
arch/riscv/Makefile +0 -3
@@ -87,9 +87,6 @@ endif ifeq ($(CONFIG_CMODEL_MEDANY),y) KBUILD_CFLAGS += -mcmodel=medany endif -ifeq ($(CONFIG_PERF_EVENTS),y) - KBUILD_CFLAGS += -fno-omit-frame-pointer -endif # Avoid generating .eh_frame sections. KBUILD_CFLAGS += -fno-asynchronous-unwind-tables -fno-unwind-tables
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 584/739 f2fs: compress: fix to assign compress_level for lz4 correctly
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chao Yu <[email protected]>
[ Upstream commit 091a4dfbb1d32b06c031edbfe2a44af100c4604f ]
After remount, F2FS_OPTION().compress_level was assgin to LZ4HC_DEFAULT_CLEVEL incorrectly, result in lz4hc:9 was enabled, fix it.
1. mount /dev/vdb/dev/vdb on /mnt/f2fs type f2fs (...,compress_algorithm=lz4,compress_log_size=2,...)
2. mount -t f2fs -o remount,compress_log_size=3 /mnt/f2fs/
3. mount|grep f2fs/dev/vdb on /mnt/f2fs type f2fs (...,compress_algorithm=lz4:9,compress_log_size=3,...)
--- fs/f2fs/super.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/f2fs/super.c +1 -1
@@ -591,7 +591,7 @@ static int f2fs_set_lz4hc_level(struct f2fs_sb_info *sbi, const char *str)unsigned int level;if (strlen (str) ==3 ) { -F2FS_OPTION (sbi).compress_level =LZ4HC_DEFAULT_CLEVEL ; +F2FS_OPTION (sbi).compress_level =0 ;return 0 ; }
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 585/739 HID: uclogic: Correct devm device reference for hidinput input_dev name
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rahul Rameshbabu <[email protected]>
[ Upstream commit dd613a4e45f8d35f49a63a2064e5308fa5619e29 ]
Reference the HID device rather than the input device for the devm allocation of the input_dev name. Referencing the input_dev would lead to a use-after-free when the input_dev was unregistered and subsequently fires a uevent that depends on the name. At the point of firing the uevent, the name would be freed by devres management.
Use devm_kasprintf to simplify the logic for allocating memory and formatting the input_dev name string.
--- drivers/hid/hid-uclogic-core.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-)
drivers/hid/hid-uclogic-core.c +3 -10
@@ -85,10 +85,8 @@ static int uclogic_input_configured(struct hid_device *hdev, {struct uclogic_drvdata *drvdata =hid_get_drvdata (hdev);struct uclogic_params *params = &drvdata->params; -char *name;const char *suffix =NULL ;struct hid_field *field; -size_t len;size_t i;const struct uclogic_params_frame *frame;
@@ -146,14 +144,9 @@ static int uclogic_input_configured(struct hid_device *hdev, } } -if (suffix) { - len =strlen (hdev->name) +2 +strlen (suffix); - name =devm_kzalloc (&hi->input->dev, len,GFP_KERNEL ); -if (name) { -snprintf (name, len,"%s %s" , hdev->name, suffix); - hi->input->name = name; - } - } +if (suffix) + hi->input->name =devm_kasprintf (&hdev->dev,GFP_KERNEL , +"%s %s" , hdev->name, suffix);return 0 ; }
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 586/739 HID: multitouch: Correct devm device reference for hidinput input_dev name
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rahul Rameshbabu <[email protected]>
[ Upstream commit 4794394635293a3e74591351fff469cea7ad15a2 ]
Reference the HID device rather than the input device for the devm allocation of the input_dev name. Referencing the input_dev would lead to a use-after-free when the input_dev was unregistered and subsequently fires a uevent that depends on the name. At the point of firing the uevent, the name would be freed by devres management.
Use devm_kasprintf to simplify the logic for allocating memory and formatting the input_dev name string.
--- drivers/hid/hid-multitouch.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-)
drivers/hid/hid-multitouch.c +3 -10
@@ -1594,7 +1594,6 @@ static void mt_post_parse(struct mt_device *td, struct mt_application *app)static int mt_input_configured (struct hid_device *hdev,struct hid_input *hi) {struct mt_device *td =hid_get_drvdata (hdev); -char *name;const char *suffix =NULL ;struct mt_report_data *rdata;struct mt_application *mt_application =NULL ;
@@ -1645,15 +1644,9 @@ static int mt_input_configured(struct hid_device *hdev, struct hid_input *hi)break ; } -if (suffix) { - name =devm_kzalloc (&hi->input->dev, -strlen (hdev->name) +strlen (suffix) +2 , -GFP_KERNEL ); -if (name) { -sprintf (name,"%s %s" , hdev->name, suffix); - hi->input->name = name; - } - } +if (suffix) + hi->input->name =devm_kasprintf (&hdev->dev,GFP_KERNEL , +"%s %s" , hdev->name, suffix);return 0 ; }
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 587/739 HID: nvidia-shield: Reference hid_device devm allocation of input_dev name
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rahul Rameshbabu <[email protected]>
[ Upstream commit 197d3143520fec9fde89aebabc9f0d7464f08e50 ]
Use hid_device for devm allocation of the input_dev name to avoid a use-after-free. input_unregister_device would trigger devres cleanup of all resources associated with the input_dev, free-ing the name. The name would subsequently be used in a uevent fired at the end of unregistering the input_dev.
--- drivers/hid/hid-nvidia-shield.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hid/hid-nvidia-shield.c +1 -1
@@ -164,7 +164,7 @@ static struct input_dev *shield_allocate_input_dev(struct hid_device *hdev, idev->id.product = hdev->product; idev->id.version = hdev->version; idev->uniq = hdev->uniq; - idev->name =devm_kasprintf (&idev->dev,GFP_KERNEL ,"%s %s" , hdev->name, + idev->name =devm_kasprintf (&hdev->dev,GFP_KERNEL ,"%s %s" , hdev->name, name_suffix);if (!idev->name) goto err_name;
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 588/739 platform/x86/amd/pmf: Fix a missing cleanup path
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mario Limonciello <[email protected]>
[ Upstream commit 4dbd6e61adc7e52dd1c9165f0ccaa90806611e40 ]
On systems that support slider notifications but don't otherwise support granular slider the SPS cleanup path doesn't run.
This means that loading/unloading/loading leads to failures because the sysfs files don't get setup properly when reloaded.
Add the missing cleanup path.
--- drivers/platform/x86/amd/pmf/core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/platform/x86/amd/pmf/core.c +2 -1
@@ -324,7 +324,8 @@ static void amd_pmf_init_features(struct amd_pmf_dev *dev)static void amd_pmf_deinit_features (struct amd_pmf_dev *dev) { -if (is_apmf_func_supported (dev,APMF_FUNC_STATIC_SLIDER_GRANULAR )) { +if (is_apmf_func_supported (dev,APMF_FUNC_STATIC_SLIDER_GRANULAR ) || +is_apmf_func_supported (dev,APMF_FUNC_OS_POWER_SLIDER_UPDATE )) {power_supply_unreg_notifier (&dev->pwr_src_notifier);amd_pmf_deinit_sps (dev); }
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 589/739 workqueue: fix data race with the pwq->stats[] increment
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mirsad Goran Todorovac <[email protected]>
[ Upstream commit fe48ba7daefe75bbbefa2426deddc05f2d530d2d ]
KCSAN has discovered a data race in kernel/workqueue.c:2598:
[ 1863.554079] ================================================================== [ 1863.554118] BUG: KCSAN: data-race in process_one_work / process_one_work
[ 1863.554142] write to 0xffff963d99d79998 of 8 bytes by task 5394 on cpu 27: [ 1863.554154] process_one_work (kernel/workqueue.c:2598) [ 1863.554166] worker_thread (./include/linux/list.h:292 kernel/workqueue.c:2752) [ 1863.554177] kthread (kernel/kthread.c:389) [ 1863.554186] ret_from_fork (arch/x86/kernel/process.c:145) [ 1863.554197] ret_from_fork_asm (arch/x86/entry/entry_64.S:312)
[ 1863.554213] read to 0xffff963d99d79998 of 8 bytes by task 5450 on cpu 12: [ 1863.554224] process_one_work (kernel/workqueue.c:2598) [ 1863.554235] worker_thread (./include/linux/list.h:292 kernel/workqueue.c:2752) [ 1863.554247] kthread (kernel/kthread.c:389) [ 1863.554255] ret_from_fork (arch/x86/kernel/process.c:145) [ 1863.554266] ret_from_fork_asm (arch/x86/entry/entry_64.S:312)
[ 1863.554280] value changed: 0x0000000000001766 -> 0x000000000000176a
[ 1863.554295] Reported by Kernel Concurrency Sanitizer on: [ 1863.554303] CPU: 12 PID: 5450 Comm: kworker/u64:1 Tainted: G L 6.5.0-rc6+ #44 [ 1863.554314] Hardware name: ASRock X670E PG Lightning/X670E PG Lightning, BIOS 1.21 04/26/2023 [ 1863.554322] Workqueue: btrfs-endio btrfs_end_bio_work [btrfs] [ 1863.554941] ==================================================================
lockdep_invariant_state(true);
→ pwq->stats[PWQ_STAT_STARTED]++;
trace_workqueue_execute_start(work);
worker->current_func(work);Moving pwq->stats[PWQ_STAT_STARTED]++; before the line
raw_spin_unlock_irq(&pool->lock);
resolves the data race without performance penalty.
KCSAN detected at least one additional data race:
[ 157.834751] ================================================================== [ 157.834770] BUG: KCSAN: data-race in process_one_work / process_one_work
[ 157.834793] write to 0xffff9934453f77a0 of 8 bytes by task 468 on cpu 29: [ 157.834804] process_one_work (/home/marvin/linux/kernel/linux_torvalds/kernel/workqueue.c:2606) [ 157.834815] worker_thread (/home/marvin/linux/kernel/linux_torvalds/./include/linux/list.h:292 /home/marvin/linux/kernel/linux_torvalds/kernel/workqueue.c:2752) [ 157.834826] kthread (/home/marvin/linux/kernel/linux_torvalds/kernel/kthread.c:389) [ 157.834834] ret_from_fork (/home/marvin/linux/kernel/linux_torvalds/arch/x86/kernel/process.c:145) [ 157.834845] ret_from_fork_asm (/home/marvin/linux/kernel/linux_torvalds/arch/x86/entry/entry_64.S:312)
[ 157.834859] read to 0xffff9934453f77a0 of 8 bytes by task 214 on cpu 7: [ 157.834868] process_one_work (/home/marvin/linux/kernel/linux_torvalds/kernel/workqueue.c:2606) [ 157.834879] worker_thread (/home/marvin/linux/kernel/linux_torvalds/./include/linux/list.h:292 /home/marvin/linux/kernel/linux_torvalds/kernel/workqueue.c:2752) [ 157.834890] kthread (/home/marvin/linux/kernel/linux_torvalds/kernel/kthread.c:389) [ 157.834897] ret_from_fork (/home/marvin/linux/kernel/linux_torvalds/arch/x86/kernel/process.c:145) [ 157.834907] ret_from_fork_asm (/home/marvin/linux/kernel/linux_torvalds/arch/x86/entry/entry_64.S:312)
[ 157.834920] value changed: 0x000000000000052a -> 0x0000000000000532
[ 157.834933] Reported by Kernel Concurrency Sanitizer on: [ 157.834941] CPU: 7 PID: 214 Comm: kworker/u64:2 Tainted: G L 6.5.0-rc7-kcsan-00169-g81eaf55a60fc #4 [ 157.834951] Hardware name: ASRock X670E PG Lightning/X670E PG Lightning, BIOS 1.21 04/26/2023 [ 157.834958] Workqueue: btrfs-endio btrfs_end_bio_work [btrfs] [ 157.835567] ==================================================================
in code:
trace_workqueue_execute_end(work, worker->current_func);
→ pwq->stats[PWQ_STAT_COMPLETED]++;
lock_map_release(&lockdep_map);
lock_map_release(&pwq->wq->lockdep_map);which needs to be resolved separately.
--- kernel/workqueue.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/workqueue.c +1 -1
@@ -2569,6 +2569,7 @@ __acquires(&pool->lock)*/ set_work_pool_and_clear_pending (work, pool->id); + pwq->stats[PWQ_STAT_STARTED ]++;raw_spin_unlock_irq (&pool->lock);lock_map_acquire (&pwq->wq->lockdep_map);
@@ -2595,7 +2596,6 @@ __acquires(&pool->lock)* workqueues), so hiding them isn't a problem. */ lockdep_invariant_state (true); - pwq->stats[PWQ_STAT_STARTED ]++;trace_workqueue_execute_start (work); worker->current_func (work);/*
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 590/739 tick/rcu: Fix false positive "softirq work is pending" messages
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Paul Gortmaker <[email protected]>
[ Upstream commit 96c1fa04f089a7e977a44e4e8fdc92e81be20bef ]
In commit 0345691b24c0 ("tick/rcu: Stop allowing RCU_SOFTIRQ in idle") the new function report_idle_softirq() was created by breaking code out of the existing can_stop_idle_tick() for kernels v5.18 and newer.
In doing so, the code essentially went from a one conditional:
if (a && b && c) warn();
to a three conditional:
if (!a) return; if (!b) return; if (!c) return; warn();
But that conversion got the condition for the RT specific local_bh_blocked() wrong. The original condition was:
!local_bh_blocked()
but the conversion failed to negate it so it ended up as:
if (!local_bh_blocked()) return false;
This issue lay dormant until another fixup for the same commit was added in commit a7e282c77785 ("tick/rcu: Fix bogus ratelimit condition"). This commit realized the ratelimit was essentially set to zero instead of ten, and hence *no* softirq pending messages would ever be issued.
Once this commit was backported via linux-stable, both the v6.1 and v6.4 preempt-rt kernels started printing out 10 instances of this at boot:
NOHZ tick-stop error: local softirq work is pending, handler #80!!!
Remove the negation and return when local_bh_blocked() evaluates to true to bring the correct behaviour back.
--- kernel/time/tick-sched.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/time/tick-sched.c +1 -1
@@ -1045,7 +1045,7 @@ static bool report_idle_softirq(void)return false;/* On RT, softirqs handling may be waiting on some lock */ -if (!local_bh_blocked ()) +if (local_bh_blocked ())return false; pr_warn("NOHZ tick-stop error: local softirq work is pending, handler #%02x!!!\n",
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 591/739 x86/speculation: Mark all Skylake CPUs as vulnerable to GDS
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dave Hansen <[email protected]>
[ Upstream commit c9f4c45c8ec3f07f4f083f9750032a1ec3eab6b2 ]
The Gather Data Sampling (GDS) vulnerability is common to all Skylake processors. However, the "client" Skylakes* are now in this list:
https://www.intel.com/content/www/us/en/support/articles/000022396/processors.html
which means they are no longer included for new vulnerabilities here:
or in other GDS documentation. Thus, they were not included in the original GDS mitigation patches.
Mark SKYLAKE and SKYLAKE_L as vulnerable to GDS to match all the other Skylake CPUs (which include Kaby Lake). Also group the CPUs so that the ones that share the exact same vulnerabilities are next to each other.
Last, move SRBDS to the end of each line. This makes it clear at a glance that SKYLAKE_X is unique. Of the five Skylakes, it is the only "server" CPU and has a different implementation from the clients of the "special register" hardware, making it immune to SRBDS.
This makes the diff much harder to read, but the resulting table is worth it.
I very much appreciate the report from Michael Zhivich about this issue. Despite what level of support a hardware vendor is providing, the kernel very much needs an accurate and up-to-date list of vulnerable CPUs. More reports like this are very welcome.
* Client Skylakes are CPUID 406E3/506E3 which is family 6, models 0x4E and 0x5E, aka INTEL_FAM6_SKYLAKE and INTEL_FAM6_SKYLAKE_L.
--- arch/x86/kernel/cpu/common.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
arch/x86/kernel/cpu/common.c +4 -4
@@ -1265,11 +1265,11 @@ static const struct x86_cpu_id cpu_vuln_blacklist[] __initconst = {VULNBL_INTEL_STEPPINGS (BROADWELL_G ,X86_STEPPING_ANY ,SRBDS ),VULNBL_INTEL_STEPPINGS (BROADWELL_X ,X86_STEPPING_ANY ,MMIO ),VULNBL_INTEL_STEPPINGS (BROADWELL ,X86_STEPPING_ANY ,SRBDS ), -VULNBL_INTEL_STEPPINGS (SKYLAKE_L ,X86_STEPPING_ANY ,SRBDS |MMIO |RETBLEED ),VULNBL_INTEL_STEPPINGS (SKYLAKE_X ,X86_STEPPING_ANY ,MMIO |RETBLEED |GDS ), -VULNBL_INTEL_STEPPINGS (SKYLAKE ,X86_STEPPING_ANY ,SRBDS |MMIO |RETBLEED ), -VULNBL_INTEL_STEPPINGS (KABYLAKE_L ,X86_STEPPING_ANY ,SRBDS |MMIO |RETBLEED |GDS ), -VULNBL_INTEL_STEPPINGS (KABYLAKE ,X86_STEPPING_ANY ,SRBDS |MMIO |RETBLEED |GDS ), +VULNBL_INTEL_STEPPINGS (SKYLAKE_L ,X86_STEPPING_ANY ,MMIO |RETBLEED |GDS |SRBDS ), +VULNBL_INTEL_STEPPINGS (SKYLAKE ,X86_STEPPING_ANY ,MMIO |RETBLEED |GDS |SRBDS ), +VULNBL_INTEL_STEPPINGS (KABYLAKE_L ,X86_STEPPING_ANY ,MMIO |RETBLEED |GDS |SRBDS ), +VULNBL_INTEL_STEPPINGS (KABYLAKE ,X86_STEPPING_ANY ,MMIO |RETBLEED |GDS |SRBDS ),VULNBL_INTEL_STEPPINGS (CANNONLAKE_L ,X86_STEPPING_ANY ,RETBLEED ),VULNBL_INTEL_STEPPINGS (ICELAKE_L ,X86_STEPPING_ANY ,MMIO |MMIO_SBDS |RETBLEED |GDS ), VULNBL_INTEL_STEPPINGS(ICELAKE_D, X86_STEPPING_ANY, MMIO | GDS),
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 592/739 tracing: Remove extra space at the end of hwlat_detector/mode
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mikhail Kobuk <[email protected]>
[ Upstream commit 2cf0dee989a8b2501929eaab29473b6b1fa11057 ]
Space is printed after each mode value including the last one:
$ echo \"$(sudo cat /sys/kernel/tracing/hwlat_detector/mode)\" "none [round-robin] per-cpu "
Found by Linux Verification Center (linuxtesting.org) with SVACE.
--- kernel/trace/trace_hwlat.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/trace/trace_hwlat.c +1 -1
@@ -635,7 +635,7 @@ static int s_mode_show(struct seq_file *s, void *v)else seq_printf (s,"%s" , thread_mode_str[mode]); -if (mode !=MODE_MAX ) +if (mode <MODE_MAX -1 )/* if mode is any but last */ seq_puts (s," " );return 0 ;
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 593/739 tracing: Fix race issue between cpu buffer write and swap
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zheng Yejian <[email protected]>
[ Upstream commit 3163f635b20e9e1fb4659e74f47918c9dddfe64e ]
Warning happened in rb_end_commit() at code:
if (RB_WARN_ON(cpu_buffer, !local_read(&cpu_buffer->committing)))
WARNING: CPU: 0 PID: 139 at kernel/trace/ring_buffer.c:3142 rb_commit+0x402/0x4a0 Call Trace: ring_buffer_unlock_commit+0x42/0x250 trace_buffer_unlock_commit_regs+0x3b/0x250 trace_event_buffer_commit+0xe5/0x440 trace_event_buffer_reserve+0x11c/0x150 trace_event_raw_event_sched_switch+0x23c/0x2c0 __traceiter_sched_switch+0x59/0x80 __schedule+0x72b/0x1580 schedule+0x92/0x120 worker_thread+0xa0/0x6f0
It is because the race between writing event into cpu buffer and swapping cpu buffer through file per_cpu/cpu0/snapshot:
Write on CPU 0 Swap buffer by per_cpu/cpu0/snapshot on CPU 1
-------- --------
tracing_snapshot_write()
[...] ring_buffer_lock_reserve()
cpu_buffer = buffer->buffers[cpu]; // 1. Suppose find 'cpu_buffer_a';
[...]
rb_reserve_next_event()
[...] ring_buffer_swap_cpu()
if (local_read(&cpu_buffer_a->committing))
goto out_dec;
if (local_read(&cpu_buffer_b->committing))
goto out_dec;
buffer_a->buffers[cpu] = cpu_buffer_b;
buffer_b->buffers[cpu] = cpu_buffer_a;
// 2. cpu_buffer has swapped here.
rb_start_commit(cpu_buffer);
if (unlikely(READ_ONCE(cpu_buffer->buffer)
!= buffer)) { // 3. This check passed due to 'cpu_buffer->buffer'
[...] // has not changed here.
return NULL;
}
cpu_buffer_b->buffer = buffer_a;
cpu_buffer_a->buffer = buffer_b;
[...]
// 4. Reserve event from 'cpu_buffer_a'. ring_buffer_unlock_commit()
[...]
cpu_buffer = buffer->buffers[cpu]; // 5. Now find 'cpu_buffer_b' !!!
rb_commit(cpu_buffer)
rb_end_commit() // 6. WARN for the wrong 'committing' state !!!Based on above analysis, we can easily reproduce by following testcase:
``` bash
#!/bin/bash
dmesg -n 7
sysctl -w kernel.panic_on_warn=1
TR=/sys/kernel/tracing
echo 7 > ${TR}/buffer_size_kb
echo "sched:sched_switch" > ${TR}/set_event
while [ true ]; do
echo 1 > ${TR}/per_cpu/cpu0/snapshot
done &
while [ true ]; do
echo 1 > ${TR}/per_cpu/cpu0/snapshot
done &
while [ true ]; do
echo 1 > ${TR}/per_cpu/cpu0/snapshot
done &
```To fix it, IIUC, we can use smp_call_function_single() to do the swap on the target cpu where the buffer is located, so that above race would be avoided.
--- kernel/trace/trace.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-)
kernel/trace/trace.c +12 -5
@@ -7618,6 +7618,11 @@ static int tracing_snapshot_open(struct inode *inode, struct file *file)return ret; } +static void tracing_swap_cpu_buffer (void *tr) +{ +update_max_tr_single ((struct trace_array *)tr, current,smp_processor_id ()); +} +static ssize_t tracing_snapshot_write (struct file *filp,const char __user *ubuf,size_t cnt,loff_t *ppos)
@@ -7676,13 +7681,15 @@ tracing_snapshot_write(struct file *filp, const char __user *ubuf, size_t cnt, ret =tracing_alloc_snapshot_instance (tr);if (ret <0 )break ; -local_irq_disable ();/* Now, we're going to swap */ -if (iter->cpu_file ==RING_BUFFER_ALL_CPUS ) +if (iter->cpu_file ==RING_BUFFER_ALL_CPUS ) { +local_irq_disable ();update_max_tr (tr, current,smp_processor_id (),NULL ); -else -update_max_tr_single (tr, current, iter->cpu_file); -local_irq_enable (); +local_irq_enable (); + }else { +smp_call_function_single (iter->cpu_file, tracing_swap_cpu_buffer, + (void *)tr,1 ); + }break ;default :if (tr->allocated_snapshot) {
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 594/739 mm/pagewalk: fix bootstopping regression from extra pte_unmap()
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hugh Dickins <[email protected]>
[ Upstream commit ee40d543e97d23d3392d8fb1ec9972eb4e9c7611 ]
Mikhail reports early-6.6-based Fedora Rawhide not booting: "rcu_preempt detected expedited stalls", minutes wait, and then hung_task splat while kworker trying to synchronize_rcu_expedited(). Nothing logged to disk.
He bisected to my 6.6 a349d72fd9ef ("mm/pgtable: add rcu_read_lock() and rcu_read_unlock()s"): but the one to blame is my 6.5 commit to fix the espfix "bad pmd" warnings when booting x86_64 with CONFIG_EFI_PGT_DUMP=y.
Gaah, that added an "addr >= TASK_SIZE" check to avoid pte_offset_map(), but failed to add the equivalent check when choosing to pte_unmap().
It's not a problem on 6.5 (for different reasons, it's harmless on both 64-bit and 32-bit), but becomes a bootstopper on 6.6 with the unbalanced rcu_read_unlock() - RCU has a WARN_ON_ONCE for that, but it would have scrolled off Mikhail's console too quickly.
--- mm/pagewalk.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
mm/pagewalk.c +1 -1
@@ -58,7 +58,7 @@ static int walk_pte_range(pmd_t *pmd, unsigned long addr, unsigned long end, pte =pte_offset_map (pmd, addr);if (pte) { err =walk_pte_range_inner (pte, addr, end, walk); -if (walk->mm != &init_mm) +if (walk->mm != &init_mm && addr <TASK_SIZE )pte_unmap (pte); } }else {
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 595/739 mtd: rawnand: brcmnand: Fix mtd oobsize
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: William Zhang <[email protected]>
[ Upstream commit 60177390fa061c62d156f4a546e3efd90df3c183 ]
brcmnand controller can only access the flash spare area up to certain bytes based on the ECC level. It can be less than the actual flash spare area size. For example, for many NAND chip supporting ECC BCH-8, it has 226 bytes spare area. But controller can only uses 218 bytes. So brcmand driver overrides the mtd oobsize with the controller's accessible spare area size. When the nand base driver utilizes the nand_device object, it resets the oobsize back to the actual flash spare aprea size from nand_memory_organization structure and controller may not able to access all the oob area as mtd advises.
This change fixes the issue by overriding the oobsize in the nand_memory_organization structure to the controller's accessible spare area size.
--- drivers/mtd/nand/raw/brcmnand/brcmnand.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/mtd/nand/raw/brcmnand/brcmnand.c +5 -2
@@ -2612,6 +2612,8 @@ static int brcmnand_setup_dev(struct brcmnand_host *host)struct nand_chip *chip = &host->chip;const struct nand_ecc_props *requirements =nanddev_get_ecc_requirements (&chip->base); +struct nand_memory_organization *memorg = +nanddev_get_memorg (&chip->base);struct brcmnand_controller *ctrl = host->ctrl;struct brcmnand_cfg *cfg = &host->hwcfg;char msg[128 ];
@@ -2633,10 +2635,11 @@ static int brcmnand_setup_dev(struct brcmnand_host *host)if (cfg->spare_area_size > ctrl->max_oob) cfg->spare_area_size = ctrl->max_oob;/* -* Set oobsize to be consistent with controller's spare_area_size, as -* the rest is inaccessible. +* Set mtd and memorg oobsize to be consistent with controller's +* spare_area_size, as the rest is inaccessible. */ mtd->oobsize = cfg->spare_area_size * (mtd->writesize >>FC_SHIFT ); + memorg->oobsize = mtd->oobsize; cfg->device_size = mtd->size; cfg->block_size = mtd->erasesize;
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 596/739 dmaengine: idxd: Modify the dependence of attribute pasid_enabled
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rex Zhang <[email protected]>
[ Upstream commit 50c5e6f41d5ad7c731c31135a30d0e4f0e4fea26 ]
Kernel PASID and user PASID are separately enabled. User needs to know the user PASID enabling status to decide how to use IDXD device in user space. This is done via the attribute /sys/bus/dsa/devices/dsa0/pasid_enabled. It's unnecessary for user to know the kernel PASID enabling status because user won't use the kernel PASID. But instead of showing the user PASID enabling status, the attribute shows the kernel PASID enabling status. Fix the issue by showing the user PASID enabling status in the attribute.
--- drivers/dma/idxd/sysfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/dma/idxd/sysfs.c +1 -1
@@ -1480,7 +1480,7 @@ static ssize_t pasid_enabled_show(struct device *dev, {struct idxd_device *idxd =confdev_to_idxd (dev); -return sysfs_emit (buf,"%u\n" ,device_pasid_enabled (idxd)); +return sysfs_emit (buf,"%u\n" ,device_user_pasid_enabled (idxd)); }static DEVICE_ATTR_RO (pasid_enabled);
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 597/739 phy/rockchip: inno-hdmi: use correct vco_div_5 macro on rk3328
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jonas Karlman <[email protected]>
[ Upstream commit 644c06dfbd0da713f772abf0a8f8581ac78e6264 ]
inno_hdmi_phy_rk3328_clk_set_rate() is using the RK3228 macro when configuring vco_div_5 on RK3328.
Fix this by using correct vco_div_5 macro for RK3328.
--- drivers/phy/rockchip/phy-rockchip-inno-hdmi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/phy/rockchip/phy-rockchip-inno-hdmi.c +2 -2
@@ -790,8 +790,8 @@ static int inno_hdmi_phy_rk3328_clk_set_rate(struct clk_hw *hw, RK3328_PRE_PLL_POWER_DOWN);/* Configure pre-pll */ -inno_update_bits (inno,0xa0 ,RK3228_PCLK_VCO_DIV_5_MASK , -RK3228_PCLK_VCO_DIV_5 (cfg->vco_div_5_en)); +inno_update_bits (inno,0xa0 ,RK3328_PCLK_VCO_DIV_5_MASK , +RK3328_PCLK_VCO_DIV_5 (cfg->vco_div_5_en));inno_write (inno,0xa1 ,RK3328_PRE_PLL_PRE_DIV (cfg->prediv)); val =RK3328_SPREAD_SPECTRUM_MOD_DISABLE ;
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 598/739 phy/rockchip: inno-hdmi: round fractal pixclock in rk3328 recalc_rate
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zheng Yang <[email protected]>
[ Upstream commit d5ef343c1d62bc4c4c2c393af654a41cb34b449f ]
inno_hdmi_phy_rk3328_clk_recalc_rate() is returning a rate not found in the pre pll config table when the fractal divider is used. This can prevent proper power_on because a tmdsclock for the new rate is not found in the pre pll config table.
Fix this by saving and returning a rounded pixel rate that exist in the pre pll config table.
--- drivers/phy/rockchip/phy-rockchip-inno-hdmi.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/phy/rockchip/phy-rockchip-inno-hdmi.c +5 -3
@@ -745,10 +745,12 @@ unsigned long inno_hdmi_phy_rk3328_clk_recalc_rate(struct clk_hw *hw,do_div (vco, (nd * (no_a ==1 ? no_b : no_a) * no_d *2 )); } - inno->pixclock = vco; -dev_dbg (inno->dev,"%s rate %lu\n" , __func__, inno->pixclock); + inno->pixclock =DIV_ROUND_CLOSEST ((unsigned long )vco,1000 ) *1000 ; -return vco; +dev_dbg (inno->dev,"%s rate %lu vco %llu\n" , + __func__, inno->pixclock, vco); + +return inno->pixclock; } static long inno_hdmi_phy_rk3328_clk_round_rate(struct clk_hw *hw,
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 599/739 phy/rockchip: inno-hdmi: do not power on rk3328 post pll on reg write
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jonas Karlman <[email protected]>
[ Upstream commit 19a1d46bd699940a496d3b0d4e142ef99834988c ]
inno_write is used to configure 0xaa reg, that also hold the POST_PLL_POWER_DOWN bit.
When POST_PLL_REFCLK_SEL_TMDS is configured the power down bit is not taken into consideration.
Fix this by keeping the power down bit until configuration is complete. Also reorder the reg write order for consistency.
--- drivers/phy/rockchip/phy-rockchip-inno-hdmi.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/phy/rockchip/phy-rockchip-inno-hdmi.c +4 -2
@@ -1023,9 +1023,10 @@ inno_hdmi_phy_rk3328_power_on(struct inno_hdmi_phy *inno,inno_write (inno,0xac ,RK3328_POST_PLL_FB_DIV_7_0 (cfg->fbdiv));if (cfg->postdiv ==1 ) { -inno_write (inno,0xaa ,RK3328_POST_PLL_REFCLK_SEL_TMDS );inno_write (inno,0xab ,RK3328_POST_PLL_FB_DIV_8 (cfg->fbdiv) |RK3328_POST_PLL_PRE_DIV (cfg->prediv)); +inno_write (inno,0xaa ,RK3328_POST_PLL_REFCLK_SEL_TMDS | +RK3328_POST_PLL_POWER_DOWN ); }else { v = (cfg->postdiv /2 ) -1 ; v &=RK3328_POST_PLL_POST_DIV_MASK ;
@@ -1033,7 +1034,8 @@ inno_hdmi_phy_rk3328_power_on(struct inno_hdmi_phy *inno,inno_write (inno,0xab ,RK3328_POST_PLL_FB_DIV_8 (cfg->fbdiv) |RK3328_POST_PLL_PRE_DIV (cfg->prediv));inno_write (inno,0xaa ,RK3328_POST_PLL_POST_DIV_ENABLE | -RK3328_POST_PLL_REFCLK_SEL_TMDS ); +RK3328_POST_PLL_REFCLK_SEL_TMDS | +RK3328_POST_PLL_POWER_DOWN ); }for (v =0 ; v <14 ; v++)
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 600/739 rpmsg: glink: Add check for kstrdup
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiasheng Jiang <[email protected]>
[ Upstream commit b5c9ee8296a3760760c7b5d2e305f91412adc795 ]
Add check for the return value of kstrdup() and return the error if it fails in order to avoid NULL pointer dereference.
--- drivers/rpmsg/qcom_glink_native.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/rpmsg/qcom_glink_native.c +4 -0
@@ -221,6 +221,10 @@ static struct glink_channel *qcom_glink_alloc_channel(struct qcom_glink *glink, channel->glink = glink; channel->name =kstrdup (name,GFP_KERNEL ); +if (!channel->name) { +kfree (channel); +return ERR_PTR (-ENOMEM ); + }init_completion (&channel->open_req);init_completion (&channel->open_ack);
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 601/739 leds: aw200xx: Fix error code in probe()
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
[ Upstream commit ad5152b85e8bc7dacb1e6e237553fbe779c938e0 ]
The "ret" variable is zero/success here. Don't return that, return -EINVAL instead.
--- drivers/leds/leds-aw200xx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/leds/leds-aw200xx.c +1 -1
@@ -368,7 +368,7 @@ static int aw200xx_probe_fw(struct device *dev, struct aw200xx *chip)if (!chip->display_rows || chip->display_rows > chip->cdef->display_size_rows_max) { -return dev_err_probe (dev, ret, +return dev_err_probe (dev, -EINVAL ,"Invalid leds display size %u\n" , chip->display_rows); }
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 602/739 leds: simatic-ipc-leds-gpio: Restore LEDS_CLASS dependency
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arnd Bergmann <[email protected]>
[ Upstream commit 66c5e98bbf7b7b2ba0a095ef25bf55c7230e846e ]
A recent rework accidentally lost the dependency on LEDS_CLASS, which leads to a link error when LED support is disbled:
x86_64-linux-ld: drivers/leds/simple/simatic-ipc-leds.o: in function `simatic_ipc_leds_probe':
simatic-ipc-leds.c:(.text+0x10c): undefined reference to `devm_led_classdev_register_ext'
Add back the dependency that was there originally.
--- drivers/leds/simple/Kconfig | 1 + 1 file changed, 1 insertion(+)
drivers/leds/simple/Kconfig +1 -0
@@ -1,6 +1,7 @@ # SPDX-License-Identifier: GPL-2.0-only config LEDS_SIEMENS_SIMATIC_IPC tristate "LED driver for Siemens Simatic IPCs" + depends on LEDS_CLASS depends on SIEMENS_SIMATIC_IPC help This option enables support for the LEDs of several Industrial PCs
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 603/739 leds: pwm: Fix error code in led_pwm_create_fwnode()
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
[ Upstream commit cadb2de2a7fd9e955381307de3eddfcc386c208e ]
Negative -EINVAL was intended, not positive EINVAL. Fix it.
--- drivers/leds/leds-pwm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/leds/leds-pwm.c +1 -1
@@ -146,7 +146,7 @@ static int led_pwm_create_fwnode(struct device *dev, struct led_pwm_priv *priv) led.name =to_of_node (fwnode)->name;if (!led.name) { - ret =EINVAL ; + ret = -EINVAL ; goto err_child_out; }
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 604/739 thermal/drivers/mediatek/lvts_thermal: Handle IRQ on all controllers
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nícolas F. R. A. Prado <[email protected]>
[ Upstream commit cbd8c5aae2a988bafd4586bea710eeddc30a82ce ]
There is a single IRQ handler for each LVTS thermal domain, and it is supposed to check each of its underlying controllers for the origin of the interrupt and clear its status. However due to a typo, only the first controller was ever being handled, which resulted in the interrupt never being cleared when it happened on the other controllers. Add the missing index so interrupts are handled for all controllers.
--- drivers/thermal/mediatek/lvts_thermal.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/thermal/mediatek/lvts_thermal.c +1 -1
@@ -451,7 +451,7 @@ static irqreturn_t lvts_irq_handler(int irq, void *data)for (i =0 ; i < lvts_td->num_lvts_ctrl; i++) { - aux =lvts_ctrl_irq_handler (lvts_td->lvts_ctrl); + aux =lvts_ctrl_irq_handler (&lvts_td->lvts_ctrl[i]);if (aux !=IRQ_HANDLED )continue ;
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 605/739 thermal/drivers/mediatek/lvts_thermal: Honor sensors in immediate mode
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nícolas F. R. A. Prado <[email protected]>
[ Upstream commit 64de162e34e4cb2982a1d96e492f018026a61c1d ]
Each controller can be configured to operate on immediate or filtered mode. On filtered mode, the sensors are enabled by setting the corresponding bits in MONCTL0, while on immediate mode, by setting MSRCTL1.
Previously, the code would set MSRCTL1 for all four sensors when configured to immediate mode, but given that the controller might not have all four sensors connected, this would cause interrupts to trigger for non-existent sensors. Fix this by handling the MSRCTL1 register analogously to the MONCTL0: only enable the sensors that were declared.
--- drivers/thermal/mediatek/lvts_thermal.c | 57 ++++++++++++++----------- 1 file changed, 33 insertions(+), 24 deletions(-)
drivers/thermal/mediatek/lvts_thermal.c +33 -24
@@ -896,24 +896,6 @@ static int lvts_ctrl_configure(struct device *dev, struct lvts_ctrl *lvts_ctrl)LVTS_HW_FILTER <<3 |LVTS_HW_FILTER ;writel (value,LVTS_MSRCTL0 (lvts_ctrl->base)); -/* -* LVTS_MSRCTL1 : Measurement control -* -* Bits: -* -* 9: Ignore MSRCTL0 config and do immediate measurement on sensor3 -* 6: Ignore MSRCTL0 config and do immediate measurement on sensor2 -* 5: Ignore MSRCTL0 config and do immediate measurement on sensor1 -* 4: Ignore MSRCTL0 config and do immediate measurement on sensor0 -* -* That configuration will ignore the filtering and the delays -* introduced below in MONCTL1 and MONCTL2 -*/ -if (lvts_ctrl->mode ==LVTS_MSR_IMMEDIATE_MODE ) { - value =BIT (9 ) |BIT (6 ) |BIT (5 ) |BIT (4 ); -writel (value,LVTS_MSRCTL1 (lvts_ctrl->base)); - } -/* * LVTS_MONCTL1 : Period unit and group interval configuration *
@@ -979,6 +961,15 @@ static int lvts_ctrl_start(struct device *dev, struct lvts_ctrl *lvts_ctrl)struct thermal_zone_device *tz;u32 sensor_map =0 ;int i; +/* +* Bitmaps to enable each sensor on immediate and filtered modes, as +* described in MSRCTL1 and MONCTL0 registers below, respectively. +*/ +u32 sensor_imm_bitmap[] = {BIT (4 ),BIT (5 ),BIT (6 ),BIT (9 ) }; +u32 sensor_filt_bitmap[] = {BIT (0 ),BIT (1 ),BIT (2 ),BIT (3 ) }; + +u32 *sensor_bitmap = lvts_ctrl->mode ==LVTS_MSR_IMMEDIATE_MODE ? + sensor_imm_bitmap : sensor_filt_bitmap;for (i =0 ; i < lvts_ctrl->num_lvts_sensor; i++) {
@@ -1016,20 +1007,38 @@ static int lvts_ctrl_start(struct device *dev, struct lvts_ctrl *lvts_ctrl)* map, so we can enable the temperature monitoring in * the hardware thermal controller. */ - sensor_map |=BIT (i); + sensor_map |= sensor_bitmap[i]; }/* -* Bits: -* 9: Single point access flow -* 0-3: Enable sensing point 0-3 -* * The initialization of the thermal zones give us * which sensor point to enable. If any thermal zone * was not described in the device tree, it won't be * enabled here in the sensor map. */ -writel (sensor_map |BIT (9 ),LVTS_MONCTL0 (lvts_ctrl->base)); +if (lvts_ctrl->mode ==LVTS_MSR_IMMEDIATE_MODE ) { +/* +* LVTS_MSRCTL1 : Measurement control +* +* Bits: +* +* 9: Ignore MSRCTL0 config and do immediate measurement on sensor3 +* 6: Ignore MSRCTL0 config and do immediate measurement on sensor2 +* 5: Ignore MSRCTL0 config and do immediate measurement on sensor1 +* 4: Ignore MSRCTL0 config and do immediate measurement on sensor0 +* +* That configuration will ignore the filtering and the delays +* introduced in MONCTL1 and MONCTL2 +*/ +writel (sensor_map,LVTS_MSRCTL1 (lvts_ctrl->base)); + }else { +/* +* Bits: +* 9: Single point access flow +* 0-3: Enable sensing point 0-3 +*/ +writel (sensor_map |BIT (9 ),LVTS_MONCTL0 (lvts_ctrl->base)); + }return 0 ; }
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 606/739 thermal/drivers/mediatek/lvts_thermal: Use offset threshold for IRQ
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nícolas F. R. A. Prado <[email protected]>
[ Upstream commit f79e996c7ed27bb196facbcd1c69ee33631d7051 ]
There are two kinds of temperature monitoring interrupts available:
* High Offset, Low Offset
* Hot, Hot to normal, Cold
The code currently uses the hot/h2n/cold interrupts, however in a way that doesn't work: the cold threshold is left uninitialized, which prevents the other thresholds from ever triggering, and the h2n interrupt is used as the lower threshold, which prevents the hot interrupt from triggering again after the thresholds are updated by the thermal framework, since a hot interrupt can only trigger again after the hot to normal interrupt has been triggered.
But better yet than addressing those issues, is to use the high/low offset interrupts instead. This way only two thresholds need to be managed, which have a simpler state machine, making them a better match to the thermal framework's high and low thresholds.
--- drivers/thermal/mediatek/lvts_thermal.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/thermal/mediatek/lvts_thermal.c +6 -6
@@ -298,9 +298,9 @@ static int lvts_set_trips(struct thermal_zone_device *tz, int low, int high)u32 raw_high =lvts_temp_to_raw (high);/* -* Hot to normal temperature threshold +* Low offset temperature threshold * -* LVTS_H2NTHRE +* LVTS_OFFSETL * * Bits: *
@@ -309,13 +309,13 @@ static int lvts_set_trips(struct thermal_zone_device *tz, int low, int high)if (low != -INT_MAX ) {pr_debug ("%s: Setting low limit temperature interrupt: %d\n" ,thermal_zone_device_type (tz), low); -writel (raw_low,LVTS_H2NTHRE (base)); +writel (raw_low,LVTS_OFFSETL (base)); }/* -* Hot temperature threshold +* High offset temperature threshold * -* LVTS_HTHRE +* LVTS_OFFSETH * * Bits: *
@@ -323,7 +323,7 @@ static int lvts_set_trips(struct thermal_zone_device *tz, int low, int high)*/ pr_debug ("%s: Setting high limit temperature interrupt: %d\n" ,thermal_zone_device_type (tz), high); -writel (raw_high,LVTS_HTHRE (base)); +writel (raw_high,LVTS_OFFSETH (base));return 0 ; }
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 607/739 thermal/drivers/mediatek/lvts_thermal: Disable undesired interrupts
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nícolas F. R. A. Prado <[email protected]>
[ Upstream commit 487bf099e85b724c824f5fafaf93c6749c4d2120 ]
Out of the many interrupts supported by the hardware, the only ones of interest to the driver currently are:
* The temperature went over the high offset threshold, for any of the sensors
* The temperature went below the low offset threshold, for any of the sensors
* The temperature went over the stage3 threshold
These are the only thresholds configured by the driver through the OFFSETH, OFFSETL, and PROTTC registers, respectively.
The current interrupt mask in LVTS_MONINT_CONF, enables many more interrupts, including data ready on sensors for both filtered and immediate mode. These are not only not handled by the driver, but they are also triggered too often, causing unneeded overhead. Disable these unnecessary interrupts.
The meaning of each bit can be seen in the comment describing LVTS_MONINTST in the IRQ handler.
--- drivers/thermal/mediatek/lvts_thermal.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/thermal/mediatek/lvts_thermal.c +1 -1
@@ -65,7 +65,7 @@#define LVTS_HW_FILTER 0x2#define LVTS_TSSEL_CONF 0x13121110#define LVTS_CALSCALE_CONF 0x300 -#define LVTS_MONINT_CONF 0x9FBF7BDE +#define LVTS_MONINT_CONF 0x8300318C#define LVTS_INT_SENSOR0 0x0009001F#define LVTS_INT_SENSOR1 0x001203E0
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 608/739 thermal/drivers/mediatek/lvts_thermal: Dont leave threshold zeroed
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nícolas F. R. A. Prado <[email protected]>
[ Upstream commit 77354eaef8218bc40d6b37e783b0b8dcca22a7d9 ]
The thermal framework might leave the low threshold unset if there aren't any lower trip points. This leaves the register zeroed, which translates to a very high temperature for the low threshold. The interrupt for this threshold is then immediately triggered, and the state machine gets stuck, preventing any other temperature monitoring interrupts to ever trigger.
(The same happens by not setting the Cold or Hot to Normal thresholds when using those)
Set the unused threshold to a valid low value. This value was chosen so that for any valid golden temperature read from the efuse, when the value is converted to raw and back again to milliCelsius, the result doesn't underflow.
--- drivers/thermal/mediatek/lvts_thermal.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/thermal/mediatek/lvts_thermal.c +6 -6
@@ -83,6 +83,8 @@#define LVTS_HW_SHUTDOWN_MT8195 105000 +#define LVTS_MINIMUM_THRESHOLD 20000 +static int golden_temp =LVTS_GOLDEN_TEMP_DEFAULT ;static int coeff_b =LVTS_COEFF_B ;
@@ -294,7 +296,7 @@ static int lvts_set_trips(struct thermal_zone_device *tz, int low, int high) {struct lvts_sensor *lvts_sensor =thermal_zone_device_priv (tz);void __iomem *base = lvts_sensor->base; -u32 raw_low =lvts_temp_to_raw (low); +u32 raw_low =lvts_temp_to_raw (low != -INT_MAX ? low :LVTS_MINIMUM_THRESHOLD );u32 raw_high =lvts_temp_to_raw (high);/*
@@ -306,11 +308,9 @@ static int lvts_set_trips(struct thermal_zone_device *tz, int low, int high)* * 14-0 : Raw temperature for threshold */ -if (low != -INT_MAX ) { -pr_debug ("%s: Setting low limit temperature interrupt: %d\n" , -thermal_zone_device_type (tz), low); -writel (raw_low,LVTS_OFFSETL (base)); - } +pr_debug ("%s: Setting low limit temperature interrupt: %d\n" , +thermal_zone_device_type (tz), low); +writel (raw_low,LVTS_OFFSETL (base));/* * High offset temperature threshold
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 609/739 thermal/drivers/mediatek/lvts_thermal: Manage threshold between sensors
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nícolas F. R. A. Prado <[email protected]>
[ Upstream commit 2bba1acf7a4cbe62abbb4c686e0414209ec5943b ]
Each LVTS thermal controller can have up to four sensors, each capable of triggering its own interrupt when its measured temperature crosses the configured threshold. The threshold for each sensor is handled separately by the thermal framework, since each one is registered with its own thermal zone and trips. However, the temperature thresholds are configured on the controller, and therefore are shared between all sensors on that controller.
When the temperature measured by the sensors is different enough to cause the thermal framework to configure different thresholds for each one, interrupts start triggering on sensors outside the last threshold configured.
To address the issue, track the thresholds required by each sensor and only actually set the highest one in the hardware, and disable interrupts for all sensors outside the current configured range.
--- drivers/thermal/mediatek/lvts_thermal.c | 69 +++++++++++++++++++++++++ 1 file changed, 69 insertions(+)
drivers/thermal/mediatek/lvts_thermal.c +69 -0
@@ -67,6 +67,11 @@#define LVTS_CALSCALE_CONF 0x300#define LVTS_MONINT_CONF 0x8300318C +#define LVTS_MONINT_OFFSET_SENSOR0 0xC +#define LVTS_MONINT_OFFSET_SENSOR1 0x180 +#define LVTS_MONINT_OFFSET_SENSOR2 0x3000 +#define LVTS_MONINT_OFFSET_SENSOR3 0x3000000 +#define LVTS_INT_SENSOR0 0x0009001F#define LVTS_INT_SENSOR1 0x001203E0#define LVTS_INT_SENSOR2 0x00247C00
@@ -112,6 +117,8 @@ struct lvts_sensor {void __iomem *base;int id;int dt_id; +int low_thresh; +int high_thresh; };struct lvts_ctrl {
@@ -121,6 +128,8 @@ struct lvts_ctrl {int num_lvts_sensor;int mode;void __iomem *base; +int low_thresh; +int high_thresh; };struct lvts_domain {
@@ -292,12 +301,66 @@ static int lvts_get_temp(struct thermal_zone_device *tz, int *temp)return 0 ; } +static void lvts_update_irq_mask (struct lvts_ctrl *lvts_ctrl) +{ +u32 masks[] = { +LVTS_MONINT_OFFSET_SENSOR0 , +LVTS_MONINT_OFFSET_SENSOR1 , +LVTS_MONINT_OFFSET_SENSOR2 , +LVTS_MONINT_OFFSET_SENSOR3 , + }; +u32 value =0 ; +int i; + + value =readl (LVTS_MONINT (lvts_ctrl->base)); + +for (i =0 ; i <ARRAY_SIZE (masks); i++) { +if (lvts_ctrl->sensors[i].high_thresh == lvts_ctrl->high_thresh + && lvts_ctrl->sensors[i].low_thresh == lvts_ctrl->low_thresh) + value |= masks[i]; +else + value &= ~masks[i]; + } + +writel (value,LVTS_MONINT (lvts_ctrl->base)); +} + +static bool lvts_should_update_thresh (struct lvts_ctrl *lvts_ctrl,int high) +{ +int i; + +if (high > lvts_ctrl->high_thresh) +return true; + +for (i =0 ; i < lvts_ctrl->num_lvts_sensor; i++) +if (lvts_ctrl->sensors[i].high_thresh == lvts_ctrl->high_thresh + && lvts_ctrl->sensors[i].low_thresh == lvts_ctrl->low_thresh) +return false; + +return true; +} +static int lvts_set_trips (struct thermal_zone_device *tz,int low,int high) {struct lvts_sensor *lvts_sensor =thermal_zone_device_priv (tz); + struct lvts_ctrl *lvts_ctrl = container_of(lvts_sensor, struct lvts_ctrl, sensors[lvts_sensor->id]);void __iomem *base = lvts_sensor->base;u32 raw_low =lvts_temp_to_raw (low != -INT_MAX ? low :LVTS_MINIMUM_THRESHOLD );u32 raw_high =lvts_temp_to_raw (high); +bool should_update_thresh; + + lvts_sensor->low_thresh = low; + lvts_sensor->high_thresh = high; + + should_update_thresh =lvts_should_update_thresh (lvts_ctrl, high); +if (should_update_thresh) { + lvts_ctrl->high_thresh = high; + lvts_ctrl->low_thresh = low; + } +lvts_update_irq_mask (lvts_ctrl); + +if (!should_update_thresh) +return 0 ;/* * Low offset temperature threshold
@@ -521,6 +584,9 @@ static int lvts_sensor_init(struct device *dev, struct lvts_ctrl *lvts_ctrl,*/ lvts_sensor[i].msr = lvts_ctrl_data->mode ==LVTS_MSR_IMMEDIATE_MODE ? imm_regs[i] : msr_regs[i]; + + lvts_sensor[i].low_thresh =INT_MIN ; + lvts_sensor[i].high_thresh =INT_MIN ; }; lvts_ctrl->num_lvts_sensor = lvts_ctrl_data->num_lvts_sensor;
@@ -688,6 +754,9 @@ static int lvts_ctrl_init(struct device *dev, struct lvts_domain *lvts_td,*/ lvts_ctrl[i].hw_tshut_raw_temp =lvts_temp_to_raw (lvts_data->lvts_ctrl[i].hw_tshut_temp); + + lvts_ctrl[i].low_thresh =INT_MIN ; + lvts_ctrl[i].high_thresh =INT_MIN ; }/*
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 610/739 thermal/drivers/imx8mm: Suppress log message on probe deferral
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ahmad Fatoum <[email protected]>
[ Upstream commit 4afcb58ea47e66c025d2b0a5f091dce5aaf95b0f ]
nvmem_cell_read_u32() may return -EPROBE_DEFER if NVMEM supplier has not yet been probed. Future reprobe may succeed, so printing:
i.mx8mm_thermal 30260000.tmu: Failed to read OCOTP nvmem cell (-517).
to the log is confusing. Fix this by using dev_err_probe. This also elevates the message from warning to error, which is more correct: The log message is only ever printed in probe error path and probe aborts afterwards, so it really warrants an error-level message.
--- drivers/thermal/imx8mm_thermal.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/thermal/imx8mm_thermal.c +2 -4
@@ -179,10 +179,8 @@ static int imx8mm_tmu_probe_set_calib_v1(struct platform_device *pdev,int ret; ret =nvmem_cell_read_u32 (&pdev->dev,"calib" , &ana0); -if (ret) { -dev_warn (dev,"Failed to read OCOTP nvmem cell (%d).\n" , ret); -return ret; - } +if (ret) +return dev_err_probe (dev, ret,"Failed to read OCOTP nvmem cell\n" ); writel(FIELD_PREP(TASR_BUF_VREF_MASK, FIELD_GET(ANA0_BUF_VREF_MASK, ana0)) |
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 611/739 leds: multicolor: Use rounded division when calculating color components
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marek Behún <[email protected]>
[ Upstream commit 065d099f1be58187e6629273c50b948a02b7e1bf ]
Given channel intensity, LED brightness and max LED brightness, the multicolor LED framework helper led_mc_calc_color_components() computes the color channel brightness as
chan_brightness = brightness * chan_intensity / max_brightness
Consider the situation when (brightness, intensity, max_brightness) is for example (16, 15, 255), then chan_brightness is computed to 0 although the fractional divison would give 0.94, which should be rounded to 1.
Use DIV_ROUND_CLOSEST here for the division to give more realistic component computation:
chan_brightness = DIV_ROUND_CLOSEST(brightness * chan_intensity,
max_brightness)
--- drivers/leds/led-class-multicolor.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/leds/led-class-multicolor.c +5 -3
@@ -6,6 +6,7 @@#include <linux/device.h> #include <linux/init.h> #include <linux/led-class-multicolor.h> +#include <linux/math.h> #include <linux/module.h> #include <linux/slab.h> #include <linux/uaccess.h>
@@ -19,9 +20,10 @@ int led_mc_calc_color_components(struct led_classdev_mc *mcled_cdev,int i;for (i =0 ; i < mcled_cdev->num_colors; i++) - mcled_cdev->subled_info[i].brightness = brightness * - mcled_cdev->subled_info[i].intensity / - led_cdev->max_brightness; + mcled_cdev->subled_info[i].brightness = +DIV_ROUND_CLOSEST (brightness * + mcled_cdev->subled_info[i].intensity, + led_cdev->max_brightness);return 0 ; }
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 612/739 leds: Fix BUG_ON check for LED_COLOR_ID_MULTI that is always false
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marek Behún <[email protected]>
[ Upstream commit c3f853184bed04105682383c2971798c572226b5 ]
At the time we call
BUG_ON(props.color == LED_COLOR_ID_MULTI);
the props variable is still initialized to zero.
Call the BUG_ON only after we parse fwnode into props.
--- drivers/leds/led-core.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/leds/led-core.c +4 -4
@@ -474,15 +474,15 @@ int led_compose_name(struct device *dev, struct led_init_data *init_data,struct fwnode_handle *fwnode = init_data->fwnode;const char *devicename = init_data->devicename; -/* We want to label LEDs that can produce full range of colors -* as RGB, not multicolor */ -BUG_ON (props.color ==LED_COLOR_ID_MULTI ); -if (!led_classdev_name)return -EINVAL ;led_parse_fwnode_props (dev, fwnode, &props); +/* We want to label LEDs that can produce full range of colors +* as RGB, not multicolor */ +BUG_ON (props.color ==LED_COLOR_ID_MULTI ); +if (props.label) {/* * If init_data.devicename is NULL, then it indicates that
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 613/739 leds: trigger: tty: Do not use LED_ON/OFF constants, use led_blink_set_oneshot instead
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marek Behún <[email protected]>
[ Upstream commit 730094577e0c37e1bc40be37cbd41f71b0a8a2a4 ]
The tty LED trigger uses the obsolete LED_ON & LED_OFF constants when setting LED brightness. This is bad because the LED_ON constant is equal to 1, and so when activating the tty LED trigger on a LED class device with max_brightness greater than 1, the LED is dimmer than it can be (when max_brightness is 255, the LED is very dimm indeed; some devices translate 1/255 to 0, so the LED is OFF all the time).
Instead of directly setting brightness to a specific value, use the led_blink_set_oneshot() function from LED core to configure the blink. This function takes the current configured brightness as blink brightness if not zero, and max brightness otherwise.
This also changes the behavior of the TTY LED trigger. Previously if rx/tx stats kept changing, the LED was ON all the time they kept changing. With this patch the LED will blink on TTY activity.
--- drivers/leds/trigger/ledtrig-tty.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
drivers/leds/trigger/ledtrig-tty.c +8 -4
@@ -7,6 +7,8 @@#include <linux/tty.h> #include <uapi/linux/serial.h> +#define LEDTRIG_TTY_INTERVAL 50 +struct ledtrig_tty_data {struct led_classdev *led_cdev;struct delayed_work dwork;
@@ -122,17 +124,19 @@ static void ledtrig_tty_work(struct work_struct *work)if (icount.rx != trigger_data->rx || icount.tx != trigger_data->tx) { -led_set_brightness_sync (trigger_data->led_cdev,LED_ON ); +unsigned long interval =LEDTRIG_TTY_INTERVAL ; + +led_blink_set_oneshot (trigger_data->led_cdev, &interval, + &interval,0 ); trigger_data->rx = icount.rx; trigger_data->tx = icount.tx; - }else { -led_set_brightness_sync (trigger_data->led_cdev,LED_OFF ); } out:mutex_unlock (&trigger_data->mutex); -schedule_delayed_work (&trigger_data->dwork,msecs_to_jiffies (100 )); +schedule_delayed_work (&trigger_data->dwork, +msecs_to_jiffies (LEDTRIG_TTY_INTERVAL *2 )); }static struct attribute *ledtrig_tty_attrs[] = {
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 614/739 mtd: spi-nor: Check bus width while setting QE bit
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hsin-Yi Wang <[email protected]>
[ Upstream commit f01d8155a92e33cdaa85d20bfbe6c441907b3c1f ]
spi_nor_write_16bit_sr_and_check() should also check if bus width is 4 before setting QE bit.
--- drivers/mtd/spi-nor/core.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-)
drivers/mtd/spi-nor/core.c +10 -9
@@ -870,21 +870,22 @@ static int spi_nor_write_16bit_sr_and_check(struct spi_nor *nor, u8 sr1) ret =spi_nor_read_cr (nor, &sr_cr[1 ]);if (ret)return ret; - }else if (nor->params->quad_enable) { + }else if (spi_nor_get_protocol_width (nor->read_proto) ==4 && +spi_nor_get_protocol_width (nor->write_proto) ==4 && + nor->params->quad_enable) {/* * If the Status Register 2 Read command (35h) is not * supported, we should at least be sure we don't * change the value of the SR2 Quad Enable bit. * -* We can safely assume that when the Quad Enable method is -* set, the value of the QE bit is one, as a consequence of the -* nor->params->quad_enable() call. +* When the Quad Enable method is set and the buswidth is 4, we +* can safely assume that the value of the QE bit is one, as a +* consequence of the nor->params->quad_enable() call. * -* We can safely assume that the Quad Enable bit is present in -* the Status Register 2 at BIT(1). According to the JESD216 -* revB standard, BFPT DWORDS[15], bits 22:20, the 16-bit -* Write Status (01h) command is available just for the cases -* in which the QE bit is described in SR2 at BIT(1). +* According to the JESD216 revB standard, BFPT DWORDS[15], +* bits 22:20, the 16-bit Write Status (01h) command is +* available just for the cases in which the QE bit is +* described in SR2 at BIT(1). */ sr_cr[1 ] =SR2_QUAD_EN_BIT1 ; }else {
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 615/739 mtd: rawnand: fsmc: handle clk prepare error in fsmc_nand_resume()
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yi Yang <[email protected]>
[ Upstream commit a5a88125d00612586e941ae13e7fcf36ba8f18a7 ]
In fsmc_nand_resume(), the return value of clk_prepare_enable() should be checked since it might fail.
--- drivers/mtd/nand/raw/fsmc_nand.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/mtd/nand/raw/fsmc_nand.c +6 -1
@@ -1200,9 +1200,14 @@ static int fsmc_nand_suspend(struct device *dev)static int fsmc_nand_resume (struct device *dev) {struct fsmc_nand_data *host =dev_get_drvdata (dev); +int ret;if (host) { -clk_prepare_enable (host->clk); + ret =clk_prepare_enable (host->clk); +if (ret) { +dev_err (dev,"failed to enable clk\n" ); +return ret; + }if (host->dev_timings)fsmc_nand_setup (host, host->dev_timings);nand_reset (&host->nand,0 );
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 616/739 mfd: rk808: Make MFD_RK8XX tristate
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Geert Uytterhoeven <[email protected]>
[ Upstream commit d085c27aa62999e2fe054707ab9da2af65d22b2f ]
There is no reason for MFD_RK8XX to be bool, all drivers that depend on it, or that select it, are tristate.
--- drivers/mfd/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mfd/Kconfig +1 -1
@@ -1197,7 +1197,7 @@ config MFD_RC5T583 different functionality of the device. config MFD_RK8XX - bool + tristate select MFD_CORE config MFD_RK8XX_I2C
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 617/739 mfd: rz-mtu3: Link time dependencies
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arnd Bergmann <[email protected]>
[ Upstream commit 10d3340441bd0db857fc7fcb1733a800acf47a3d ]
The new set of drivers for RZ/G2L MTU3a tries to enable compile-testing the individual client drivers even when the MFD portion is disabled but gets it wrong, causing a link failure when the core is in a loadable module but the other drivers are built-in:
x86_64-linux-ld: drivers/pwm/pwm-rz-mtu3.o: in function `rz_mtu3_pwm_apply':
pwm-rz-mtu3.c:(.text+0x4bf): undefined reference to `rz_mtu3_8bit_ch_write'
x86_64-linux-ld: pwm-rz-mtu3.c:(.text+0x509): undefined reference to `rz_mtu3_disable'
arm-linux-gnueabi-ld: drivers/counter/rz-mtu3-cnt.o: in function `rz_mtu3_cascade_counts_enable_get':
rz-mtu3-cnt.c:(.text+0xbec): undefined reference to `rz_mtu3_shared_reg_read'
It seems better not to add the extra complexity here but instead just use a normal hard dependency, so remove the #else portion in the header along with the "|| COMPILE_TEST". This could also be fixed by having slightly more elaborate Kconfig dependencies or using the cursed 'IS_REACHABLE()' helper, but in practice it's already possible to compile-test all these drivers by enabling the mtd portion.
--- drivers/counter/Kconfig | 2 +- drivers/pwm/Kconfig | 2 +- include/linux/mfd/rz-mtu3.h | 66 ------------------------------------- 3 files changed, 2 insertions(+), 68 deletions(-)
drivers/counter/Kconfig +1 -1
@@ -92,7 +92,7 @@ config MICROCHIP_TCB_CAPTURE config RZ_MTU3_CNT tristate "Renesas RZ/G2L MTU3a counter driver" - depends on RZ_MTU3 || COMPILE_TEST + depends on RZ_MTU3 help Enable support for MTU3a counter driver found on Renesas RZ/G2L alike SoCs. This IP supports both 16-bit and 32-bit phase counting mode
drivers/pwm/Kconfig +1 -1
@@ -505,7 +505,7 @@ config PWM_ROCKCHIP config PWM_RZ_MTU3 tristate "Renesas RZ/G2L MTU3a PWM Timer support" - depends on RZ_MTU3 || COMPILE_TEST + depends on RZ_MTU3 depends on HAS_IOMEM help This driver exposes the MTU3a PWM Timer controller found in Renesas
include/linux/mfd/rz-mtu3.h +0 -66
77 lines not on this page · raw message
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 618/739 um: Fix hostaudio build errors
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Randy Dunlap <[email protected]>
[ Upstream commit db4bfcba7bb8d10f00bba2a3da6b9a9c2a1d7b71 ]
Use "select" to ensure that the required kconfig symbols are set as expected.
Drop HOSTAUDIO since it is now equivalent to UML_SOUND.
Set CONFIG_SOUND=m in ARCH=um defconfig files to maintain the status quo of the default configs.
Allow SOUND with UML regardless of HAS_IOMEM. Otherwise there is a kconfig warning for unmet dependencies. (This was not an issue when SOUND was defined in arch/um/drivers/Kconfig. I have done 50 randconfig builds and didn't find any issues.)
This fixes build errors when CONFIG_SOUND is not set:
ld: arch/um/drivers/hostaudio_kern.o: in function `hostaudio_cleanup_module':
hostaudio_kern.c:(.exit.text+0xa): undefined reference to `unregister_sound_mixer'
ld: hostaudio_kern.c:(.exit.text+0x15): undefined reference to `unregister_sound_dsp'
ld: arch/um/drivers/hostaudio_kern.o: in function `hostaudio_init_module':
hostaudio_kern.c:(.init.text+0x19): undefined reference to `register_sound_dsp'
ld: hostaudio_kern.c:(.init.text+0x31): undefined reference to `register_sound_mixer'
ld: hostaudio_kern.c:(.init.text+0x49): undefined reference to `unregister_sound_dsp'
and this kconfig warning:
WARNING: unmet direct dependencies detected for SOUND
--- arch/um/configs/i386_defconfig | 1 + arch/um/configs/x86_64_defconfig | 1 + arch/um/drivers/Kconfig | 16 +++------------- arch/um/drivers/Makefile | 2 +- sound/Kconfig | 2 +- 5 files changed, 7 insertions(+), 15 deletions(-)
arch/um/configs/i386_defconfig +1 -0
@@ -34,6 +34,7 @@ CONFIG_TTY_CHAN=y CONFIG_XTERM_CHAN=y CONFIG_CON_CHAN="pts" CONFIG_SSL_CHAN="pts" +CONFIG_SOUND=m CONFIG_UML_SOUND=m CONFIG_DEVTMPFS=y CONFIG_DEVTMPFS_MOUNT=y
arch/um/configs/x86_64_defconfig +1 -0
@@ -32,6 +32,7 @@ CONFIG_TTY_CHAN=y CONFIG_XTERM_CHAN=y CONFIG_CON_CHAN="pts" CONFIG_SSL_CHAN="pts" +CONFIG_SOUND=m CONFIG_UML_SOUND=m CONFIG_DEVTMPFS=y CONFIG_DEVTMPFS_MOUNT=y
arch/um/drivers/Kconfig +3 -13
@@ -111,24 +111,14 @@ config SSL_CHAN config UML_SOUND tristate "Sound support" + depends on SOUND + select SOUND_OSS_CORE help This option enables UML sound support. If enabled, it will pull in - soundcore and the UML hostaudio relay, which acts as a intermediary + the UML hostaudio relay, which acts as a intermediary between the host's dsp and mixer devices and the UML sound system. It is safe to say 'Y' here. -config SOUND - tristate - default UML_SOUND - -config SOUND_OSS_CORE - bool - default UML_SOUND - -config HOSTAUDIO - tristate - default UML_SOUND - endmenu menu "UML Network Devices"
arch/um/drivers/Makefile +1 -1
@@ -54,7 +54,7 @@ obj-$(CONFIG_UML_NET) += net.o obj-$(CONFIG_MCONSOLE) += mconsole.o obj-$(CONFIG_MMAPPER) += mmapper_kern.o obj-$(CONFIG_BLK_DEV_UBD) += ubd.o -obj-$(CONFIG_HOSTAUDIO) += hostaudio.o +obj-$(CONFIG_UML_SOUND) += hostaudio.o obj-$(CONFIG_NULL_CHAN) += null.o obj-$(CONFIG_PORT_CHAN) += port.o obj-$(CONFIG_PTY_CHAN) += pty.o
sound/Kconfig +1 -1
@@ -1,7 +1,7 @@ # SPDX-License-Identifier: GPL-2.0-only menuconfig SOUND tristate "Sound card support" - depends on HAS_IOMEM + depends on HAS_IOMEM || UML help If you have a sound card in your computer, i.e. if it can say more than an occasional beep, say Y.
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 619/739 dmaengine: ste_dma40: Add missing IRQ check in d40_probe
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: ruanjinjie <[email protected]>
[ Upstream commit c05ce6907b3d6e148b70f0bb5eafd61dcef1ddc1 ]
Check for the return value of platform_get_irq(): if no interrupt is specified, it wouldn't make sense to call request_irq().
--- drivers/dma/ste_dma40.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/dma/ste_dma40.c +4 -0
@@ -3590,6 +3590,10 @@ static int __init d40_probe(struct platform_device *pdev)spin_lock_init (&base->lcla_pool.lock); base->irq =platform_get_irq (pdev,0 ); +if (base->irq <0 ) { + ret = base->irq; + goto destroy_cache; + } ret =request_irq (base->irq, d40_handle_interrupt,0 ,D40_NAME , base);if (ret) {
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 620/739 dmaengine: idxd: Simplify WQ attribute visibility checks
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Fenghua Yu <[email protected]>
[ Upstream commit 97b1185fe54c8ce94104e3c7fa4ee0bbedd85920 ]
The functions that check if WQ attributes are invisible are almost duplicate. Define a helper to simplify these functions and future WQ attribute visibility checks as well.
Stable-dep-of: 0056a7f07b0a ("dmaengine: idxd: Allow ATS disable update only for configurable devices")
--- drivers/dma/idxd/sysfs.c | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-)
drivers/dma/idxd/sysfs.c +5 -15
@@ -1288,12 +1288,9 @@ static struct attribute *idxd_wq_attributes[] = { NULL, }; -static bool idxd_wq_attr_op_config_invisible (struct attribute *attr, -struct idxd_device *idxd) -{ -return attr == &dev_attr_wq_op_config.attr && - !idxd->hw.wq_cap.op_config; -} +/* A WQ attr is invisible if the feature is not supported in WQCAP. */ +#define idxd_wq_attr_invisible (name, cap_field, a, idxd) \ + ((a) == &dev_attr_wq_##name.attr && !(idxd)->hw.wq_cap.cap_field)static bool idxd_wq_attr_max_batch_size_invisible (struct attribute *attr,struct idxd_device *idxd)
@@ -1303,13 +1300,6 @@ static bool idxd_wq_attr_max_batch_size_invisible(struct attribute *attr, idxd->data->type ==IDXD_TYPE_IAX ; } -static bool idxd_wq_attr_wq_prs_disable_invisible (struct attribute *attr, -struct idxd_device *idxd) -{ -return attr == &dev_attr_wq_prs_disable.attr && - !idxd->hw.wq_cap.wq_prs_support; -} -static umode_t idxd_wq_attr_visible (struct kobject *kobj,struct attribute *attr,int n) {
@@ -1317,13 +1307,13 @@ static umode_t idxd_wq_attr_visible(struct kobject *kobj,struct idxd_wq *wq =confdev_to_wq (dev);struct idxd_device *idxd = wq->idxd; -if (idxd_wq_attr_op_config_invisible (attr, idxd)) +if (idxd_wq_attr_invisible (op_config, op_config, attr, idxd))return 0 ;if (idxd_wq_attr_max_batch_size_invisible (attr, idxd))return 0 ; -if (idxd_wq_attr_wq_prs_disable_invisible (attr, idxd)) +if (idxd_wq_attr_invisible (prs_disable, wq_prs_support, attr, idxd))return 0 ;return attr->mode;
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 621/739 dmaengine: idxd: Expose ATS disable knob only when WQ ATS is supported
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Fenghua Yu <[email protected]>
[ Upstream commit 62b41b656666d2d35890124df5ef0881fe6d6769 ]
WQ Advanced Translation Service (ATS) can be controlled only when WQ ATS is supported. The sysfs ATS disable knob should be visible only when the features is supported.
Stable-dep-of: 0056a7f07b0a ("dmaengine: idxd: Allow ATS disable update only for configurable devices")
--- drivers/dma/idxd/sysfs.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/dma/idxd/sysfs.c +3 -4
@@ -1088,16 +1088,12 @@ static ssize_t wq_ats_disable_store(struct device *dev, struct device_attribute const char *buf, size_t count) {struct idxd_wq *wq =confdev_to_wq (dev); -struct idxd_device *idxd = wq->idxd;bool ats_dis;int rc;if (wq->state !=IDXD_WQ_DISABLED )return -EPERM ; -if (!idxd->hw.wq_cap.wq_ats_support) -return -EOPNOTSUPP ; - rc =kstrtobool (buf, &ats_dis);if (rc <0 )return rc;
@@ -1316,6 +1312,9 @@ static umode_t idxd_wq_attr_visible(struct kobject *kobj,if (idxd_wq_attr_invisible (prs_disable, wq_prs_support, attr, idxd))return 0 ; +if (idxd_wq_attr_invisible (ats_disable, wq_ats_support, attr, idxd)) +return 0 ; +return attr->mode; }
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 622/739 dmaengine: idxd: Allow ATS disable update only for configurable devices
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Fenghua Yu <[email protected]>
[ Upstream commit 0056a7f07b0a63e6cee815a789eabba6f3a710f0 ]
ATS disable status in a WQ is read-only if the device is not configurable. This change ensures that the ATS disable attribute can be modified via sysfs only on configurable devices.
--- drivers/dma/idxd/sysfs.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/dma/idxd/sysfs.c +4 -0
@@ -1088,12 +1088,16 @@ static ssize_t wq_ats_disable_store(struct device *dev, struct device_attribute const char *buf, size_t count) {struct idxd_wq *wq =confdev_to_wq (dev); +struct idxd_device *idxd = wq->idxd;bool ats_dis;int rc;if (wq->state !=IDXD_WQ_DISABLED )return -EPERM ; +if (!test_bit (IDXD_FLAG_CONFIGURABLE , &idxd->flags)) +return -EPERM ; + rc =kstrtobool (buf, &ats_dis);if (rc <0 )return rc;
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 623/739 dmaengine: idxd: Fix issues with PRS disable sysfs knob
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Fenghua Yu <[email protected]>
[ Upstream commit 8cae66574398326134a41513b419e00ad4e380ca ]
There are two issues in the current PRS disable sysfs store function wq_prs_disable_store():
1. Since PRS disable knob is invisible if PRS disable is not supported in WQ, it's redundant to check PRS support again in the store function again. Remove the redundant PRS support check.
2. Since PRS disable is read-only when the device is not configurable, PRS disable cannot be changed on the device. Add device configurable check in the store function.
--- drivers/dma/idxd/sysfs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/dma/idxd/sysfs.c +2 -2
@@ -1131,8 +1131,8 @@ static ssize_t wq_prs_disable_store(struct device *dev, struct device_attributeif (wq->state !=IDXD_WQ_DISABLED )return -EPERM ; -if (!idxd->hw.wq_cap.wq_prs_support) -return -EOPNOTSUPP ; +if (!test_bit (IDXD_FLAG_CONFIGURABLE , &idxd->flags)) +return -EPERM ; rc =kstrtobool (buf, &prs_dis);if (rc <0 )
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 624/739 remoteproc: stm32: fix incorrect optional pointers
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arnd Bergmann <[email protected]>
[ Upstream commit fb2bdd32b231b70e6a3f1054528692f604db25d8 ]
Compile-testing without CONFIG_OF shows that the of_match_ptr() macro was used incorrectly here:
drivers/remoteproc/stm32_rproc.c:662:34: warning: unused variable 'stm32_rproc_match' [-Wunused-const-variable]
As in almost every driver, the solution is simply to remove the use of this macro. The same thing happened with the deprecated SIMPLE_DEV_PM_OPS(), but the corresponding warning was already shut up with __maybe_unused annotations, so fix those as well by using the correct DEFINE_SIMPLE_DEV_PM_OPS() macros and removing the extraneous __maybe_unused modifiers. For completeness, also add a pm_ptr() to let the PM ops be eliminated completely when CONFIG_PM is turned off.
--- drivers/remoteproc/stm32_rproc.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/remoteproc/stm32_rproc.c +6 -6
@@ -921,7 +921,7 @@ static void stm32_rproc_remove(struct platform_device *pdev)rproc_free (rproc); } -static int __maybe_unused stm32_rproc_suspend (struct device *dev) +static int stm32_rproc_suspend (struct device *dev) {struct rproc *rproc =dev_get_drvdata (dev);struct stm32_rproc *ddata = rproc->priv;
@@ -932,7 +932,7 @@ static int __maybe_unused stm32_rproc_suspend(struct device *dev)return 0 ; } -static int __maybe_unused stm32_rproc_resume (struct device *dev) +static int stm32_rproc_resume (struct device *dev) {struct rproc *rproc =dev_get_drvdata (dev);struct stm32_rproc *ddata = rproc->priv;
@@ -943,16 +943,16 @@ static int __maybe_unused stm32_rproc_resume(struct device *dev)return 0 ; } -static SIMPLE_DEV_PM_OPS(stm32_rproc_pm_ops, - stm32_rproc_suspend, stm32_rproc_resume); +static DEFINE_SIMPLE_DEV_PM_OPS(stm32_rproc_pm_ops, + stm32_rproc_suspend, stm32_rproc_resume);static struct platform_driver stm32_rproc_driver = { .probe = stm32_rproc_probe, .remove_new = stm32_rproc_remove, .driver = { .name ="stm32-rproc" , - .pm = &stm32_rproc_pm_ops, - .of_match_table =of_match_ptr (stm32_rproc_match), + .pm =pm_ptr (&stm32_rproc_pm_ops), + .of_match_table = stm32_rproc_match, }, };module_platform_driver (stm32_rproc_driver);
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 625/739 Drivers: hv: vmbus: Dont dereference ACPI root object handle
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Maciej S. Szmigiero <[email protected]>
[ Upstream commit 78e04bbff849b51b56f5925b1945db2c6e128b61 ]
Since the commit referenced in the Fixes: tag below the VMBus client driver is walking the ACPI namespace up from the VMBus ACPI device to the ACPI namespace root object trying to find Hyper-V MMIO ranges.
However, if it is not able to find them it ends trying to walk resources of the ACPI namespace root object itself.
This object has all-ones handle, which causes a NULL pointer dereference in the ACPI code (from dereferencing this pointer with an offset).
This in turn causes an oops on boot with VMBus host implementations that do not provide Hyper-V MMIO ranges in their VMBus ACPI device or its ancestors.
The QEMU VMBus implementation is an example of such implementation.
I guess providing these ranges is optional, since all tested Windows versions seem to be able to use VMBus devices without them.
Fix this by explicitly terminating the lookup at the ACPI namespace root object.
Note that Linux guests under KVM/QEMU do not use the Hyper-V PV interface by default - they only do so if the KVM PV interface is missing or disabled.
Example stack trace of such oops:
[ 3.710827] ? __die+0x1f/0x60 [ 3.715030] ? page_fault_oops+0x159/0x460 [ 3.716008] ? exc_page_fault+0x73/0x170 [ 3.716959] ? asm_exc_page_fault+0x22/0x30 [ 3.717957] ? acpi_ns_lookup+0x7a/0x4b0 [ 3.718898] ? acpi_ns_internalize_name+0x79/0xc0 [ 3.720018] acpi_ns_get_node_unlocked+0xb5/0xe0 [ 3.721120] ? acpi_ns_check_object_type+0xfe/0x200 [ 3.722285] ? acpi_rs_convert_aml_to_resource+0x37/0x6e0 [ 3.723559] ? down_timeout+0x3a/0x60 [ 3.724455] ? acpi_ns_get_node+0x3a/0x60 [ 3.725412] acpi_ns_get_node+0x3a/0x60 [ 3.726335] acpi_ns_evaluate+0x1c3/0x2c0 [ 3.727295] acpi_ut_evaluate_object+0x64/0x1b0 [ 3.728400] acpi_rs_get_method_data+0x2b/0x70 [ 3.729476] ? vmbus_platform_driver_probe+0x1d0/0x1d0 [hv_vmbus] [ 3.730940] ? vmbus_platform_driver_probe+0x1d0/0x1d0 [hv_vmbus] [ 3.732411] acpi_walk_resources+0x78/0xd0 [ 3.733398] vmbus_platform_driver_probe+0x9f/0x1d0 [hv_vmbus] [ 3.734802] platform_probe+0x3d/0x90 [ 3.735684] really_probe+0x19b/0x400 [ 3.736570] ? __device_attach_driver+0x100/0x100 [ 3.737697] __driver_probe_device+0x78/0x160 [ 3.738746] driver_probe_device+0x1f/0x90 [ 3.739743] __driver_attach+0xc2/0x1b0 [ 3.740671] bus_for_each_dev+0x70/0xc0 [ 3.741601] bus_add_driver+0x10e/0x210 [ 3.742527] driver_register+0x55/0xf0 [ 3.744412] ? 0xffffffffc039a000 [ 3.745207] hv_acpi_init+0x3c/0x1000 [hv_vmbus]
--- drivers/hv/vmbus_drv.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/hv/vmbus_drv.c +2 -1
@@ -2287,7 +2287,8 @@ static int vmbus_acpi_add(struct platform_device *pdev)* Some ancestor of the vmbus acpi device (Gen1 or Gen2 * firmware) is the VMOD that has the mmio ranges. Get that. */ -for (ancestor =acpi_dev_parent (device); ancestor; +for (ancestor =acpi_dev_parent (device); + ancestor && ancestor->handle !=ACPI_ROOT_OBJECT ; ancestor =acpi_dev_parent (ancestor)) { result =acpi_walk_resources (ancestor->handle,METHOD_NAME__CRS , vmbus_walk_resources,NULL );
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 626/739 um: virt-pci: fix missing declaration warning
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vincent Whitchurch <[email protected]>
[ Upstream commit 974b808d85abbc03c3914af63d60d5816aabf2ca ]
Fix this warning which appears with W=1 and without CONFIG_OF:
warning: no previous declaration for 'pcibios_get_phb_of_node'
--- arch/um/drivers/virt-pci.c | 2 ++ 1 file changed, 2 insertions(+)
arch/um/drivers/virt-pci.c +2 -0
@@ -544,6 +544,7 @@ static void um_pci_irq_vq_cb(struct virtqueue *vq) } } +#ifdef CONFIG_OF /* Copied from arch/x86/kernel/devicetree.c */ struct device_node *pcibios_get_phb_of_node (struct pci_bus *bus) {
@@ -562,6 +563,7 @@ struct device_node *pcibios_get_phb_of_node(struct pci_bus *bus) }return NULL ; } +#endif static int um_pci_init_vqs (struct um_pci_device *dev) {
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 627/739 cpufreq: Fix the race condition while updating the transition_task of policy
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Liao Chang <[email protected]>
[ Upstream commit 61bfbf7951ba561dcbdd5357702d3cbc2d447812 ]
The field 'transition_task' of policy structure is used to track the task which is performing the frequency transition. Using this field to print a warning once detect a case where the same task is calling _begin() again before completing the preivous frequency transition via the _end().
However, there is a potential race condition in _end() and _begin() APIs while updating the field 'transition_task' of policy, the scenario is depicted below:
Task A Task B
/* 1st freq transition */
Invoke _begin() {
...
...
}
/* 2nd freq transition */
Invoke _begin() {
... //waiting for A to
... //clear
... //transition_ongoing
... //in _end() for
... //the 1st transition
|
Change the frequency |
|
Invoke _end() { |
... |
... |
transition_ongoing = false; V
transition_ongoing = true;
transition_task = current;
transition_task = NULL;
... //A overwrites the task
... //performing the transition
... //result in error warning.
}To fix this race condition, the transition_lock of policy structure is now acquired before updating policy structure in _end() API. Which ensure that only one task can update the 'transition_task' field at a time.
--- drivers/cpufreq/cpufreq.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/cpufreq/cpufreq.c +2 -0
@@ -455,8 +455,10 @@ void cpufreq_freq_transition_end(struct cpufreq_policy *policy, policy->cur, policy->cpuinfo.max_freq); +spin_lock (&policy->transition_lock); policy->transition_ongoing = false; policy->transition_task =NULL ; +spin_unlock (&policy->transition_lock);wake_up (&policy->transition_wait); }
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 628/739 virtio_vdpa: build affinity masks conditionally
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jason Wang <[email protected]>
[ Upstream commit ae15aceaa98ad9499763923f7890e345d9f46b60 ]
We try to build affinity mask via create_affinity_masks() unconditionally which may lead several issues:
- the affinity mask is not used for parent without affinity support (only VDUSE support the affinity now)
- the logic of create_affinity_masks() might not work for devices other than block. For example it's not rare in the networking device where the number of queues could exceed the number of CPUs. Such case breaks the current affinity logic which is based on group_cpus_evenly() who assumes the number of CPUs are not less than the number of groups. This can trigger a warning[1]:
if (ret >= 0) WARN_ON(nr_present + nr_others < numgrps);
Fixing this by only build the affinity masks only when
- Driver passes affinity descriptor, driver like virtio-blk can make sure to limit the number of queues when it exceeds the number of CPUs
- Parent support affinity setting config ops
This help to avoid the warning. More optimizations could be done on top.
[1]
[ 682.146655] WARNING: CPU: 6 PID: 1550 at lib/group_cpus.c:400 group_cpus_evenly+0x1aa/0x1c0 [ 682.146668] CPU: 6 PID: 1550 Comm: vdpa Not tainted 6.5.0-rc5jason+ #79 [ 682.146671] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.16.2-0-gea1b7a073390-prebuilt.qemu.org 04/01/2014 [ 682.146673] RIP: 0010:group_cpus_evenly+0x1aa/0x1c0 [ 682.146676] Code: 4c 89 e0 5b 5d 41 5c 41 5d 41 5e c3 cc cc cc cc e8 1b c4 74 ff 48 89 ef e8 13 ac 98 ff 4c 89 e7 45 31 e4 e8 08 ac 98 ff eb c2 <0f> 0b eb b6 e8 fd 05 c3 00 45 31 e4 eb e5 cc cc cc cc cc cc cc cc [ 682.146679] RSP: 0018:ffffc9000215f498 EFLAGS: 00010293 [ 682.146682] RAX: 000000000001f1e0 RBX: 0000000000000041 RCX: 0000000000000000 [ 682.146684] RDX: ffff888109922058 RSI: 0000000000000041 RDI: 0000000000000030 [ 682.146686] RBP: ffff888109922058 R08: ffffc9000215f498 R09: ffffc9000215f4a0 [ 682.146687] R10: 00000000000198d0 R11: 0000000000000030 R12: ffff888107e02800 [ 682.146689] R13: 0000000000000030 R14: 0000000000000030 R15: 0000000000000041 [ 682.146692] FS: 00007fef52315740(0000) GS:ffff888237380000(0000) knlGS:0000000000000000 [ 682.146695] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 682.146696] CR2: 00007fef52509000 CR3: 0000000110dbc004 CR4: 0000000000370ee0 [ 682.146698] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 [ 682.146700] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 [ 682.146701] Call Trace: [ 682.146703] <TASK> [ 682.146705] ? __warn+0x7b/0x130 [ 682.146709] ? group_cpus_evenly+0x1aa/0x1c0 [ 682.146712] ? report_bug+0x1c8/0x1e0 [ 682.146717] ? handle_bug+0x3c/0x70 [ 682.146721] ? exc_invalid_op+0x14/0x70 [ 682.146723] ? asm_exc_invalid_op+0x16/0x20 [ 682.146727] ? group_cpus_evenly+0x1aa/0x1c0 [ 682.146729] ? group_cpus_evenly+0x15c/0x1c0 [ 682.146731] create_affinity_masks+0xaf/0x1a0 [ 682.146735] virtio_vdpa_find_vqs+0x83/0x1d0 [ 682.146738] ? __pfx_default_calc_sets+0x10/0x10 [ 682.146742] virtnet_find_vqs+0x1f0/0x370 [ 682.146747] virtnet_probe+0x501/0xcd0 [ 682.146749] ? vp_modern_get_status+0x12/0x20 [ 682.146751] ? get_cap_addr.isra.0+0x10/0xc0 [ 682.146754] virtio_dev_probe+0x1af/0x260 [ 682.146759] really_probe+0x1a5/0x410
Message-Id: <[email protected]>
--- drivers/virtio/virtio_vdpa.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-)
drivers/virtio/virtio_vdpa.c +11 -6
@@ -366,11 +366,14 @@ static int virtio_vdpa_find_vqs(struct virtio_device *vdev, unsigned int nvqs,struct irq_affinity default_affd = {0 };struct cpumask *masks;struct vdpa_callback cb; +bool has_affinity = desc && ops->set_vq_affinity;int i, err, queue_idx =0 ; - masks =create_affinity_masks (nvqs, desc ? desc : &default_affd); -if (!masks) -return -ENOMEM ; +if (has_affinity) { + masks =create_affinity_masks (nvqs, desc ? desc : &default_affd); +if (!masks) +return -ENOMEM ; + }for (i =0 ; i < nvqs; ++i) {if (!names[i]) {
@@ -386,20 +389,22 @@ static int virtio_vdpa_find_vqs(struct virtio_device *vdev, unsigned int nvqs, goto err_setup_vq; } -if (ops->set_vq_affinity) +if (has_affinity) ops->set_vq_affinity (vdpa, i, &masks[i]); } cb.callback = virtio_vdpa_config_cb; cb.private = vd_dev; ops->set_config_cb (vdpa, &cb); -kfree (masks); +if (has_affinity) +kfree (masks);return 0 ; err_setup_vq:virtio_vdpa_del_vqs (vdev); -kfree (masks); +if (has_affinity) +kfree (masks);return err; }
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 629/739 virtio_ring: fix avail_wrap_counter in virtqueue_add_packed
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yuan Yao <[email protected]>
[ Upstream commit 1acfe2c1225899eab5ab724c91b7e1eb2881b9ab ]
In current packed virtqueue implementation, the avail_wrap_counter won't flip, in the case when the driver supplies a descriptor chain with a length equals to the queue size; total_sg == vq->packed.vring.num.
Let’s assume the following situation:
vq->packed.vring.num=4vq->packed.next_avail_idx: 1vq->packed.avail_wrap_counter: 0
Then the driver adds a descriptor chain containing 4 descriptors.
We expect the following result with avail_wrap_counter flipped:vq->packed.next_avail_idx: 1 vq->packed.avail_wrap_counter: 1
But, the current implementation gives the following result:vq->packed.next_avail_idx: 1 vq->packed.avail_wrap_counter: 0
To reproduce the bug, you can set a packed queue size as small as possible, so that the driver is more likely to provide a descriptor chain with a length equal to the packed queue size. For example, in qemu run following commands:
sudo qemu-system-x86_64 \
-enable-kvm \
-nographic \
-kernel "path/to/kernel_image" \
-m 1G \
-drive file="path/to/rootfs",if=none,id=disk \
-device virtio-blk,drive=disk \
-drive file="path/to/disk_image",if=none,id=rwdisk \
-device virtio-blk,drive=rwdisk,packed=on,queue-size=4,\
indirect_desc=off \
-append "console=ttyS0 root=/dev/vda rw init=/bin/bash"
Inside the VM, create a directory and mount the rwdisk device on it. The rwdisk will hang and mount operation will not complete.
This commit fixes the wrap counter error by flipping the packed.avail_wrap_counter, when start of descriptor chain equals to the end of descriptor chain (head == i).
Message-Id: <[email protected]>
--- drivers/virtio/virtio_ring.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/virtio/virtio_ring.c +1 -1
@@ -1461,7 +1461,7 @@ static inline int virtqueue_add_packed(struct virtqueue *_vq, } } -if (i < head) +if (i <= head) vq->packed.avail_wrap_counter ^=1 ;/* We're using some buffers from the free list. */
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 630/739 net: deal with integer overflows in kmalloc_reserve()
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
commit 915d975b2ffa58a14bfcf16fafe00c41315949ff upstream.
Blamed commit changed:
ptr = kmalloc(size);
if (ptr)
size = ksize(ptr);to:
size = kmalloc_size_roundup(size);
ptr = kmalloc(size);This allowed various crash as reported by syzbot [1] and Kyle Zeng.
Problem is that if @size is bigger than 0x80000001, kmalloc_size_roundup(size) returns 2^32.
kmalloc_reserve() uses a 32bit variable (obj_size), so 2^32 is truncated to 0.
kmalloc(0) returns ZERO_SIZE_PTR which is not handled by skb allocations.
Following trace can be triggered if a netdev->mtu is set close to 0x7fffffff
We might in the future limit netdev->mtu to more sensible limit (like KMALLOC_MAX_SIZE).
This patch is based on a syzbot report, and also a report and tentative fix from Kyle Zeng.
[1]
BUG: KASAN: user-memory-access in __build_skb_around net/core/skbuff.c:294 [inline] BUG: KASAN: user-memory-access in __alloc_skb+0x3c4/0x6e8 net/core/skbuff.c:527 Write of size 32 at addr 00000000fffffd10 by task syz-executor.4/22554 CPU: 1 PID: 22554 Comm: syz-executor.4 Not tainted 6.1.39-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/03/2023 Call trace: dump_backtrace+0x1c8/0x1f4 arch/arm64/kernel/stacktrace.c:279 show_stack+0x2c/0x3c arch/arm64/kernel/stacktrace.c:286 __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x120/0x1a0 lib/dump_stack.c:106 print_report+0xe4/0x4b4 mm/kasan/report.c:398 kasan_report+0x150/0x1ac mm/kasan/report.c:495 kasan_check_range+0x264/0x2a4 mm/kasan/generic.c:189 memset+0x40/0x70 mm/kasan/shadow.c:44 __build_skb_around net/core/skbuff.c:294 [inline] __alloc_skb+0x3c4/0x6e8 net/core/skbuff.c:527 alloc_skb include/linux/skbuff.h:1316 [inline] igmpv3_newpack+0x104/0x1088 net/ipv4/igmp.c:359 add_grec+0x81c/0x1124 net/ipv4/igmp.c:534 igmpv3_send_cr net/ipv4/igmp.c:667 [inline] igmp_ifc_timer_expire+0x1b0/0x1008 net/ipv4/igmp.c:810 call_timer_fn+0x1c0/0x9f0 kernel/time/timer.c:1474 expire_timers kernel/time/timer.c:1519 [inline] __run_timers+0x54c/0x710 kernel/time/timer.c:1790 run_timer_softirq+0x28/0x4c kernel/time/timer.c:1803 _stext+0x380/0xfbc ____do_softirq+0x14/0x20 arch/arm64/kernel/irq.c:79 call_on_irq_stack+0x24/0x4c arch/arm64/kernel/entry.S:891 do_softirq_own_stack+0x20/0x2c arch/arm64/kernel/irq.c:84 invoke_softirq kernel/softirq.c:437 [inline] __irq_exit_rcu+0x1c0/0x4cc kernel/softirq.c:683 irq_exit_rcu+0x14/0x78 kernel/softirq.c:695 el0_interrupt+0x7c/0x2e0 arch/arm64/kernel/entry-common.c:717 __el0_irq_handler_common+0x18/0x24 arch/arm64/kernel/entry-common.c:724 el0t_64_irq_handler+0x10/0x1c arch/arm64/kernel/entry-common.c:729 el0t_64_irq+0x1a0/0x1a4 arch/arm64/kernel/entry.S:584
--- net/core/skbuff.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
net/core/skbuff.c +8 -2
@@ -550,7 +550,7 @@ static void *kmalloc_reserve(unsigned in bool *pfmemalloc) {bool ret_pfmemalloc = false; -unsigned int obj_size; +size_t obj_size;void *obj; obj_size =SKB_HEAD_ALIGN (*size);
@@ -567,7 +567,13 @@ static void *kmalloc_reserve(unsigned in obj =kmem_cache_alloc_node (skb_small_head_cache, flags, node); goto out; } - *size = obj_size =kmalloc_size_roundup (obj_size); + + obj_size =kmalloc_size_roundup (obj_size); +/* The following cast might truncate high-order bits of obj_size, this +* is harmless because kmalloc(obj_size >= 2^32) will fail anyway. +*/ + *size = (unsigned int )obj_size; +/* * Try a regular allocation, when that fails and we're not entitled * to the reserves, fail.
Greg Kroah-Hartman
maintainerPATCH 631/739 igmp: limit igmpv3_newpack() packet size to IP_MAX_MTU
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
commit c3b704d4a4a265660e665df51b129e8425216ed1 upstream.
This is a follow up of commit 915d975b2ffa ("net: deal with integer overflows in kmalloc_reserve()") based on David Laight feedback.
Back in 2010, I failed to realize malicious users could set dev->mtu to arbitrary values. This mtu has been since limited to 0x7fffffff but regardless of how big dev->mtu is, it makes no sense for igmpv3_newpack() to allocate more than IP_MAX_MTU and risk various skb fields overflows.
--- net/ipv4/igmp.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/ipv4/igmp.c +2 -1
@@ -353,8 +353,9 @@ static struct sk_buff *igmpv3_newpack(ststruct flowi4 fl4;int hlen =LL_RESERVED_SPACE (dev);int tlen = dev->needed_tailroom; -unsigned int size = mtu; +unsigned int size; + size =min (mtu,IP_MAX_MTU );while (1 ) { skb =alloc_skb (size + hlen + tlen,GFP_ATOMIC | __GFP_NOWARN);
Greg Kroah-Hartman
maintainerPATCH 632/739 netfilter: ipset: add the missing IP_SET_HASH_WITH_NET0 macro for ip_set_hash_netportnet.c
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kyle Zeng <[email protected]>
commit 050d91c03b28ca479df13dfb02bcd2c60dd6a878 upstream.
The missing IP_SET_HASH_WITH_NET0 macro in ip_set_hash_netportnet can lead to the use of wrong CIDR_POS(c) for calculating array offsets, which can lead to integer underflow. As a result, it leads to slab out-of-bound access.
This patch adds back the IP_SET_HASH_WITH_NET0 macro to ip_set_hash_netportnet to address the issue.
--- net/netfilter/ipset/ip_set_hash_netportnet.c | 1 + 1 file changed, 1 insertion(+)
net/netfilter/ipset/ip_set_hash_netportnet.c +1 -0
@@ -36,6 +36,7 @@ MODULE_ALIAS("ip_set_hash:net,port,net")#define IP_SET_HASH_WITH_PROTO #define IP_SET_HASH_WITH_NETS #define IPSET_NET_COUNT 2 +#define IP_SET_HASH_WITH_NET0 /* IPv4 variant */
Greg Kroah-Hartman
maintainerPATCH 633/739 netfilter: nft_exthdr: Fix non-linear header modification
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Xiao Liang <[email protected]>
commit 28427f368f0e08d504ed06e74bc7cc79d6d06511 upstream.
Fix skb_ensure_writable() size. Don't use nft_tcp_header_pointer() to make it explicit that pointers point to the packet (not local buffer).
--- net/netfilter/nft_exthdr.c | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-)
net/netfilter/nft_exthdr.c +8 -12
@@ -238,7 +238,12 @@ static void nft_exthdr_tcp_set_eval(consif (!tcph) goto err; +if (skb_ensure_writable (pkt->skb,nft_thoff (pkt) + tcphdr_len)) + goto err; + + tcph = (struct tcphdr *)(pkt->skb->data +nft_thoff (pkt)); opt = (u8 *)tcph; +for (i =sizeof (*tcph); i < tcphdr_len -1 ; i += optl) {union {__be16 v16;
@@ -253,15 +258,6 @@ static void nft_exthdr_tcp_set_eval(consif (i + optl > tcphdr_len || priv->len + priv->offset > optl) goto err; -if (skb_ensure_writable (pkt->skb, -nft_thoff (pkt) + i + priv->len)) - goto err; - - tcph =nft_tcp_header_pointer (pkt,sizeof (buff), buff, - &tcphdr_len); -if (!tcph) - goto err; - offset = i + priv->offset;switch (priv->len) {
@@ -325,9 +321,9 @@ static void nft_exthdr_tcp_strip_eval(coif (skb_ensure_writable (pkt->skb,nft_thoff (pkt) + tcphdr_len)) goto drop; - opt = (u8 *)nft_tcp_header_pointer (pkt,sizeof (buff), buff, &tcphdr_len); -if (!opt) - goto err; + tcph = (struct tcphdr *)(pkt->skb->data +nft_thoff (pkt)); + opt = (u8 *)tcph; +for (i =sizeof (*tcph); i < tcphdr_len -1 ; i += optl) {unsigned int j;
Greg Kroah-Hartman
maintainerPATCH 634/739 netfilter: xt_u32: validate user space input
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wander Lairson Costa <[email protected]>
commit 69c5d284f67089b4750d28ff6ac6f52ec224b330 upstream.
The xt_u32 module doesn't validate the fields in the xt_u32 structure. An attacker may take advantage of this to trigger an OOB read by setting the size fields with a value beyond the arrays boundaries.
Add a checkentry function to validate the structure.
This was originally reported by the ZDI project (ZDI-CAN-18408).
--- net/netfilter/xt_u32.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+)
net/netfilter/xt_u32.c +21 -0
@@ -96,11 +96,32 @@ static bool u32_mt(const struct sk_buffreturn ret ^ data->invert; } +static int u32_mt_checkentry (const struct xt_mtchk_param *par) +{ +const struct xt_u32 *data = par->matchinfo; +const struct xt_u32_test *ct; +unsigned int i; + +if (data->ntests >ARRAY_SIZE (data->tests)) +return -EINVAL ; + +for (i =0 ; i < data->ntests; ++i) { + ct = &data->tests[i]; + +if (ct->nnums >ARRAY_SIZE (ct->location) || + ct->nvalues >ARRAY_SIZE (ct->value)) +return -EINVAL ; + } + +return 0 ; +} +static struct xt_match xt_u32_mt_reg__read_mostly = { .name ="u32" , .revision =0 , .family =NFPROTO_UNSPEC , .match = u32_mt, + .checkentry = u32_mt_checkentry, .matchsize =sizeof (struct xt_u32 ), .me =THIS_MODULE , };
Greg Kroah-Hartman
maintainerPATCH 635/739 netfilter: xt_sctp: validate the flag_info count
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wander Lairson Costa <[email protected]>
commit e99476497687ef9e850748fe6d232264f30bc8f9 upstream.
sctp_mt_check doesn't validate the flag_count field. An attacker can take advantage of that to trigger a OOB read and leak memory information.
Add the field validation in the checkentry function.
--- net/netfilter/xt_sctp.c | 2 ++ 1 file changed, 2 insertions(+)
net/netfilter/xt_sctp.c +2 -0
@@ -149,6 +149,8 @@ static int sctp_mt_check(const struct xt {const struct xt_sctp_info *info = par->matchinfo; +if (info->flag_count >ARRAY_SIZE (info->flag_info)) +return -EINVAL ;if (info->flags & ~XT_SCTP_VALID_FLAGS )return -EINVAL ;if (info->invflags & ~XT_SCTP_VALID_FLAGS )
Greg Kroah-Hartman
maintainerPATCH 636/739 skbuff: skb_segment, Call zero copy functions before using skbuff frags
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mohamed Khalfella <[email protected]>
commit 2ea35288c83b3d501a88bc17f2df8f176b5cc96f upstream.
Commit bf5c25d60861 ("skbuff: in skb_segment, call zerocopy functions once per nskb") added the call to zero copy functions in skb_segment(). The change introduced a bug in skb_segment() because skb_orphan_frags() may possibly change the number of fragments or allocate new fragments altogether leaving nrfrags and frag to point to the old values. This can cause a panic with stacktrace like the one below.
[ 193.894380] BUG: kernel NULL pointer dereference, address: 00000000000000bc [ 193.895273] CPU: 13 PID: 18164 Comm: vh-net-17428 Kdump: loaded Tainted: G O 5.15.123+ #26 [ 193.903919] RIP: 0010:skb_segment+0xb0e/0x12f0 [ 194.021892] Call Trace: [ 194.027422] <TASK> [ 194.072861] tcp_gso_segment+0x107/0x540 [ 194.082031] inet_gso_segment+0x15c/0x3d0 [ 194.090783] skb_mac_gso_segment+0x9f/0x110 [ 194.095016] __skb_gso_segment+0xc1/0x190 [ 194.103131] netem_enqueue+0x290/0xb10 [sch_netem] [ 194.107071] dev_qdisc_enqueue+0x16/0x70 [ 194.110884] __dev_queue_xmit+0x63b/0xb30 [ 194.121670] bond_start_xmit+0x159/0x380 [bonding] [ 194.128506] dev_hard_start_xmit+0xc3/0x1e0 [ 194.131787] __dev_queue_xmit+0x8a0/0xb30 [ 194.138225] macvlan_start_xmit+0x4f/0x100 [macvlan] [ 194.141477] dev_hard_start_xmit+0xc3/0x1e0 [ 194.144622] sch_direct_xmit+0xe3/0x280 [ 194.147748] __dev_queue_xmit+0x54a/0xb30 [ 194.154131] tap_get_user+0x2a8/0x9c0 [tap] [ 194.157358] tap_sendmsg+0x52/0x8e0 [tap] [ 194.167049] handle_tx_zerocopy+0x14e/0x4c0 [vhost_net] [ 194.173631] handle_tx+0xcd/0xe0 [vhost_net] [ 194.176959] vhost_worker+0x76/0xb0 [vhost] [ 194.183667] kthread+0x118/0x140 [ 194.190358] ret_from_fork+0x1f/0x30 [ 194.193670] </TASK>
In this case calling skb_orphan_frags() updated nr_frags leaving nrfrags local variable in skb_segment() stale. This resulted in the code hitting i >= nrfrags prematurely and trying to move to next frag_skb using list_skb pointer, which was NULL, and caused kernel panic. Move the call to zero copy functions before using frags and nr_frags.
--- net/core/skbuff.c | 34 ++++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 14 deletions(-)
net/core/skbuff.c +20 -14
@@ -4360,21 +4360,20 @@ struct sk_buff *skb_segment(struct sk_bustruct sk_buff *segs =NULL ;struct sk_buff *tail =NULL ;struct sk_buff *list_skb =skb_shinfo (head_skb)->frag_list; -skb_frag_t *frag =skb_shinfo (head_skb)->frags;unsigned int mss =skb_shinfo (head_skb)->gso_size;unsigned int doffset = head_skb->data -skb_mac_header (head_skb); -struct sk_buff *frag_skb = head_skb;unsigned int offset = doffset;unsigned int tnl_hlen =skb_tnl_header_len (head_skb);unsigned int partial_segs =0 ;unsigned int headroom;unsigned int len = head_skb->len; +struct sk_buff *frag_skb; +skb_frag_t *frag;__be16 proto;bool csum, sg; -int nfrags =skb_shinfo (head_skb)->nr_frags;int err = -ENOMEM ;int i =0 ; -int pos; +int nfrags, pos;if ((skb_shinfo (head_skb)->gso_type &SKB_GSO_DODGY ) && mss !=GSO_BY_FRAGS && mss !=skb_headlen (head_skb)) {
@@ -4451,6 +4450,13 @@ normal: headroom =skb_headroom (head_skb); pos =skb_headlen (head_skb); +if (skb_orphan_frags (head_skb,GFP_ATOMIC )) +return ERR_PTR (-ENOMEM ); + + nfrags =skb_shinfo (head_skb)->nr_frags; + frag =skb_shinfo (head_skb)->frags; + frag_skb = head_skb; + do { struct sk_buff *nskb; skb_frag_t *nskb_frag;
@@ -4471,6 +4477,10 @@ normal: (skb_headlen(list_skb) == len || sg)) {BUG_ON (skb_headlen (list_skb) > len); + nskb =skb_clone (list_skb,GFP_ATOMIC ); +if (unlikely (!nskb)) + goto err; + i =0 ; nfrags =skb_shinfo (list_skb)->nr_frags; frag =skb_shinfo (list_skb)->frags;
@@ -4489,12 +4499,8 @@ normal: frag++; } - nskb =skb_clone (list_skb,GFP_ATOMIC ); list_skb = list_skb->next; -if (unlikely (!nskb)) - goto err; -if (unlikely (pskb_trim (nskb, len))) {kfree_skb (nskb); goto err;
@@ -4570,12 +4576,16 @@ normal:skb_shinfo (nskb)->flags |=skb_shinfo (head_skb)->flags &SKBFL_SHARED_FRAG ; -if (skb_orphan_frags (frag_skb,GFP_ATOMIC ) || -skb_zerocopy_clone (nskb, frag_skb,GFP_ATOMIC )) +if (skb_zerocopy_clone (nskb, frag_skb,GFP_ATOMIC )) goto err;while (pos < offset + len) {if (i >= nfrags) { +if (skb_orphan_frags (list_skb,GFP_ATOMIC ) || +skb_zerocopy_clone (nskb, list_skb, +GFP_ATOMIC )) + goto err; + i =0 ; nfrags =skb_shinfo (list_skb)->nr_frags; frag =skb_shinfo (list_skb)->frags;
@@ -4589,10 +4599,6 @@ normal: i--; frag--; } -if (skb_orphan_frags (frag_skb,GFP_ATOMIC ) || -skb_zerocopy_clone (nskb, frag_skb, -GFP_ATOMIC )) - goto err; list_skb = list_skb->next; }
Greg Kroah-Hartman
maintainerPATCH 637/739 drbd: swap bvec_set_page len and offset
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christoph Böhmwalder <[email protected]>
commit 4b9c2edaf7282d60e069551b4b28abc2932cd3e3 upstream.
bvec_set_page has the following signature:
static inline void bvec_set_page(struct bio_vec *bv, struct page *page,
unsigned int len, unsigned int offset)
However, the usage in DRBD swaps the len and offset parameters. This leads to a bvec with length=0 instead of the intended length=4096, which causes sock_sendmsg to return -EIO.
This leaves DRBD unable to transmit any pages and thus completely broken.
Swapping the parameters fixes the regression.
--- drivers/block/drbd/drbd_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/block/drbd/drbd_main.c +1 -1
@@ -1557,7 +1557,7 @@ static int _drbd_send_page(struct drbd_peer_device *peer_device, struct page *pa do { int sent; - bvec_set_page(&bvec, page, offset, len); + bvec_set_page(&bvec, page, len, offset); iov_iter_bvec(&msg.msg_iter, ITER_SOURCE, &bvec, 1, len); sent = sock_sendmsg(socket, &msg);
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 638/739 gpio: zynq: restore zynq_gpio_irq_reqres/zynq_gpio_irq_relres callbacks
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniel Mack <[email protected]>
commit 180b10bd160b014448366e5bc86e0558f8acb74f upstream.
Commit f56914393537 ("gpio: zynq: fix zynqmp_gpio not an immutable chip warning") ditched the open-coded resource allocation handlers in favor of the generic ones. These generic handlers don't maintain the PM runtime anymore, which causes a regression in that level IRQs are no longer reported.
Restore the original handlers to fix this.
--- drivers/gpio/gpio-zynq.c | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-)
drivers/gpio/gpio-zynq.c +24 -2
@@ -575,6 +575,26 @@ static int zynq_gpio_set_wake(struct irq_data *data, unsigned int on)return 0 ; } +static int zynq_gpio_irq_reqres (struct irq_data *d) +{ +struct gpio_chip *chip =irq_data_get_irq_chip_data (d); +int ret; + + ret =pm_runtime_resume_and_get (chip->parent); +if (ret <0 ) +return ret; + +return gpiochip_reqres_irq (chip, d->hwirq); +} + +static void zynq_gpio_irq_relres (struct irq_data *d) +{ +struct gpio_chip *chip =irq_data_get_irq_chip_data (d); + +gpiochip_relres_irq (chip, d->hwirq); +pm_runtime_put (chip->parent); +} +/* irq chip descriptor */ static const struct irq_chip zynq_gpio_level_irqchip = { .name =DRIVER_NAME ,
@@ -584,9 +604,10 @@ static const struct irq_chip zynq_gpio_level_irqchip = { .irq_unmask = zynq_gpio_irq_unmask, .irq_set_type = zynq_gpio_set_irq_type, .irq_set_wake = zynq_gpio_set_wake, + .irq_request_resources = zynq_gpio_irq_reqres, + .irq_release_resources = zynq_gpio_irq_relres, .flags = IRQCHIP_EOI_THREADED | IRQCHIP_EOI_IF_HANDLED | IRQCHIP_MASK_ON_SUSPEND | IRQCHIP_IMMUTABLE, - GPIOCHIP_IRQ_RESOURCE_HELPERS, };static const struct irq_chip zynq_gpio_edge_irqchip = {
@@ -597,8 +618,9 @@ static const struct irq_chip zynq_gpio_edge_irqchip = { .irq_unmask = zynq_gpio_irq_unmask, .irq_set_type = zynq_gpio_set_irq_type, .irq_set_wake = zynq_gpio_set_wake, + .irq_request_resources = zynq_gpio_irq_reqres, + .irq_release_resources = zynq_gpio_irq_relres, .flags = IRQCHIP_MASK_ON_SUSPEND | IRQCHIP_IMMUTABLE, - GPIOCHIP_IRQ_RESOURCE_HELPERS, }; static void zynq_gpio_handle_bank_irq(struct zynq_gpio *gpio,
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 639/739 igb: set max size RX buffer when store bad packet is enabled
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Radoslaw Tyl <[email protected]>
commit bb5ed01cd2428cd25b1c88a3a9cba87055eb289f upstream.
Increase the RX buffer size to 3K when the SBP bit is on. The size of the RX buffer determines the number of pages allocated which may not be sufficient for receive frames larger than the set MTU size.
--- drivers/net/ethernet/intel/igb/igb_main.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
drivers/net/ethernet/intel/igb/igb_main.c +7 -4
@@ -4814,6 +4814,10 @@ void igb_configure_rx_ring(struct igb_adstatic void igb_set_rx_buffer_len (struct igb_adapter *adapter,struct igb_ring *rx_ring) { +#if (PAGE_SIZE <8192 ) +struct e1000_hw *hw = &adapter->hw; +#endif +/* set build_skb and buffer size flags */ clear_ring_build_skb_enabled (rx_ring);clear_ring_uses_large_buffer (rx_ring);
@@ -4824,10 +4828,9 @@ static void igb_set_rx_buffer_len(structset_ring_build_skb_enabled (rx_ring);#if (PAGE_SIZE <8192 ) -if (adapter->max_frame_size <=IGB_MAX_FRAME_BUILD_SKB ) -return ; - -set_ring_uses_large_buffer (rx_ring); +if (adapter->max_frame_size >IGB_MAX_FRAME_BUILD_SKB || +rd32 (E1000_RCTL ) &E1000_RCTL_SBP ) +set_ring_uses_large_buffer (rx_ring);#endif }
Greg Kroah-Hartman
maintainerPATCH 640/739 parisc: ccio-dma: Create private runway procfs root entry
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Helge Deller <[email protected]>
commit 77e0ddf097d6d4ceaf898e088b133b99e0a97fa0 upstream.
Create an own procfs "runway" root entry for the CCIO driver. No need to share it with the sba_iommu driver, as only one of those busses can be active in one machine anyway.
--- arch/parisc/include/asm/runway.h | 3 --- drivers/parisc/ccio-dma.c | 11 +++++++---- drivers/parisc/sba_iommu.c | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-)
arch/parisc/include/asm/runway.h +0 -3
@@ -2,9 +2,6 @@#ifndef ASM_PARISC_RUNWAY_H #define ASM_PARISC_RUNWAY_H -/* declared in arch/parisc/kernel/setup.c */ -extern struct proc_dir_entry * proc_runway_root; -#define RUNWAY_STATUS 0x10#define RUNWAY_DEBUG 0x40
drivers/parisc/ccio-dma.c +7 -4
@@ -71,8 +71,6 @@#undef CCIO_COLLECT_STATS#endif -#include <asm/runway.h> /* for proc_runway_root */ -#ifdef DEBUG_CCIO_INIT #define DBG_INIT(x...) printk(x)#else
@@ -1567,10 +1565,15 @@ static int __init ccio_probe(struct pari#ifdef CONFIG_PROC_FS if (ioc_count ==0 ) { -proc_create_single (MODULE_NAME ,0 , proc_runway_root, +struct proc_dir_entry *runway; + + runway =proc_mkdir ("bus/runway" ,NULL ); +if (runway) { +proc_create_single (MODULE_NAME ,0 , runway, ccio_proc_info); -proc_create_single (MODULE_NAME "-bitmap" ,0 , proc_runway_root, +proc_create_single (MODULE_NAME "-bitmap" ,0 , runway, ccio_proc_bitmap_info); + } }#endif ioc_count++;
drivers/parisc/sba_iommu.c +1 -1
@@ -121,7 +121,7 @@ module_param(sba_reserve_agpgart, int, 0MODULE_PARM_DESC (sba_reserve_agpgart,"Reserve half of IO pdir as AGPGART" );#endif -struct proc_dir_entry *proc_runway_root__ro_after_init ; +static struct proc_dir_entry *proc_runway_root__ro_after_init ;struct proc_dir_entry *proc_mckinley_root__ro_after_init ;/************************************
Greg Kroah-Hartman
maintainerPATCH 641/739 PM / devfreq: Fix leak in devfreq_dev_release()
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Boris Brezillon <[email protected]>
commit 5693d077595de721f9ddbf9d37f40e5409707dfe upstream.
srcu_init_notifier_head() allocates resources that need to be released with a srcu_cleanup_notifier_head() call.
Reported by kmemleak.
--- drivers/devfreq/devfreq.c | 1 + 1 file changed, 1 insertion(+)
drivers/devfreq/devfreq.c +1 -0
@@ -763,6 +763,7 @@ static void devfreq_dev_release(struct ddev_pm_opp_put_opp_table (devfreq->opp_table);mutex_destroy (&devfreq->lock); +srcu_cleanup_notifier_head (&devfreq->transition_notifier_list);kfree (devfreq); }
Greg Kroah-Hartman
maintainerPATCH 642/739 Multi-gen LRU: fix per-zone reclaim
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kalesh Singh <[email protected]>
commit 669281ee7ef731fb5204df9d948669bf32a5e68d upstream.
MGLRU has a LRU list for each zone for each type (anon/file) in each generation:
long nr_pages[MAX_NR_GENS][ANON_AND_FILE][MAX_NR_ZONES];
The min_seq (oldest generation) can progress independently for each type but the max_seq (youngest generation) is shared for both anon and file. This is to maintain a common frame of reference.
In order for eviction to advance the min_seq of a type, all the per-zone lists in the oldest generation of that type must be empty.
The eviction logic only considers pages from eligible zones for eviction or promotion.
scan_folios() {
...
for (zone = sc->reclaim_idx; zone >= 0; zone--) {
...
sort_folio(); // Promote
...
isolate_folio(); // Evict
}
...
}Consider the system has the movable zone configured and default 4 generations. The current state of the system is as shown below (only illustrating one type for simplicity):
Type: ANON
Zone DMA32 Normal Movable Device
Gen 0 0 0 4GB 0
Gen 1 0 1GB 1MB 0
Gen 2 1MB 4GB 1MB 0
Gen 3 1MB 1MB 1MB 0
Now consider there is a GFP_KERNEL allocation request (eligible zone index <= Normal), evict_folios() will return without doing any work since there are no pages to scan in the eligible zones of the oldest generation. Reclaim won't make progress until triggered from a ZONE_MOVABLE allocation request; which may not happen soon if there is a lot of free memory in the movable zone. This can lead to OOM kills, although there is 1GB pages in the Normal zone of Gen 1 that we have not yet tried to reclaim.
This issue is not seen in the conventional active/inactive LRU since there are no per-zone lists.
If there are no (not enough) folios to scan in the eligible zones, move folios from ineligible zone (zone_index > reclaim_index) to the next generation. This allows for the progression of min_seq and reclaiming from the next generation (Gen 1).
Qualcomm, Mediatek and raspberrypi [1] discovered this issue independently.
[1] https://github.com/raspberrypi/linux/issues/5395
--- mm/vmscan.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-)
mm/vmscan.c +14 -4
@@ -4891,7 +4891,8 @@ static int lru_gen_memcg_seg(struct lruv* the eviction ******************************************************************************/ -static bool sort_folio (struct lruvec *lruvec,struct folio *folio,int tier_idx) +static bool sort_folio (struct lruvec *lruvec,struct folio *folio,struct scan_control *sc, +int tier_idx) {bool success;int gen =folio_lru_gen (folio);
@@ -4941,6 +4942,13 @@ static bool sort_folio(struct lruvec *lrreturn true; } +/* ineligible */ +if (zone > sc->reclaim_idx) { + gen =folio_inc_gen (lruvec, folio, false); +list_move_tail (&folio->lru, &lrugen->folios[gen][type][zone]); +return true; + } +/* waiting for writeback */ if (folio_test_locked (folio) ||folio_test_writeback (folio) || (type ==LRU_GEN_FILE &&folio_test_dirty (folio))) {
@@ -4989,7 +4997,8 @@ static bool isolate_folio(struct lruvecstatic int scan_folios (struct lruvec *lruvec,struct scan_control *sc,int type,int tier,struct list_head *list) { -int gen, zone; +int i; +int gen;enum vm_event_item item;int sorted =0 ;int scanned =0 ;
@@ -5005,9 +5014,10 @@ static int scan_folios(struct lruvec *lr gen =lru_gen_from_seq (lrugen->min_seq[type]); -for (zone = sc->reclaim_idx; zone >=0 ; zone--) { +for (i =MAX_NR_ZONES ; i >0 ; i--) {LIST_HEAD (moved);int skipped =0 ; +int zone = (sc->reclaim_idx + i) %MAX_NR_ZONES ;struct list_head *head = &lrugen->folios[gen][type][zone];while (!list_empty (head)) {
@@ -5021,7 +5031,7 @@ static int scan_folios(struct lruvec *lr scanned += delta; -if (sort_folio (lruvec, folio, tier)) +if (sort_folio (lruvec, folio, sc, tier)) sorted += delta;else if (isolate_folio (lruvec, folio, sc)) {list_add (&folio->lru, list);
Greg Kroah-Hartman
maintainerPATCH 643/739 ALSA: pcm: Fix missing fixup call in compat hw_refine ioctl
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
commit 358040e3807754944dbddf948a23c6d914297ed7 upstream.
The update of rate_num/den and msbits were factored out to fixup_unreferenced_params() function to be called explicitly after the hw_refine or hw_params procedure. It's called from snd_pcm_hw_refine_user(), but it's forgotten in the PCM compat ioctl. This ended up with the incomplete rate_num/den and msbits parameters when 32bit compat ioctl is used.
This patch adds the missing call in snd_pcm_ioctl_hw_params_compat().
--- sound/core/pcm_compat.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
sound/core/pcm_compat.c +6 -2
@@ -253,10 +253,14 @@ static int snd_pcm_ioctl_hw_params_compa goto error; } -if (refine) +if (refine) { err =snd_pcm_hw_refine (substream, data); -else +if (err <0 ) + goto error; + err =fixup_unreferenced_params (substream, data); + }else { err =snd_pcm_hw_params (substream, data); + }if (err <0 ) goto error; if (copy_to_user(data32, data, sizeof(*data32)) ||
Greg Kroah-Hartman
maintainerPATCH 644/739 virtio_pmem: add the missing REQ_OP_WRITE for flush bio
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hou Tao <[email protected]>
commit c1dbd8a849183b9c12d257ad3043ecec50db50b3 upstream.
When doing mkfs.xfs on a pmem device, the following warning was reported:
------------[ cut here ]------------ WARNING: CPU: 2 PID: 384 at block/blk-core.c:751 submit_bio_noacct Modules linked in: CPU: 2 PID: 384 Comm: mkfs.xfs Not tainted 6.4.0-rc7+ #154 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996) RIP: 0010:submit_bio_noacct+0x340/0x520 ...... Call Trace: <TASK> ? submit_bio_noacct+0xd5/0x520 submit_bio+0x37/0x60 async_pmem_flush+0x79/0xa0 nvdimm_flush+0x17/0x40 pmem_submit_bio+0x370/0x390 __submit_bio+0xbc/0x190 submit_bio_noacct_nocheck+0x14d/0x370 submit_bio_noacct+0x1ef/0x520 submit_bio+0x55/0x60 submit_bio_wait+0x5a/0xc0 blkdev_issue_flush+0x44/0x60
The root cause is that submit_bio_noacct() needs bio_op() is either WRITE or ZONE_APPEND for flush bio and async_pmem_flush() doesn't assign REQ_OP_WRITE when allocating flush bio, so submit_bio_noacct just fail the flush bio.
Simply fix it by adding the missing REQ_OP_WRITE for flush bio. And we could fix the flush order issue and do flush optimization later.
--- drivers/nvdimm/nd_virtio.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/nvdimm/nd_virtio.c +2 -1
@@ -105,7 +105,8 @@ int async_pmem_flush(struct nd_region *n* parent bio. Otherwise directly call nd_region flush. */ if (bio && bio->bi_iter.bi_sector !=-1 ) { -struct bio *child =bio_alloc (bio->bi_bdev,0 ,REQ_PREFLUSH , +struct bio *child =bio_alloc (bio->bi_bdev,0 , +REQ_OP_WRITE |REQ_PREFLUSH ,GFP_ATOMIC );if (!child)
Greg Kroah-Hartman
maintainerPATCH 645/739 rcu: dump vmalloc memory info safely
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zqiang <[email protected]>
commit c83ad36a18c02c0f51280b50272327807916987f upstream.
Currently, for double invoke call_rcu(), will dump rcu_head objects memory info, if the objects is not allocated from the slab allocator, the vmalloc_dump_obj() will be invoke and the vmap_area_lock spinlock need to be held, since the call_rcu() can be invoked in interrupt context, therefore, there is a possibility of spinlock deadlock scenarios.
And in Preempt-RT kernel, the rcutorture test also trigger the following lockdep warning:
BUG: sleeping function called from invalid context at kernel/locking/spinlock_rt.c:48
in_atomic(): 1, irqs_disabled(): 1, non_block: 0, pid: 1, name: swapper/0preempt_count: 1, expected: 0
RCU nest depth: 1, expected: 1
3 locks held by swapper/0/1:
#0: ffffffffb534ee80 (fullstop_mutex){+.+.}-{4:4}, at: torture_init_begin+0x24/0xa0 #1: ffffffffb5307940 (rcu_read_lock){....}-{1:3}, at: rcu_torture_init+0x1ec7/0x2370 #2: ffffffffb536af40 (vmap_area_lock){+.+.}-{3:3}, at: find_vmap_area+0x1f/0x70
irq event stamp: 565512 hardirqs last enabled at (565511): [<ffffffffb379b138>] __call_rcu_common+0x218/0x940 hardirqs last disabled at (565512): [<ffffffffb5804262>] rcu_torture_init+0x20b2/0x2370 softirqs last enabled at (399112): [<ffffffffb36b2586>] __local_bh_enable_ip+0x126/0x170 softirqs last disabled at (399106): [<ffffffffb43fef59>] inet_register_protosw+0x9/0x1d0 Preemption disabled at: [<ffffffffb58040c3>] rcu_torture_init+0x1f13/0x2370 CPU: 0 PID: 1 Comm: swapper/0 Tainted: G W 6.5.0-rc4-rt2-yocto-preempt-rt+ #15 Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS rel-1.16.2-0-gea1b7a073390-prebuilt.qemu.org 04/01/2014 Call Trace: <TASK> dump_stack_lvl+0x68/0xb0 dump_stack+0x14/0x20 __might_resched+0x1aa/0x280 ? __pfx_rcu_torture_err_cb+0x10/0x10 rt_spin_lock+0x53/0x130 ? find_vmap_area+0x1f/0x70 find_vmap_area+0x1f/0x70 vmalloc_dump_obj+0x20/0x60 mem_dump_obj+0x22/0x90 __call_rcu_common+0x5bf/0x940 ? debug_smp_processor_id+0x1b/0x30 call_rcu_hurry+0x14/0x20 rcu_torture_init+0x1f82/0x2370 ? __pfx_rcu_torture_leak_cb+0x10/0x10 ? __pfx_rcu_torture_leak_cb+0x10/0x10 ? __pfx_rcu_torture_init+0x10/0x10 do_one_initcall+0x6c/0x300 ? debug_smp_processor_id+0x1b/0x30 kernel_init_freeable+0x2b9/0x540 ? __pfx_kernel_init+0x10/0x10 kernel_init+0x1f/0x150 ret_from_fork+0x40/0x50 ? __pfx_kernel_init+0x10/0x10 ret_from_fork_asm+0x1b/0x30 </TASK>
The previous patch fixes this by using the deadlock-safe best-effort version of find_vm_area. However, in case of failure print the fact that the pointer was a vmalloc pointer so that we print at least something.
--- mm/util.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
mm/util.c +3 -1
@@ -1071,7 +1071,9 @@ void mem_dump_obj(void *object)if (vmalloc_dump_obj (object))return ; -if (virt_addr_valid (object)) +if (is_vmalloc_addr (object)) + type ="vmalloc memory" ; +else if (virt_addr_valid (object)) type ="non-slab/vmalloc memory" ;else if (object ==NULL ) type ="NULL pointer" ;
Greg Kroah-Hartman
maintainerPATCH 646/739 printk: ringbuffer: Fix truncating buffer size min_t cast
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kees Cook <[email protected]>
commit 53e9e33ede37a247d926db5e4a9e56b55204e66c upstream.
If an output buffer size exceeded U16_MAX, the min_t(u16, ...) cast in copy_data() was causing writes to truncate. This manifested as output bytes being skipped, seen as %NUL bytes in pstore dumps when the available record size was larger than 65536. Fix the cast to no longer truncate the calculation.
--- kernel/printk/printk_ringbuffer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/printk/printk_ringbuffer.c +1 -1
@@ -1735,7 +1735,7 @@ static bool copy_data(struct prb_data_riif (!buf || !buf_size)return true; - data_size =min_t (u16, buf_size, len); + data_size = min_t(unsigned int, buf_size, len);memcpy (&buf[0 ], data, data_size);/* LMM(copy_data:A) */ return true;
Greg Kroah-Hartman
maintainerPATCH 647/739 scsi: core: Fix the scsi_set_resid() documentation
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bart Van Assche <[email protected]>
commit f669b8a683e4ee26fa5cafe19d71cec1786b556a upstream.
Because scsi_finish_command() subtracts the residual from the buffer length, residual overflows must not be reported. Reflect this in the SCSI documentation. See also commit 9237f04e12cc ("scsi: core: Fix scsi_get/set_resid() interface")
--- Documentation/scsi/scsi_mid_low_api.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Documentation/scsi/scsi_mid_low_api.rst +2 -2
@@ -1190,11 +1190,11 @@ Members of interest: - pointer to scsi_device object that this command is associated with. resid - - an LLD should set this signed integer to the requested + - an LLD should set this unsigned integer to the requested transfer length (i.e. 'request_bufflen') less the number of bytes that are actually transferred. 'resid' is preset to 0 so an LLD can ignore it if it cannot detect - underruns (overruns should be rare). If possible an LLD + underruns (overruns should not be reported). An LLD should set 'resid' prior to invoking 'done'. The most interesting case is data transfers from a SCSI target device (e.g. READs) that underrun.
Greg Kroah-Hartman
maintainerPATCH 648/739 mm/vmalloc: add a safer version of find_vm_area() for debug
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Joel Fernandes (Google) <[email protected]>
commit 0818e739b5c061b0251c30152380600fb9b84c0c upstream.
It is unsafe to dump vmalloc area information when trying to do so from some contexts. Add a safer trylock version of the same function to do a best-effort VMA finding and use it from vmalloc_dump_obj().
--- mm/vmalloc.c | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-)
mm/vmalloc.c +22 -4
@@ -4278,14 +4278,32 @@ void pcpu_free_vm_areas(struct vm_struct#ifdef CONFIG_PRINTK bool vmalloc_dump_obj (void *object) { -struct vm_struct *vm;void *objp = (void *)PAGE_ALIGN ((unsigned long )object); +const void *caller; +struct vm_struct *vm; +struct vmap_area *va; +unsigned long addr; +unsigned int nr_pages; + +if (!spin_trylock (&vmap_area_lock)) +return false; + va =__find_vmap_area ((unsigned long )objp, &vmap_area_root); +if (!va) { +spin_unlock (&vmap_area_lock); +return false; + } - vm =find_vm_area (objp); -if (!vm) + vm = va->vm; +if (!vm) { +spin_unlock (&vmap_area_lock);return false; + } + addr = (unsigned long )vm->addr; + caller = vm->caller; + nr_pages = vm->nr_pages; +spin_unlock (&vmap_area_lock);pr_cont (" %u-page vmalloc region starting at %#lx allocated at %pS\n" , - vm->nr_pages, (unsigned long )vm->addr, vm->caller); + nr_pages, addr, caller);return true; }#endif
Greg Kroah-Hartman
maintainerPATCH 649/739 cpu/hotplug: Prevent self deadlock on CPU hot-unplug
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Gleixner <[email protected]>
commit 2b8272ff4a70b866106ae13c36be7ecbef5d5da2 upstream.
Xiongfeng reported and debugged a self deadlock of the task which initiates and controls a CPU hot-unplug operation vs. the CFS bandwidth timer.
CPU1 CPU2
T1 sets cfs_quota
starts hrtimer cfs_bandwidth 'period_timer'
T1 is migrated to CPU2
T1 initiates offlining of CPU1
Hotplug operation starts
...
'period_timer' expires and is re-enqueued on CPU1
...take_cpu_down()
CPU1 shuts down and does not handle timers
anymore. They have to be migrated in the
post dead hotplug steps by the control task.
T1 runs the post dead offline operation T1 is scheduled out
T1 waits for 'period_timer' to expire
T1 waits there forever if it is scheduled out before it can execute the hrtimer offline callback hrtimers_dead_cpu().
Cure this by delegating the hotplug control operation to a worker thread on an online CPU. This takes the initiating user space task, which might be affected by the bandwidth timer, completely out of the picture.
--- kernel/cpu.c | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-)
kernel/cpu.c +23 -1
@@ -1467,8 +1467,22 @@ out:return ret; } +struct cpu_down_work { +unsigned int cpu; +enum cpuhp_state target; +}; + +static long __cpu_down_maps_locked (void *arg) +{ +struct cpu_down_work *work = arg; + +return _cpu_down (work->cpu,0 , work->target); +} +static int cpu_down_maps_locked (unsigned int cpu,enum cpuhp_state target) { +struct cpu_down_work work = { .cpu = cpu, .target = target, }; +/* * If the platform does not support hotplug, report it explicitly to * differentiate it from a transient offlining failure.
@@ -1477,7 +1491,15 @@ static int cpu_down_maps_locked(unsignedreturn -EOPNOTSUPP ;if (cpu_hotplug_disabled)return -EBUSY ; -return _cpu_down (cpu,0 , target); + +/* +* Ensure that the control task does not run on the to be offlined +* CPU to prevent a deadlock against cfs_b->period_timer. +*/ + cpu =cpumask_any_but (cpu_online_mask, cpu); +if (cpu >= nr_cpu_ids) +return -EBUSY ; +return work_on_cpu (cpu, __cpu_down_maps_locked, &work); }static int cpu_down (unsigned int cpu,enum cpuhp_state target)
Greg Kroah-Hartman
maintainerPATCH 650/739 media: i2c: ccs: Check rules is non-NULL
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sakari Ailus <[email protected]>
commit 607bcc4213d998d051541d8f10b5bbb7d546c0be upstream.
Fix the following smatch warning:
drivers/media/i2c/ccs/ccs-data.c:524 ccs_data_parse_rules() warn: address of NULL pointer 'rules'
The CCS static data rule parser does not check an if rule has been obtained before checking for other rule types (which depend on the if rule). In practice this means parsing invalid CCS static data could lead to dereferencing a NULL pointer.
--- drivers/media/i2c/ccs/ccs-data.c | 101 +++++++++++++++++++++------------------ 1 file changed, 56 insertions(+), 45 deletions(-)
drivers/media/i2c/ccs/ccs-data.c +56 -45
@@ -464,8 +464,7 @@ static int ccs_data_parse_rules(struct b rule_payload = __rule_type +1 ; rule_plen2 = rule_plen -sizeof (*__rule_type); -switch (*__rule_type) { -case CCS_DATA_BLOCK_RULE_ID_IF : { +if (*__rule_type ==CCS_DATA_BLOCK_RULE_ID_IF ) {const struct __ccs_data_block_rule_if *__if_rules = rule_payload; const size_t __num_if_rules =
@@ -514,49 +513,61 @@ static int ccs_data_parse_rules(struct b rules->if_rules = if_rule; rules->num_if_rules = __num_if_rules; } -break ; - } -case CCS_DATA_BLOCK_RULE_ID_READ_ONLY_REGS : - rval =ccs_data_parse_reg_rules (bin, &rules->read_only_regs, - &rules->num_read_only_regs, - rule_payload, - rule_payload + rule_plen2, - dev); -if (rval) -return rval; -break ; -case CCS_DATA_BLOCK_RULE_ID_FFD : - rval =ccs_data_parse_ffd (bin, &rules->frame_format, - rule_payload, - rule_payload + rule_plen2, - dev); -if (rval) -return rval; -break ; -case CCS_DATA_BLOCK_RULE_ID_MSR : - rval =ccs_data_parse_reg_rules (bin, - &rules->manufacturer_regs, - &rules->num_manufacturer_regs, - rule_payload, - rule_payload + rule_plen2, - dev); -if (rval) -return rval; -break ; -case CCS_DATA_BLOCK_RULE_ID_PDAF_READOUT : - rval =ccs_data_parse_pdaf_readout (bin, - &rules->pdaf_readout, - rule_payload, - rule_payload + rule_plen2, - dev); -if (rval) -return rval; -break ; -default : -dev_dbg (dev, -"Don't know how to handle rule type %u!\n" , - *__rule_type); -return -EINVAL ; + }else { +/* Check there was an if rule before any other rules */ +if (bin->base && !rules) +return -EINVAL ; + +switch (*__rule_type) { +case CCS_DATA_BLOCK_RULE_ID_READ_ONLY_REGS : + rval =ccs_data_parse_reg_rules (bin, + rules ? + &rules->read_only_regs :NULL , + rules ? + &rules->num_read_only_regs :NULL , + rule_payload, + rule_payload + rule_plen2, + dev); +if (rval) +return rval; +break ; +case CCS_DATA_BLOCK_RULE_ID_FFD : + rval =ccs_data_parse_ffd (bin, rules ? + &rules->frame_format :NULL , + rule_payload, + rule_payload + rule_plen2, + dev); +if (rval) +return rval; +break ; +case CCS_DATA_BLOCK_RULE_ID_MSR : + rval =ccs_data_parse_reg_rules (bin, + rules ? + &rules->manufacturer_regs :NULL , + rules ? + &rules->num_manufacturer_regs :NULL , + rule_payload, + rule_payload + rule_plen2, + dev); +if (rval) +return rval; +break ; +case CCS_DATA_BLOCK_RULE_ID_PDAF_READOUT : + rval =ccs_data_parse_pdaf_readout (bin, + rules ? + &rules->pdaf_readout :NULL , + rule_payload, + rule_payload + rule_plen2, + dev); +if (rval) +return rval; +break ; +default : +dev_dbg (dev, +"Don't know how to handle rule type %u!\n" , + *__rule_type); +return -EINVAL ; + } } __next_rule = __next_rule + rule_hlen + rule_plen; }
Greg Kroah-Hartman
maintainerPATCH 651/739 media: i2c: Add a camera sensor top level menu
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sakari Ailus <[email protected]>
commit 7d3c7d2a2914e10bec3b9cdacdadb8e1f65f715a upstream.
Select V4L2_FWNODE and VIDEO_V4L2_SUBDEV_API for all sensor drivers. This also adds the options to drivers that don't specifically need them, these are still seldom used drivers using old APIs. The upside is that these should now all compile --- many drivers have had missing dependencies.
The "menu" is replaced by selectable "menuconfig" to select the needed V4L2_FWNODE and VIDEO_V4L2_SUBDEV_API options.
Also select MEDIA_CONTROLLER which VIDEO_V4L2_SUBDEV_API effectively depends on, and add the I2C dependency to the menu.
--- drivers/media/i2c/Kconfig | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-)
drivers/media/i2c/Kconfig +10 -3
@@ -25,8 +25,15 @@ config VIDEO_IR_I2C # V4L2 I2C drivers that are related with Camera support # -menu "Camera sensor devices" - visible if MEDIA_CAMERA_SUPPORT +menuconfig VIDEO_CAMERA_SENSOR + bool "Camera sensor devices" + depends on MEDIA_CAMERA_SUPPORT && I2C + select MEDIA_CONTROLLER + select V4L2_FWNODE + select VIDEO_V4L2_SUBDEV_API + default y + +if VIDEO_CAMERA_SENSOR config VIDEO_APTINA_PLL tristate
@@ -810,7 +817,7 @@ config VIDEO_ST_VGXY61 source "drivers/media/i2c/ccs/Kconfig" source "drivers/media/i2c/et8ek8/Kconfig" -endmenu +endif menu "Lens drivers" visible if MEDIA_CAMERA_SUPPORT
Greg Kroah-Hartman
maintainerPATCH 652/739 PCI: rockchip: Use 64-bit mask on MSI 64-bit PCI address
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rick Wertenbroek <[email protected]>
commit cdb50033dd6dfcf02ae3d4ee56bc1a9555be6d36 upstream.
A 32-bit mask was used on the 64-bit PCI address used for mapping MSIs. This would result in the upper 32 bits being unintentionally zeroed and MSIs getting mapped to incorrect PCI addresses if the address had any of the upper bits set.
Replace 32-bit mask by appropriate 64-bit mask.
--- drivers/pci/controller/pcie-rockchip.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/pci/controller/pcie-rockchip.h +3 -3
@@ -158,7 +158,9 @@#define PCIE_RC_CONFIG_THP_CAP (PCIE_RC_CONFIG_BASE + 0x274)#define PCIE_RC_CONFIG_THP_CAP_NEXT_MASK GENMASK(31, 20) -#define PCIE_ADDR_MASK 0xffffff00 +#define MAX_AXI_IB_ROOTPORT_REGION_NUM 3 +#define MIN_AXI_ADDR_BITS_PASSED 8 +#define PCIE_ADDR_MASK GENMASK_ULL(63, MIN_AXI_ADDR_BITS_PASSED)#define PCIE_CORE_AXI_CONF_BASE 0xc00000#define PCIE_CORE_OB_REGION_ADDR0 (PCIE_CORE_AXI_CONF_BASE + 0x0)#define PCIE_CORE_OB_REGION_ADDR0_NUM_BITS 0x3f
@@ -185,8 +187,6 @@#define AXI_WRAPPER_TYPE1_CFG 0xb#define AXI_WRAPPER_NOR_MSG 0xc -#define MAX_AXI_IB_ROOTPORT_REGION_NUM 3 -#define MIN_AXI_ADDR_BITS_PASSED 8#define PCIE_RC_SEND_PME_OFF 0x11960#define ROCKCHIP_VENDOR_ID 0x1d87#define PCIE_LINK_IS_L2 (x) \
Greg Kroah-Hartman
maintainerPATCH 653/739 ipmi_si: fix a memleak in try_smi_init()
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yi Yang <[email protected]>
commit 6cf1a126de2992b4efe1c3c4d398f8de4aed6e3f upstream.
Kmemleak reported the following leak info in try_smi_init():
unreferenced object 0xffff00018ecf9400 (size 1024):
comm "modprobe", pid 2707763, jiffies 4300851415 (age 773.308s) backtrace:
[<000000004ca5b312>] __kmalloc+0x4b8/0x7b0
[<00000000953b1072>] try_smi_init+0x148/0x5dc [ipmi_si]
[<000000006460d325>] 0xffff800081b10148
[<0000000039206ea5>] do_one_initcall+0x64/0x2a4
[<00000000601399ce>] do_init_module+0x50/0x300
[<000000003c12ba3c>] load_module+0x7a8/0x9e0
[<00000000c246fffe>] __se_sys_init_module+0x104/0x180
[<00000000eea99093>] __arm64_sys_init_module+0x24/0x30
[<0000000021b1ef87>] el0_svc_common.constprop.0+0x94/0x250
[<0000000070f4f8b7>] do_el0_svc+0x48/0xe0
[<000000005a05337f>] el0_svc+0x24/0x3c
[<000000005eb248d6>] el0_sync_handler+0x160/0x164
[<0000000030a59039>] el0_sync+0x160/0x180The problem was that when an error occurred before handlers registration and after allocating new_smi->si_sm, the variable wouldn't be freed in the error handling afterwards since shutdown_smi() hadn't been registered yet. Fix it by adding a kfree() in the error handling path in try_smi_init().
Message-Id: <[email protected]>
--- drivers/char/ipmi/ipmi_si_intf.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/char/ipmi/ipmi_si_intf.c +5 -0
@@ -2082,6 +2082,11 @@ static int try_smi_init(struct smi_info new_smi->io.io_cleanup =NULL ; } +if (rv && new_smi->si_sm) { +kfree (new_smi->si_sm); + new_smi->si_sm =NULL ; + } +return rv; }
Greg Kroah-Hartman
maintainerPATCH 654/739 ARM: OMAP2+: Fix -Warray-bounds warning in _pwrdm_state_switch()
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gustavo A. R. Silva <[email protected]>
commit 847fb80cc01a54bc827b02547bb8743bdb59ddab upstream.
If function pwrdm_read_prev_pwrst() returns -EINVAL, we will end up accessing array pwrdm->state_counter through negative index -22. This is wrong and the compiler is legitimately warning us about this potential problem.
Fix this by sanity checking the value stored in variable _prev_ before accessing array pwrdm->state_counter.
Address the following -Warray-bounds warning:arch/arm/mach-omap2/powerdomain.c:178:45: warning: array subscript -22 is below array bounds of 'unsigned int[4]' [-Warray-bounds]
Message-ID: <ZIFVGwImU3kpaGeH@work>
--- arch/arm/mach-omap2/powerdomain.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/mach-omap2/powerdomain.c +1 -1
@@ -174,7 +174,7 @@ static int _pwrdm_state_switch(struct pobreak ;case PWRDM_STATE_PREV : prev =pwrdm_read_prev_pwrst (pwrdm); -if (pwrdm->state != prev) +if (prev >=0 && pwrdm->state != prev) pwrdm->state_counter[prev]++;if (prev ==PWRDM_POWER_RET )_update_logic_membank_counters (pwrdm);
Greg Kroah-Hartman
maintainerPATCH 655/739 riscv: Move create_tmp_mapping() to init sections
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexandre Ghiti <[email protected]>
commit 9bdd924803787ceeb10f1ea399e91d75fb05d3a7 upstream.
This function is only used at boot time so mark it as __init.
--- arch/riscv/mm/kasan_init.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/riscv/mm/kasan_init.c +1 -1
@@ -438,7 +438,7 @@ static void __init kasan_shallow_populatkasan_shallow_populate_pgd (vaddr, vend); } -static void create_tmp_mapping (void ) +static void __init create_tmp_mapping (void ) {void *ptr;p4d_t *base_p4d;
Greg Kroah-Hartman
maintainerPATCH 656/739 riscv: Mark KASAN tmp* page tables variables as static
In reply to Greg Kroah-Hartman6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexandre Ghiti <[email protected]>
commit dd7664d67b478afeb79a89e4586c2cd7707d17d6 upstream.
tmp_pg_dir, tmp_p4d and tmp_pud are only used in kasan_init.c so they should be declared as static.
--- arch/riscv/mm/kasan_init.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
arch/riscv/mm/kasan_init.c +3 -3
@@ -22,9 +22,9 @@* region is not and then we have to go down to the PUD level. */ -pgd_t tmp_pg_dir[PTRS_PER_PGD] __page_aligned_bss; -p4d_t tmp_p4d[PTRS_PER_P4D] __page_aligned_bss; -pud_t tmp_pud[PTRS_PER_PUD] __page_aligned_bss; +static pgd_t tmp_pg_dir[PTRS_PER_PGD] __page_aligned_bss; +static p4d_t tmp_p4d[PTRS_PER_P4D] __page_aligned_bss; +static pud_t tmp_pud[PTRS_PER_PUD] __page_aligned_bss;static void __init kasan_populate_pte (pmd_t *pmd,unsigned long vaddr,unsigned long end) {