iommu/amd: Fix the configuration of GCR3 table root pointer
Subsystems (18)
Sasha Levin
maintainerPATCH 1/75 iommu/amd: Fix the configuration of GCR3 table root pointer
From: Adrian Huang <[email protected]>
[ Upstream commit c20f36534666e37858a14e591114d93cc1be0d34 ]
The SPA of the GCR3 table root pointer[51:31] masks 20 bits. However, this requires 21 bits (Please see the AMD IOMMU specification). This leads to the potential failure when the bit 51 of SPA of the GCR3 table root pointer is 1'.
--- drivers/iommu/amd_iommu_types.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iommu/amd_iommu_types.h +1 -1
@@ -348,7 +348,7 @@#define DTE_GCR3_VAL_A (x) (((x) >> 12) & 0x00007ULL)#define DTE_GCR3_VAL_B (x) (((x) >> 15) & 0x0ffffULL) -#define DTE_GCR3_VAL_C (x) (((x) >> 31) & 0xfffffULL) +#define DTE_GCR3_VAL_C (x) (((x) >> 31) & 0x1fffffULL)#define DTE_GCR3_INDEX_A 0#define DTE_GCR3_INDEX_B 1
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 2/75 tools/testing/nvdimm: Fix compilation failure without CONFIG_DEV_DAX_PMEM_COMPAT
From: Jan Kara <[email protected]>
[ Upstream commit c0e71d602053e4e7637e4bc7d0bc9603ea77a33f ]
When a kernel is configured without CONFIG_DEV_DAX_PMEM_COMPAT, the compilation of tools/testing/nvdimm fails with:
Building modules, stage 2.
MODPOST 11 modules
ERROR: "dax_pmem_compat_test" [tools/testing/nvdimm/test/nfit_test.ko] undefined!
Fix the problem by calling dax_pmem_compat_test() only if the kernel has the required functionality.
--- tools/testing/nvdimm/test/nfit.c | 2 ++ 1 file changed, 2 insertions(+)
tools/testing/nvdimm/test/nfit.c +2 -0
@@ -3164,7 +3164,9 @@ static __init int nfit_test_init(void)mcsafe_test ();dax_pmem_test ();dax_pmem_core_test (); +#ifdef CONFIG_DEV_DAX_PMEM_COMPAT dax_pmem_compat_test (); +#endif nfit_test_setup (nfit_test_lookup, nfit_test_evaluate_dsm);
Signature · 4 lines
2.20.1 _______________________________________________ Linux-nvdimm mailing list -- [email protected] To unsubscribe send an email to [email protected]
Sasha Levin
maintainerPATCH 3/75 watchdog: reset last_hw_keepalive time at start
In reply to Sasha LevinFrom: Tero Kristo <[email protected]>
[ Upstream commit 982bb70517aef2225bad1d802887b733db492cc0 ]
Currently the watchdog core does not initialize the last_hw_keepalive time during watchdog startup. This will cause the watchdog to be pinged immediately if enough time has passed from the system boot-up time, and some types of watchdogs like K3 RTI does not like this.
To avoid the issue, setup the last_hw_keepalive time during watchdog startup.
--- drivers/watchdog/watchdog_dev.c | 1 + 1 file changed, 1 insertion(+)
drivers/watchdog/watchdog_dev.c +1 -0
@@ -282,6 +282,7 @@ static int watchdog_start(struct watchdog_device *wdd)if (err ==0 ) {set_bit (WDOG_ACTIVE , &wdd->status); wd_data->last_keepalive = started_at; + wd_data->last_hw_keepalive = started_at;watchdog_update_worker (wdd); }
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 4/75 ovl: fix value of i_ino for lower hardlink corner case
In reply to Sasha LevinFrom: Amir Goldstein <[email protected]>
[ Upstream commit 300b124fcf6ad2cd99a7b721e0f096785e0a3134 ]
Commit 6dde1e42f497 ("ovl: make i_ino consistent with st_ino in more cases"), relaxed the condition nfs_export=on in order to set the value of i_ino to xino map of real ino.
Specifically, it also relaxed the pre-condition that index=on for consistent i_ino. This opened the corner case of lower hardlink in ovl_get_inode(), which calls ovl_fill_inode() with ino=0 and then ovl_init_inode() is called to set i_ino to lower real ino without the xino mapping.
Pass the correct values of ino;fsid in this case to ovl_fill_inode(), so it can initialize i_ino correctly.
--- fs/overlayfs/inode.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
fs/overlayfs/inode.c +3 -1
@@ -881,7 +881,7 @@ struct inode *ovl_get_inode(struct super_block *sb,struct dentry *lowerdentry = lowerpath ? lowerpath->dentry :NULL ;bool bylower =ovl_hash_bylower (sb, upperdentry, lowerdentry, oip->index); -int fsid = bylower ? oip->lowerpath->layer->fsid :0 ; +int fsid = bylower ? lowerpath->layer->fsid :0 ;bool is_dir, metacopy = false;unsigned long ino =0 ;int err = oip->newinode ? -EEXIST : -ENOMEM ;
@@ -931,6 +931,8 @@ struct inode *ovl_get_inode(struct super_block *sb, err = -ENOMEM ; goto out_err; } + ino = realinode->i_ino; + fsid = lowerpath->layer->fsid; }ovl_fill_inode (inode, realinode->i_mode, realinode->i_rdev, ino, fsid);ovl_inode_init (inode, upperdentry, lowerdentry, oip->lowerdata);
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 5/75 iommu/vt-d: Fix page request descriptor size
In reply to Sasha LevinFrom: Jacob Pan <[email protected]>
[ Upstream commit 52355fb1919ef7ed9a38e0f3de6e928de1f57217 ]
Intel VT-d might support PRS (Page Reqest Support) when it's running in the scalable mode. Each page request descriptor occupies 32 bytes and is 32-bytes aligned. The page request descriptor offset mask should be 32-bytes aligned.
--- drivers/iommu/intel-svm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iommu/intel-svm.c +1 -1
@@ -502,7 +502,7 @@ struct page_req_dsc {u64 priv_data[2 ]; }; -#define PRQ_RING_MASK ((0x1000 << PRQ_ORDER) - 0x10) +#define PRQ_RING_MASK ((0x1000 << PRQ_ORDER) - 0x20)static bool access_error (struct vm_area_struct *vma,struct page_req_dsc *req) {
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 6/75 acpi/nfit: improve bounds checking for 'func'
In reply to Sasha LevinFrom: Dan Carpenter <[email protected]>
[ Upstream commit 01091c496f920e634ea84b689f480c39016752a8 ]
The 'func' variable can come from the user in the __nd_ioctl(). If it's too high then the (1 << func) shift in acpi_nfit_clear_to_send() is undefined. In acpi_nfit_ctl() we pass 'func' to test_bit(func, &dsm_mask) which could result in an out of bounds access.
To fix these issues, I introduced the NVDIMM_CMD_MAX (31) define and updated nfit_dsm_revid() to use that define as well instead of magic numbers.
--- drivers/acpi/nfit/core.c | 10 ++++++---- drivers/acpi/nfit/nfit.h | 1 + 2 files changed, 7 insertions(+), 4 deletions(-)
drivers/acpi/nfit/core.c +6 -4
@@ -360,7 +360,7 @@ static union acpi_object *acpi_label_info(acpi_handle handle)static u8 nfit_dsm_revid (unsigned family,unsigned func) { -static const u8 revid_table[NVDIMM_FAMILY_MAX +1 ][32 ] = { +static const u8 revid_table[NVDIMM_FAMILY_MAX +1 ][NVDIMM_CMD_MAX +1 ] = { [NVDIMM_FAMILY_INTEL ] = { [NVDIMM_INTEL_GET_MODES ] =2 , [NVDIMM_INTEL_GET_FWINFO ] =2 ,
@@ -386,7 +386,7 @@ static u8 nfit_dsm_revid(unsigned family, unsigned func)if (family >NVDIMM_FAMILY_MAX )return 0 ; -if (func >31 ) +if (func >NVDIMM_CMD_MAX )return 0 ; id = revid_table[family][func];if (id ==0 )
@@ -492,7 +492,8 @@ int acpi_nfit_ctl(struct nvdimm_bus_descriptor *nd_desc, struct nvdimm *nvdimm,* Check for a valid command. For ND_CMD_CALL, we also have to * make sure that the DSM function is supported. */ -if (cmd ==ND_CMD_CALL && !test_bit (func, &dsm_mask)) +if (cmd ==ND_CMD_CALL && + (func >NVDIMM_CMD_MAX || !test_bit (func, &dsm_mask)))return -ENOTTY ;else if (!test_bit (cmd, &cmd_mask))return -ENOTTY ;
@@ -3492,7 +3493,8 @@ static int acpi_nfit_clear_to_send(struct nvdimm_bus_descriptor *nd_desc,if (nvdimm && cmd ==ND_CMD_CALL && call_pkg->nd_family ==NVDIMM_FAMILY_INTEL ) { func = call_pkg->nd_command; -if ((1 << func) &NVDIMM_INTEL_SECURITY_CMDMASK ) +if (func >NVDIMM_CMD_MAX || + (1 << func) &NVDIMM_INTEL_SECURITY_CMDMASK )return -EOPNOTSUPP ; }
drivers/acpi/nfit/nfit.h +1 -0
@@ -34,6 +34,7 @@ | ACPI_NFIT_MEM_NOT_ARMED | ACPI_NFIT_MEM_MAP_FAILED)#define NVDIMM_FAMILY_MAX NVDIMM_FAMILY_HYPERV +#define NVDIMM_CMD_MAX 31#define NVDIMM_STANDARD_CMDMASK \ (1 << ND_CMD_SMART | 1 << ND_CMD_SMART_THRESHOLD | 1 << ND_CMD_DIMM_FLAGS \
Signature · 4 lines
2.20.1 _______________________________________________ Linux-nvdimm mailing list -- [email protected] To unsubscribe send an email to [email protected]
Sasha Levin
maintainerPATCH 7/75 iommu/vt-d: Fix mm reference leak
In reply to Sasha LevinFrom: Jacob Pan <[email protected]>
[ Upstream commit 902baf61adf6b187f0a6b789e70d788ea71ff5bc ]
Move canonical address check before mmget_not_zero() to avoid mm reference leak.
--- drivers/iommu/intel-svm.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/iommu/intel-svm.c +4 -3
@@ -583,14 +583,15 @@ static irqreturn_t prq_event_thread(int irq, void *d)* any faults on kernel addresses. */ if (!svm->mm) goto bad_req; -/* If the mm is already defunct, don't handle faults. */ -if (!mmget_not_zero (svm->mm)) - goto bad_req;/* If address is not canonical, return invalid response */ if (!is_canonical_address (address)) goto bad_req; +/* If the mm is already defunct, don't handle faults. */ +if (!mmget_not_zero (svm->mm)) + goto bad_req; +down_read (&svm->mm->mmap_sem); vma =find_extend_vma (svm->mm, address);if (!vma || address < vma->vm_start)
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 8/75 scsi: lpfc: Fix kasan slab-out-of-bounds error in lpfc_unreg_login
In reply to Sasha LevinFrom: James Smart <[email protected]>
[ Upstream commit 38503943c89f0bafd9e3742f63f872301d44cbea ]
The following kasan bug was called out:
BUG: KASAN: slab-out-of-bounds in lpfc_unreg_login+0x7c/0xc0 [lpfc] Read of size 2 at addr ffff889fc7c50a22 by task lpfc_worker_3/6676 ... Call Trace: dump_stack+0x96/0xe0 ? lpfc_unreg_login+0x7c/0xc0 [lpfc] print_address_description.constprop.6+0x1b/0x220 ? lpfc_unreg_login+0x7c/0xc0 [lpfc] ? lpfc_unreg_login+0x7c/0xc0 [lpfc] __kasan_report.cold.9+0x37/0x7c ? lpfc_unreg_login+0x7c/0xc0 [lpfc] kasan_report+0xe/0x20 lpfc_unreg_login+0x7c/0xc0 [lpfc] lpfc_sli_def_mbox_cmpl+0x334/0x430 [lpfc] ...
When processing the completion of a "Reg Rpi" login mailbox command in lpfc_sli_def_mbox_cmpl, a call may be made to lpfc_unreg_login. The vpi is extracted from the completing mailbox context and passed as an input for the next. However, the vpi stored in the mailbox command context is an absolute vpi, which for SLI4 represents both base + offset. When used with a non-zero base component, (function id > 0) this results in an out-of-range access beyond the allocated phba->vpi_ids array.
Fix by subtracting the function's base value to get an accurate vpi number.
--- drivers/scsi/lpfc/lpfc_sli.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/scsi/lpfc/lpfc_sli.c +2 -0
@@ -2511,6 +2511,8 @@ lpfc_sli_def_mbox_cmpl(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb) !pmb->u.mb.mbxStatus) { rpi = pmb->u.mb.un.varWords[0 ]; vpi = pmb->u.mb.un.varRegLogin.vpi; +if (phba->sli_rev ==LPFC_SLI_REV4 ) + vpi -= phba->sli4_hba.max_cfg_param.vpi_base;lpfc_unreg_login (phba, vpi, rpi, pmb); pmb->vport = vport; pmb->mbox_cmpl = lpfc_sli_def_mbox_cmpl;
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 9/75 xfs: correctly acount for reclaimable slabs
In reply to Sasha LevinFrom: Dave Chinner <[email protected]>
[ Upstream commit d59eadaea2b9945095d4d6d44367ebabd604395c ]
The XFS inode item slab actually reclaimed by inode shrinker callbacks from the memory reclaim subsystem. These should be marked as reclaimable so the mm subsystem has the full picture of how much memory it can actually reclaim from the XFS slab caches.
--- fs/xfs/xfs_super.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
fs/xfs/xfs_super.c +2 -1
@@ -1872,7 +1872,8 @@ xfs_init_zones(void) xfs_ili_zone =kmem_cache_create ("xfs_ili" ,sizeof (struct xfs_inode_log_item ),0 , -SLAB_MEM_SPREAD ,NULL ); +SLAB_RECLAIM_ACCOUNT |SLAB_MEM_SPREAD , +NULL );if (!xfs_ili_zone) goto out_destroy_inode_zone;
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 10/75 scsi: lpfc: Fix crash after handling a pci error
In reply to Sasha LevinFrom: James Smart <[email protected]>
[ Upstream commit 4cd70891308dfb875ef31060c4a4aa8872630a2e ]
Injecting EEH on a 32GB card is causing kernel oops
The pci error handler is doing an IO flush and the offline code is also doing an IO flush. When the 1st flush is complete the hdwq is destroyed (freed), yet the second flush accesses the hdwq and crashes.
Added a check in lpfc_sli4_fush_io_rings to check both the HBA_IOQ_FLUSH flag and the hdwq pointer to see if it is already set and not already freed.
--- drivers/scsi/lpfc/lpfc_sli.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/scsi/lpfc/lpfc_sli.c +5 -0
@@ -4046,6 +4046,11 @@ lpfc_sli_flush_io_rings(struct lpfc_hba *phba)struct lpfc_iocbq *piocb, *next_iocb;spin_lock_irq (&phba->hbalock); +if (phba->hba_flag &HBA_IOQ_FLUSH || + !phba->sli4_hba.hdwq) { +spin_unlock_irq (&phba->hbalock); +return ; + }/* Indicate the I/O queues are flushed */ phba->hba_flag |=HBA_IOQ_FLUSH ;spin_unlock_irq (&phba->hbalock);
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 11/75 scsi: lpfc: Fix crash in target side cable pulls hitting WAIT_FOR_UNREG
In reply to Sasha LevinFrom: James Smart <[email protected]>
[ Upstream commit 807e7353d8a7105ce884d22b0dbc034993c6679c ]
Kernel is crashing with the following stacktrace:
BUG: unable to handle kernel NULL pointer dereference at
00000000000005bc
IP: lpfc_nvme_register_port+0x1a8/0x3a0 [lpfc]
...
Call Trace:
lpfc_nlp_state_cleanup+0x2b2/0x500 [lpfc]
lpfc_nlp_set_state+0xd7/0x1a0 [lpfc]
lpfc_cmpl_prli_prli_issue+0x1f7/0x450 [lpfc]
lpfc_disc_state_machine+0x7a/0x1e0 [lpfc]
lpfc_cmpl_els_prli+0x16f/0x1e0 [lpfc]
lpfc_sli_sp_handle_rspiocb+0x5b2/0x690 [lpfc]
lpfc_sli_handle_slow_ring_event_s4+0x182/0x230 [lpfc]
lpfc_do_work+0x87f/0x1570 [lpfc]
kthread+0x10d/0x130
ret_from_fork+0x35/0x40During target side fault injections, it is possible to hit the NLP_WAIT_FOR_UNREG case in lpfc_nvme_remoteport_delete. A prior commit fixed a rebind and delete race condition, but called lpfc_nlp_put unconditionally. This triggered a deletion and the crash.
Fix by movng nlp_put to inside the NLP_WAIT_FOR_UNREG case, where the nlp will be being unregistered/removed. Leave the reference if the flag isn't set.
--- drivers/scsi/lpfc/lpfc_nvme.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-)
drivers/scsi/lpfc/lpfc_nvme.c +8 -6
@@ -382,13 +382,15 @@ lpfc_nvme_remoteport_delete(struct nvme_fc_remote_port *remoteport)if (ndlp->upcall_flags &NLP_WAIT_FOR_UNREG ) { ndlp->nrport =NULL ; ndlp->upcall_flags &= ~NLP_WAIT_FOR_UNREG ; - } -spin_unlock_irq (&vport->phba->hbalock); +spin_unlock_irq (&vport->phba->hbalock); -/* Remove original register reference. The host transport -* won't reference this rport/remoteport any further. -*/ -lpfc_nlp_put (ndlp); +/* Remove original register reference. The host transport +* won't reference this rport/remoteport any further. +*/ +lpfc_nlp_put (ndlp); + }else { +spin_unlock_irq (&vport->phba->hbalock); + } rport_err:return ;
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 12/75 scsi: libfc: If PRLI rejected, move rport to PLOGI state
In reply to Sasha LevinFrom: Javed Hasan <[email protected]>
[ Upstream commit 45e544bfdab2014d11c7595b8ccc3c4715a09015 ]
If PRLI reject code indicates "rejected status", move rport state machine back to PLOGI state.
--- drivers/scsi/libfc/fc_rport.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/scsi/libfc/fc_rport.c +7 -1
@@ -1208,9 +1208,15 @@ static void fc_rport_prli_resp(struct fc_seq *sp, struct fc_frame *fp, rjt =fc_frame_payload_get (fp,sizeof (*rjt));if (!rjt)FC_RPORT_DBG (rdata,"PRLI bad response\n" ); -else +else {FC_RPORT_DBG (rdata,"PRLI ELS rejected, reason %x expl %x\n" , rjt->er_reason, rjt->er_explan); +if (rjt->er_reason ==ELS_RJT_UNAB && + rjt->er_explan ==ELS_EXPL_PLOGI_REQD ) { +fc_rport_enter_plogi (rdata); + goto out; + } + }fc_rport_error_retry (rdata,FC_EX_ELS_RJT ); }
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 13/75 ceph: return ceph_mdsc_do_request() errors from __get_parent()
In reply to Sasha LevinFrom: Qiujun Huang <[email protected]>
[ Upstream commit c6d50296032f0b97473eb2e274dc7cc5d0173847 ]
Return the error returned by ceph_mdsc_do_request(). Otherwise, r_target_inode ends up being NULL this ends up returning ENOENT regardless of the error.
--- fs/ceph/export.c | 5 +++++ 1 file changed, 5 insertions(+)
fs/ceph/export.c +5 -0
@@ -315,6 +315,11 @@ static struct dentry *__get_parent(struct super_block *sb, req->r_num_caps =1 ; err =ceph_mdsc_do_request (mdsc,NULL , req); +if (err) { +ceph_mdsc_put_request (req); +return ERR_PTR (err); + } + inode = req->r_target_inode;if (inode)ihold (inode);
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 14/75 ceph: don't skip updating wanted caps when cap is stale
In reply to Sasha LevinFrom: "Yan, Zheng" <[email protected]>
[ Upstream commit 0aa971b6fd3f92afef6afe24ef78d9bb14471519 ]
1. try_get_cap_refs() fails to get caps and finds that mds_wanted does not include what it wants. It returns -ESTALE.
2. ceph_get_caps() calls ceph_renew_caps(). ceph_renew_caps() finds that inode has cap, so it calls ceph_check_caps().
3. ceph_check_caps() finds that issued caps (without checking if it's stale) already includes caps wanted by open file, so it skips updating wanted caps.
Above events can cause an infinite loop inside ceph_get_caps().
--- fs/ceph/caps.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
fs/ceph/caps.c +6 -2
@@ -1972,8 +1972,12 @@ void ceph_check_caps(struct ceph_inode_info *ci, int flags, }/* want more caps from mds? */ -if (want & ~(cap->mds_wanted | cap->issued)) - goto ack; +if (want & ~cap->mds_wanted) { +if (want & ~(cap->mds_wanted | cap->issued)) + goto ack; +if (!__cap_is_valid (cap)) + goto ack; + }/* things we might delay */ if ((cap->issued & ~retain) ==0 )
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 15/75 pwm: rcar: Fix late Runtime PM enablement
In reply to Sasha LevinFrom: Geert Uytterhoeven <[email protected]>
[ Upstream commit 1451a3eed24b5fd6a604683f0b6995e0e7e16c79 ]
Runtime PM should be enabled before calling pwmchip_add(), as PWM users can appear immediately after the PWM chip has been added. Likewise, Runtime PM should be disabled after the removal of the PWM chip.
--- drivers/pwm/pwm-rcar.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/pwm/pwm-rcar.c +7 -3
@@ -228,24 +228,28 @@ static int rcar_pwm_probe(struct platform_device *pdev) rcar_pwm->chip.base =-1 ; rcar_pwm->chip.npwm =1 ; +pm_runtime_enable (&pdev->dev); + ret =pwmchip_add (&rcar_pwm->chip);if (ret <0 ) {dev_err (&pdev->dev,"failed to register PWM chip: %d\n" , ret); +pm_runtime_disable (&pdev->dev);return ret; } -pm_runtime_enable (&pdev->dev); -return 0 ; }static int rcar_pwm_remove (struct platform_device *pdev) {struct rcar_pwm_chip *rcar_pwm =platform_get_drvdata (pdev); +int ret; + + ret =pwmchip_remove (&rcar_pwm->chip);pm_runtime_disable (&pdev->dev); -return pwmchip_remove (&rcar_pwm->chip); +return ret; }static const struct of_device_id rcar_pwm_of_table[] = {
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 16/75 nvme-tcp: fix possible crash in write_zeroes processing
In reply to Sasha LevinFrom: Sagi Grimberg <[email protected]>
[ Upstream commit 25e5cb780e62bde432b401f312bb847edc78b432 ]
We cannot look at blk_rq_payload_bytes without first checking that the request has a mappable physical segments first (e.g. blk_rq_nr_phys_segments(rq) != 0) and only then to take the request payload bytes. This caused us to send a wrong sgl to the target or even dereference a non-existing buffer in case we actually got to the data send sequence (if it was in-capsule).
--- drivers/nvme/host/tcp.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-)
drivers/nvme/host/tcp.c +7 -6
@@ -164,16 +164,14 @@ static inline bool nvme_tcp_async_req(struct nvme_tcp_request *req)static inline bool nvme_tcp_has_inline_data (struct nvme_tcp_request *req) {struct request *rq; -unsigned int bytes;if (unlikely (nvme_tcp_async_req (req)))return false;/* async events don't have a request */ rq =blk_mq_rq_from_pdu (req); - bytes =blk_rq_payload_bytes (rq); -return rq_data_dir (rq) ==WRITE && bytes && - bytes <=nvme_tcp_inline_data_size (req->queue); +return rq_data_dir (rq) ==WRITE && req->data_len && + req->data_len <=nvme_tcp_inline_data_size (req->queue); }static inline struct page *nvme_tcp_req_cur_page (struct nvme_tcp_request *req)
@@ -2090,7 +2088,9 @@ static blk_status_t nvme_tcp_map_data(struct nvme_tcp_queue *queue, c->common.flags |=NVME_CMD_SGL_METABUF ; -if (rq_data_dir (rq) ==WRITE && req->data_len && +if (!blk_rq_nr_phys_segments (rq)) +nvme_tcp_set_sg_null (c); +else if (rq_data_dir (rq) ==WRITE && req->data_len <=nvme_tcp_inline_data_size (queue))nvme_tcp_set_sg_inline (queue, c, req->data_len);else
@@ -2117,7 +2117,8 @@ static blk_status_t nvme_tcp_setup_cmd_pdu(struct nvme_ns *ns, req->data_sent =0 ; req->pdu_len =0 ; req->pdu_sent =0 ; - req->data_len =blk_rq_payload_bytes (rq); + req->data_len =blk_rq_nr_phys_segments (rq) ? +blk_rq_payload_bytes (rq) :0 ; req->curr_bio = rq->bio; if (rq_data_dir(rq) == WRITE &&
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 17/75 ASoC: dpcm: allow start or stop during pause for backend
In reply to Sasha LevinFrom: 이경택 <[email protected]>
[ Upstream commit 21fca8bdbb64df1297e8c65a746c4c9f4a689751 ]
soc_compr_trigger_fe() allows start or stop after pause_push. In dpcm_be_dai_trigger(), however, only pause_release is allowed command after pause_push.
So, start or stop after pause in compress offload is always returned as error if the compress offload is used with dpcm. To fix the problem, SND_SOC_DPCM_STATE_PAUSED should be allowed for start or stop command.
--- sound/soc/soc-pcm.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
sound/soc/soc-pcm.c +4 -2
@@ -2256,7 +2256,8 @@ int dpcm_be_dai_trigger(struct snd_soc_pcm_runtime *fe, int stream,switch (cmd) {case SNDRV_PCM_TRIGGER_START :if ((be->dpcm[stream].state !=SND_SOC_DPCM_STATE_PREPARE ) && - (be->dpcm[stream].state !=SND_SOC_DPCM_STATE_STOP )) + (be->dpcm[stream].state !=SND_SOC_DPCM_STATE_STOP ) && + (be->dpcm[stream].state !=SND_SOC_DPCM_STATE_PAUSED ))continue ; ret =dpcm_do_trigger (dpcm, be_substream, cmd);
@@ -2286,7 +2287,8 @@ int dpcm_be_dai_trigger(struct snd_soc_pcm_runtime *fe, int stream, be->dpcm[stream].state =SND_SOC_DPCM_STATE_START ;break ;case SNDRV_PCM_TRIGGER_STOP : -if (be->dpcm[stream].state !=SND_SOC_DPCM_STATE_START ) +if ((be->dpcm[stream].state !=SND_SOC_DPCM_STATE_START ) && + (be->dpcm[stream].state !=SND_SOC_DPCM_STATE_PAUSED ))continue ;if (!snd_soc_dpcm_can_be_free_stop (fe, be, stream))
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 18/75 scsi: iscsi: Report unbind session event when the target has been removed
In reply to Sasha LevinFrom: Wu Bo <[email protected]>
[ Upstream commit 13e60d3ba287d96eeaf1deaadba51f71578119a3 ]
If the daemon is restarted or crashes while logging out of a session, the unbind session event sent by the kernel is not processed and is lost. When the daemon starts again, the session can't be unbound because the daemon is waiting for the event message. However, the kernel has already logged out and the event will not be resent.
When iscsid restart is complete, logout session reports error:
Logging out of session [sid: 6, target: iqn.xxxxx, portal: xx.xx.xx.xx,3260]
iscsiadm: Could not logout of [sid: 6, target: iscsiadm -m node iqn.xxxxx, portal: xx.xx.xx.xx,3260].
iscsiadm: initiator reported error (9 - internal error)
iscsiadm: Could not logout of all requested sessions
Make sure the unbind event is emitted.
[mkp: commit desc and applied by hand since patch was mangled]
--- drivers/scsi/scsi_transport_iscsi.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/scsi/scsi_transport_iscsi.c +3 -1
@@ -2012,7 +2012,7 @@ static void __iscsi_unbind_session(struct work_struct *work)if (session->target_id ==ISCSI_MAX_TARGET ) {spin_unlock_irqrestore (&session->lock, flags);mutex_unlock (&ihost->mutex); -return ; + goto unbind_session_exit; } target_id = session->target_id;
@@ -2024,6 +2024,8 @@ static void __iscsi_unbind_session(struct work_struct *work)ida_simple_remove (&iscsi_sess_ida, target_id);scsi_remove_target (&session->dev); + +unbind_session_exit:iscsi_session_event (session,ISCSI_KEVENT_UNBIND_SESSION );ISCSI_DBG_TRANS_SESSION (session,"Completed target removal\n" ); }
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 19/75 tools/test/nvdimm: Fix out of tree build
In reply to Sasha LevinFrom: Santosh Sivaraj <[email protected]>
[ Upstream commit 1f776799628139d0da47e710ad86eb58d987ff66 ]
Out of tree build using
make M=tools/test/nvdimm O=/tmp/build -C /tmp/build
fails with the following error
make: Entering directory '/tmp/build'
CC [M] tools/testing/nvdimm/test/nfit.olinux/tools/testing/nvdimm/test/nfit.c:19:10: fatal error: nd-core.h: No such file or directory
19 | #include <nd-core.h>
| ^~~~~~~~~~~
compilation terminated.
That is because the kbuild file uses $(src) which points to tools/testing/nvdimm, $(srctree) correctly points to root of the linux source tree.
--- tools/testing/nvdimm/Kbuild | 4 ++-- tools/testing/nvdimm/test/Kbuild | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-)
tools/testing/nvdimm/Kbuild +2 -2
@@ -22,8 +22,8 @@ DRIVERS := ../../../drivers NVDIMM_SRC := $(DRIVERS)/nvdimm ACPI_SRC := $(DRIVERS)/acpi/nfit DAX_SRC := $(DRIVERS)/dax -ccflags-y := -I$(src)/$(NVDIMM_SRC)/ -ccflags-y += -I$(src)/$(ACPI_SRC)/ +ccflags-y := -I$(srctree)/drivers/nvdimm/ +ccflags-y += -I$(srctree)/drivers/acpi/nfit/ obj-$(CONFIG_LIBNVDIMM) += libnvdimm.o obj-$(CONFIG_BLK_DEV_PMEM) += nd_pmem.o
tools/testing/nvdimm/test/Kbuild +2 -2
@@ -1,6 +1,6 @@ # SPDX-License-Identifier: GPL-2.0 -ccflags-y := -I$(src)/../../../../drivers/nvdimm/ -ccflags-y += -I$(src)/../../../../drivers/acpi/nfit/ +ccflags-y := -I$(srctree)/drivers/nvdimm/ +ccflags-y += -I$(srctree)/drivers/acpi/nfit/ obj-m += nfit_test.o obj-m += nfit_test_iomap.o
Signature · 4 lines
2.20.1 _______________________________________________ Linux-nvdimm mailing list -- [email protected] To unsubscribe send an email to [email protected]
Sasha Levin
maintainerPATCH 20/75 ASoC: Intel: atom: Take the drv->lock mutex before calling sst_send_slot_map()
In reply to Sasha LevinFrom: Hans de Goede <[email protected]>
[ Upstream commit 81630dc042af998b9f58cd8e2c29dab9777ea176 ]
sst_send_slot_map() uses sst_fill_and_send_cmd_unlocked() because in some places it is called with the drv->lock mutex already held.
So it must always be called with the mutex locked. This commit adds missing locking in the sst_set_be_modules() code-path.
--- sound/soc/intel/atom/sst-atom-controls.c | 2 ++ 1 file changed, 2 insertions(+)
sound/soc/intel/atom/sst-atom-controls.c +2 -0
@@ -966,7 +966,9 @@ static int sst_set_be_modules(struct snd_soc_dapm_widget *w,dev_dbg (c->dev,"Enter: widget=%s\n" , w->name);if (SND_SOC_DAPM_EVENT_ON (event)) { +mutex_lock (&drv->lock); ret =sst_send_slot_map (drv); +mutex_unlock (&drv->lock);if (ret)return ret; ret =sst_send_pipe_module_params (w, k);
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 21/75 nvme: fix deadlock caused by ANA update wrong locking
In reply to Sasha LevinFrom: Sagi Grimberg <[email protected]>
[ Upstream commit 657f1975e9d9c880fa13030e88ba6cc84964f1db ]
The deadlock combines 4 flows in parallel:
- ns scanning (triggered from reconnect)
- request timeout
- ANA update (triggered from reconnect)
- I/O coming into the mpath device
(1) ns scanning triggers disk revalidation -> update disk info ->
freeze queue -> but blocked, due to (2)
(2) timeout handler reference the g_usage_counter - > but blocks in the transport .timeout() handler, due to (3)
(3) the transport timeout handler (indirectly) calls nvme_stop_queue() -> which takes the (down_read) namespaces_rwsem - > but blocks, due to (4)
(4) ANA update takes the (down_write) namespaces_rwsem -> calls
nvme_mpath_set_live() -> which synchronize the ns_head srcu
(see commit 504db087aacc) -> but blocks, due to (5)(5) I/O came into nvme_mpath_make_request -> took srcu_read_lock ->
direct_make_request > blk_queue_enter -> but blocked, due to (1)
==> the request queue is under freeze -> deadlock.
The fix is making ANA update take a read lock as the namespaces list is not manipulated, it is just the ns and ns->head that are being updated (which is protected with the ns->head lock).
--- drivers/nvme/host/multipath.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/nvme/host/multipath.c +2 -2
@@ -514,7 +514,7 @@ static int nvme_update_ana_state(struct nvme_ctrl *ctrl,if (!nr_nsids)return 0 ; -down_write (&ctrl->namespaces_rwsem); +down_read (&ctrl->namespaces_rwsem);list_for_each_entry (ns, &ctrl->namespaces, list) {unsigned nsid =le32_to_cpu (desc->nsids[n]);
@@ -525,7 +525,7 @@ static int nvme_update_ana_state(struct nvme_ctrl *ctrl,if (++n == nr_nsids)break ; } -up_write (&ctrl->namespaces_rwsem); +up_read (&ctrl->namespaces_rwsem);return 0 ; }
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 22/75 drm/amd/display: Update stream adjust in dc_stream_adjust_vmin_vmax
In reply to Sasha LevinFrom: Isabel Zhang <[email protected]>
[ Upstream commit 346d8a0a3c91888a412c2735d69daa09c00f0203 ]
[Why]
After v_total_min and max are updated in vrr structure, the changes are not reflected in stream adjust. When these values are read from stream adjust it does not reflect the actual state of the system.
[How]
Set stream adjust values equal to vrr adjust values after vrr adjust values are updated.
--- drivers/gpu/drm/amd/display/dc/core/dc.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/gpu/drm/amd/display/dc/core/dc.c +2 -0
@@ -283,6 +283,8 @@ bool dc_stream_adjust_vmin_vmax(struct dc *dc,int i =0 ;bool ret = false; + stream->adjust = *adjust; +for (i =0 ; i <MAX_PIPES ; i++) {struct pipe_ctx *pipe = &dc->current_state->res_ctx.pipe_ctx[i];
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Sasha Levin
maintainerPATCH 23/75 dma-direct: fix data truncation in dma_direct_get_required_mask()
In reply to Sasha LevinFrom: Kishon Vijay Abraham I <[email protected]>
[ Upstream commit cdcda0d1f8f4ab84efe7cd9921c98364398aefd7 ]
The upper 32-bit physical address gets truncated inadvertently when dma_direct_get_required_mask() invokes phys_to_dma_direct(). This results in dma_addressing_limited() return incorrect value when used in platforms with LPAE enabled.
Fix it here by explicitly type casting 'max_pfn' to phys_addr_t in order to prevent overflow of intermediate value while evaluating '(max_pfn - 1) << PAGE_SHIFT'.
--- kernel/dma/direct.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
kernel/dma/direct.c +2 -1
@@ -51,7 +51,8 @@ static inline struct page *dma_direct_to_page(struct device *dev,u64 dma_direct_get_required_mask (struct device *dev) { -u64 max_dma =phys_to_dma_direct (dev, (max_pfn -1 ) <<PAGE_SHIFT ); +phys_addr_t phys = (phys_addr_t)(max_pfn -1 ) <<PAGE_SHIFT ; +u64 max_dma =phys_to_dma_direct (dev, phys);return (1ULL << (fls64 (max_dma) -1 )) *2 -1 ; }
Signature · 6 lines
2.20.1 _______________________________________________ iommu mailing list [email protected] https://lists.linuxfoundation.org/mailman/listinfo/iommu
Sasha Levin
maintainerPATCH 24/75 dma-debug: fix displaying of dma allocation type
In reply to Sasha LevinFrom: Grygorii Strashko <[email protected]>
[ Upstream commit 9bb50ed7470944238ec8e30a94ef096caf9056ee ]
The commit 2e05ea5cdc1a ("dma-mapping: implement dma_map_single_attrs using dma_map_page_attrs") removed "dma_debug_page" enum, but missed to update type2name string table. This causes incorrect displaying of dma allocation type.
Fix it by removing "page" string from type2name string table and switch to use named initializers.
Before (dma_alloc_coherent()):
k3-ringacc 4b800000.ringacc: scather-gather idx 2208 P=d1140000 N=d114 D=d1140000 L=40 DMA_BIDIRECTIONAL dma map error check not applicable k3-ringacc 4b800000.ringacc: scather-gather idx 2216 P=d1150000 N=d115 D=d1150000 L=40 DMA_BIDIRECTIONAL dma map error check not applicable
After:
k3-ringacc 4b800000.ringacc: coherent idx 2208 P=d1140000 N=d114 D=d1140000 L=40 DMA_BIDIRECTIONAL dma map error check not applicable k3-ringacc 4b800000.ringacc: coherent idx 2216 P=d1150000 N=d115 D=d1150000 L=40 DMA_BIDIRECTIONAL dma map error check not applicable
--- kernel/dma/debug.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
kernel/dma/debug.c +6 -3
@@ -137,9 +137,12 @@ static const char *const maperr2str[] = { [MAP_ERR_CHECKED] = "dma map error checked", }; -static const char *type2name[5 ] = {"single" ,"page" , -"scather-gather" ,"coherent" , -"resource" }; +static const char *type2name[] = { + [dma_debug_single] ="single" , + [dma_debug_sg] ="scather-gather" , + [dma_debug_coherent] ="coherent" , + [dma_debug_resource] ="resource" , +};static const char *dir2name[4 ] = {"DMA_BIDIRECTIONAL" ,"DMA_TO_DEVICE" ,"DMA_FROM_DEVICE" ,"DMA_NONE" };
Signature · 6 lines
2.20.1 _______________________________________________ iommu mailing list [email protected] https://lists.linuxfoundation.org/mailman/listinfo/iommu
Sasha Levin
maintainerPATCH 25/75 kernel/gcov/fs.c: gcov_seq_next() should increase position index
In reply to Sasha LevinFrom: Vasily Averin <[email protected]>
[ Upstream commit f4d74ef6220c1eda0875da30457bef5c7111ab06 ]
If seq_file .next function does not change position index, read after some lseek can generate unexpected output.
https://bugzilla.kernel.org/show_bug.cgi?id=206283
--- kernel/gcov/fs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/gcov/fs.c +1 -1
@@ -108,9 +108,9 @@ static void *gcov_seq_next(struct seq_file *seq, void *data, loff_t *pos) {struct gcov_iterator *iter = data; + (*pos)++;if (gcov_iter_next (iter))return NULL ; - (*pos)++;return iter; }
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 26/75 selftests: kmod: fix handling test numbers above 9
In reply to Sasha LevinFrom: Eric Biggers <[email protected]>
[ Upstream commit 6d573a07528308eb77ec072c010819c359bebf6e ]
get_test_count() and get_test_enabled() were broken for test numbers above 9 due to awk interpreting a field specification like '$0010' as octal rather than decimal. Fix it by stripping the leading zeroes.
--- tools/testing/selftests/kmod/kmod.sh | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-)
tools/testing/selftests/kmod/kmod.sh +9 -4
@@ -505,18 +505,23 @@ function test_num() fi } -function get_test_count() +function get_test_data() { test_num $1 - TEST_DATA=$(echo $ALL_TESTS | awk '{print $'$1'}') + local field_num=$(echo $1 | sed 's/^0*//') + echo $ALL_TESTS | awk '{print $'$field_num'}' +} + +function get_test_count() +{ + TEST_DATA=$(get_test_data $1) LAST_TWO=${TEST_DATA#*:*} echo ${LAST_TWO%:*} } function get_test_enabled() { - test_num $1 - TEST_DATA=$(echo $ALL_TESTS | awk '{print $'$1'}') + TEST_DATA=$(get_test_data $1) echo ${TEST_DATA#*:*:} }
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 27/75 ipc/util.c: sysvipc_find_ipc() should increase position index
In reply to Sasha LevinFrom: Vasily Averin <[email protected]>
[ Upstream commit 89163f93c6f969da5811af5377cc10173583123b ]
If seq_file .next function does not change position index, read after some lseek can generate unexpected output.
https://bugzilla.kernel.org/show_bug.cgi?id=206283
--- ipc/util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
ipc/util.c +1 -1
@@ -764,13 +764,13 @@ static struct kern_ipc_perm *sysvipc_find_ipc(struct ipc_ids *ids, loff_t pos, total++; } + *new_pos = pos +1 ;if (total >= ids->in_use)return NULL ;for (; pos < ipc_mni; pos++) { ipc =idr_find (&ids->ipcs_idr, pos);if (ipc !=NULL ) { - *new_pos = pos +1 ;rcu_read_lock ();ipc_lock_object (ipc);return ipc;
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 28/75 kconfig: qconf: Fix a few alignment issues
In reply to Sasha LevinFrom: Mauro Carvalho Chehab <[email protected]>
[ Upstream commit 60969f02f07ae1445730c7b293c421d179da729c ]
There are a few items with wrong alignments. Solve them.
--- scripts/kconfig/qconf.cc | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-)
scripts/kconfig/qconf.cc +7 -6
@@ -627,7 +627,7 @@ void ConfigList::updateMenuList(ConfigItem *parent, struct menu* menu) last = item; continue; } - hide: +hide: if (item && item->menu == child) { last = parent->firstChild(); if (last == item)
@@ -692,7 +692,7 @@ void ConfigList::updateMenuList(ConfigList *parent, struct menu* menu) last = item; continue; } - hide: +hide: if (item && item->menu == child) { last = (ConfigItem*)parent->topLevelItem(0); if (last == item)
@@ -1225,10 +1225,11 @@ QMenu* ConfigInfoView::createStandardContextMenu(const QPoint & pos) { QMenu* popup = Parent::createStandardContextMenu(pos); QAction* action = new QAction("Show Debug Info", popup); - action->setCheckable(true); - connect(action, SIGNAL(toggled(bool)), SLOT(setShowDebug(bool))); - connect(this, SIGNAL(showDebugChanged(bool)), action, SLOT(setOn(bool))); - action->setChecked(showDebug()); + + action->setCheckable(true); + connect(action, SIGNAL(toggled(bool)), SLOT(setShowDebug(bool))); + connect(this, SIGNAL(showDebugChanged(bool)), action, SLOT(setOn(bool))); + action->setChecked(showDebug()); popup->addSeparator(); popup->addAction(action); return popup;
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 29/75 lib/raid6/test: fix build on distros whose /bin/sh is not bash
In reply to Sasha LevinFrom: Masahiro Yamada <[email protected]>
[ Upstream commit 06bd48b6cd97ef3889b68c8e09014d81dbc463f1 ]
You can build a user-space test program for the raid6 library code, like this:
$ cd lib/raid6/test $ make
The command in $(shell ...) function is evaluated by /bin/sh by default. (or, you can specify the shell by passing SHELL=<shell> from command line)
Currently '>&/dev/null' is used to sink both stdout and stderr. Because this code is bash-ism, it only works when /bin/sh is a symbolic link to bash (this is the case on RHEL etc.)
This does not work on Ubuntu where /bin/sh is a symbolic link to dash.
I see lots of
/bin/sh: 1: Syntax error: Bad fd number
and
warning "your version of binutils lacks ... support"
Replace it with portable '>/dev/null 2>&1'.
--- lib/raid6/test/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
lib/raid6/test/Makefile +3 -3
@@ -35,13 +35,13 @@ endif ifeq ($(IS_X86),yes) OBJS += mmx.o sse1.o sse2.o avx2.o recov_ssse3.o recov_avx2.o avx512.o recov_avx512.o CFLAGS += $(shell echo "pshufb %xmm0, %xmm0" | \ - gcc -c -x assembler - >&/dev/null && \ + gcc -c -x assembler - >/dev/null 2>&1 && \ rm ./-.o && echo -DCONFIG_AS_SSSE3=1) CFLAGS += $(shell echo "vpbroadcastb %xmm0, %ymm1" | \ - gcc -c -x assembler - >&/dev/null && \ + gcc -c -x assembler - >/dev/null 2>&1 && \ rm ./-.o && echo -DCONFIG_AS_AVX2=1) CFLAGS += $(shell echo "vpmovm2b %k1, %zmm5" | \ - gcc -c -x assembler - >&/dev/null && \ + gcc -c -x assembler - >/dev/null 2>&1 && \ rm ./-.o && echo -DCONFIG_AS_AVX512=1) else ifeq ($(HAS_NEON),yes) OBJS += neon.o neon1.o neon2.o neon4.o neon8.o recov_neon.o recov_neon_inner.o
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 30/75 block: fix busy device checking in blk_drop_partitions
In reply to Sasha LevinFrom: Christoph Hellwig <[email protected]>
[ Upstream commit d3ef5536274faf89e626276b833be122a16bdb81 ]
bd_super is only set by get_tree_bdev and mount_bdev, and thus not by other openers like btrfs or the XFS realtime and log devices, as well as block devices directly opened from user space. Check bd_openers instead.
--- block/partition-generic.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
block/partition-generic.c +1 -1
@@ -468,7 +468,7 @@ int blk_drop_partitions(struct gendisk *disk, struct block_device *bdev)if (!disk_part_scan_enabled (disk))return 0 ; -if (bdev->bd_part_count || bdev->bd_super) +if (bdev->bd_part_count || bdev->bd_openers)return -EBUSY ; res =invalidate_partition (disk,0 );if (res)
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 31/75 KVM: s390: vsie: Fix possible race when shadowing region 3 tables
In reply to Sasha LevinFrom: David Hildenbrand <[email protected]>
[ Upstream commit 1493e0f944f3c319d11e067c185c904d01c17ae5 ]
We have to properly retry again by returning -EINVAL immediately in case somebody else instantiated the table concurrently. We missed to add the goto in this function only. The code now matches the other, similar shadowing functions.
We are overwriting an existing region 2 table entry. All allocated pages are added to the crst_list to be freed later, so they are not lost forever. However, when unshadowing the region 2 table, we wouldn't trigger unshadowing of the original shadowed region 3 table that we replaced. It would get unshadowed when the original region 3 table is modified. As it's not connected to the page table hierarchy anymore, it's not going to get used anymore. However, for a limited time, this page table will stick around, so it's in some sense a temporary memory leak.
Identified by manual code inspection. I don't think this classifies as stable material.
--- arch/s390/mm/gmap.c | 1 + 1 file changed, 1 insertion(+)
arch/s390/mm/gmap.c +1 -0
@@ -1840,6 +1840,7 @@ int gmap_shadow_r3t(struct gmap *sg, unsigned long saddr, unsigned long r3t, goto out_free; }else if (*table & _REGION_ENTRY_ORIGIN) { rc = -EAGAIN ;/* Race with shadow */ + goto out_free; }crst_table_init (s_r3t, _REGION3_ENTRY_EMPTY);/* mark as invalid as long as the parent table is not protected */
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 32/75 drm/nouveau: workaround runpm fail by disabling PCI power management on certain intel bridges
In reply to Sasha LevinFrom: Karol Herbst <[email protected]>
[ Upstream commit 434fdb51513bf3057ac144d152e6f2f2b509e857 ]
Fixes the infamous 'runtime PM' bug many users are facing on Laptops with Nvidia Pascal GPUs by skipping said PCI power state changes on the GPU.
Depending on the used kernel there might be messages like those in demsg:
"nouveau 0000:01:00.0: Refused to change power state, currently in D3" "nouveau 0000:01:00.0: can't change power state from D3cold to D0 (config space inaccessible)"
followed by backtraces of kernel crashes or timeouts within nouveau.
It's still unkown why this issue exists, but this is a reliable workaround and solves a very annoying issue for user having to choose between a crashing kernel or higher power consumption of their Laptops.
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=205623
--- drivers/gpu/drm/nouveau/nouveau_drm.c | 63 +++++++++++++++++++++++++++ drivers/gpu/drm/nouveau/nouveau_drv.h | 2 + 2 files changed, 65 insertions(+)
drivers/gpu/drm/nouveau/nouveau_drm.c +63 -0
@@ -618,6 +618,64 @@ nouveau_drm_device_fini(struct drm_device *dev)kfree (drm); } +/* +* On some Intel PCIe bridge controllers doing a +* D0 -> D3hot -> D3cold -> D0 sequence causes Nvidia GPUs to not reappear. +* Skipping the intermediate D3hot step seems to make it work again. This is +* probably caused by not meeting the expectation the involved AML code has +* when the GPU is put into D3hot state before invoking it. +* +* This leads to various manifestations of this issue: +* - AML code execution to power on the GPU hits an infinite loop (as the +* code waits on device memory to change). +* - kernel crashes, as all PCI reads return -1, which most code isn't able +* to handle well enough. +* +* In all cases dmesg will contain at least one line like this: +* 'nouveau 0000:01:00.0: Refused to change power state, currently in D3' +* followed by a lot of nouveau timeouts. +* +* In the \_SB.PCI0.PEG0.PG00._OFF code deeper down writes bit 0x80 to the not +* documented PCI config space register 0x248 of the Intel PCIe bridge +* controller (0x1901) in order to change the state of the PCIe link between +* the PCIe port and the GPU. There are alternative code paths using other +* registers, which seem to work fine (executed pre Windows 8): +* - 0xbc bit 0x20 (publicly available documentation claims 'reserved') +* - 0xb0 bit 0x10 (link disable) +* Changing the conditions inside the firmware by poking into the relevant +* addresses does resolve the issue, but it seemed to be ACPI private memory +* and not any device accessible memory at all, so there is no portable way of +* changing the conditions. +* On a XPS 9560 that means bits [0,3] on \CPEX need to be cleared. +* +* The only systems where this behavior can be seen are hybrid graphics laptops +* with a secondary Nvidia Maxwell, Pascal or Turing GPU. It's unclear whether +* this issue only occurs in combination with listed Intel PCIe bridge +* controllers and the mentioned GPUs or other devices as well. +* +* documentation on the PCIe bridge controller can be found in the +* "7th Generation Intel® Processor Families for H Platforms Datasheet Volume 2" +* Section "12 PCI Express* Controller (x16) Registers" +*/ + +static void quirk_broken_nv_runpm (struct pci_dev *pdev) +{ +struct drm_device *dev =pci_get_drvdata (pdev); +struct nouveau_drm *drm =nouveau_drm (dev); +struct pci_dev *bridge =pci_upstream_bridge (pdev); + +if (!bridge || bridge->vendor !=PCI_VENDOR_ID_INTEL ) +return ; + +switch (bridge->device) { +case 0x1901 : + drm->old_pm_cap = pdev->pm_cap; + pdev->pm_cap =0 ; +NV_INFO (drm,"Disabling PCI power management to avoid bug\n" ); +break ; + } +} +static int nouveau_drm_probe (struct pci_dev *pdev,const struct pci_device_id *pent) {
@@ -699,6 +757,7 @@ static int nouveau_drm_probe(struct pci_dev *pdev,if (ret) goto fail_drm_dev_init; +quirk_broken_nv_runpm (pdev);return 0 ; fail_drm_dev_init:
@@ -736,7 +795,11 @@ static void nouveau_drm_remove(struct pci_dev *pdev) {struct drm_device *dev =pci_get_drvdata (pdev); +struct nouveau_drm *drm =nouveau_drm (dev); +/* revert our workaround */ +if (drm->old_pm_cap) + pdev->pm_cap = drm->old_pm_cap;nouveau_drm_device_remove (dev); }
drivers/gpu/drm/nouveau/nouveau_drv.h +2 -0
@@ -138,6 +138,8 @@ struct nouveau_drm {struct list_head clients; +u8 old_pm_cap; +struct {struct agp_bridge_data *bridge;u32 base;
Signature · 6 lines
2.20.1 _______________________________________________ Nouveau mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/nouveau
Sasha Levin
maintainerPATCH 33/75 s390/cio: generate delayed uevent for vfio-ccw subchannels
In reply to Sasha LevinFrom: Cornelia Huck <[email protected]>
[ Upstream commit 2bc55eaeb88d30accfc1b6ac2708d4e4b81ca260 ]
The common I/O layer delays the ADD uevent for subchannels and delegates generating this uevent to the individual subchannel drivers. The vfio-ccw I/O subchannel driver, however, did not do that, and will not generate an ADD uevent for subchannels that had not been bound to a different driver (or none at all, which also triggers the uevent).
Generate the ADD uevent at the end of the probe function if uevents were still suppressed for the device.
Message-Id: <[email protected]>
--- drivers/s390/cio/vfio_ccw_drv.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/s390/cio/vfio_ccw_drv.c +5 -0
@@ -167,6 +167,11 @@ static int vfio_ccw_sch_probe(struct subchannel *sch)if (ret) goto out_disable; +if (dev_get_uevent_suppress (&sch->dev)) { +dev_set_uevent_suppress (&sch->dev,0 ); +kobject_uevent (&sch->dev.kobj,KOBJ_ADD ); + } +VFIO_CCW_MSG_EVENT (4 ,"bound to subchannel %x.%x.%04x\n" , sch->schid.cssid, sch->schid.ssid, sch->schid.sch_no);
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 34/75 s390/cio: avoid duplicated 'ADD' uevents
In reply to Sasha LevinFrom: Cornelia Huck <[email protected]>
[ Upstream commit 05ce3e53f375295c2940390b2b429e506e07655c ]
The common I/O layer delays the ADD uevent for subchannels and delegates generating this uevent to the individual subchannel drivers. The io_subchannel driver will do so when the associated ccw_device has been registered -- but unconditionally, so more ADD uevents will be generated if a subchannel has been unbound from the io_subchannel driver and later rebound.
To fix this, only generate the ADD event if uevents were still suppressed for the device.
Message-Id: <[email protected]>
--- drivers/s390/cio/device.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-)
drivers/s390/cio/device.c +9 -4
@@ -849,8 +849,10 @@ static void io_subchannel_register(struct ccw_device *cdev)* Now we know this subchannel will stay, we can throw * our delayed uevent. */ -dev_set_uevent_suppress (&sch->dev,0 ); -kobject_uevent (&sch->dev.kobj,KOBJ_ADD ); +if (dev_get_uevent_suppress (&sch->dev)) { +dev_set_uevent_suppress (&sch->dev,0 ); +kobject_uevent (&sch->dev.kobj,KOBJ_ADD ); + }/* make it known to the system */ ret =ccw_device_add (cdev);if (ret) {
@@ -1058,8 +1060,11 @@ static int io_subchannel_probe(struct subchannel *sch)* Throw the delayed uevent for the subchannel, register * the ccw_device and exit. */ -dev_set_uevent_suppress (&sch->dev,0 ); -kobject_uevent (&sch->dev.kobj,KOBJ_ADD ); +if (dev_get_uevent_suppress (&sch->dev)) { +/* should always be the case for the console */ +dev_set_uevent_suppress (&sch->dev,0 ); +kobject_uevent (&sch->dev.kobj,KOBJ_ADD ); + } cdev =sch_get_cdev (sch); rc =ccw_device_add (cdev);if (rc) {
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 35/75 loop: Better discard support for block devices
In reply to Sasha LevinFrom: Evan Green <[email protected]>
[ Upstream commit c52abf563049e787c1341cdf15c7dbe1bfbc951b ]
If the backing device for a loop device is itself a block device, then mirror the "write zeroes" capabilities of the underlying block device into the loop device. Copy this capability into both max_write_zeroes_sectors and max_discard_sectors of the loop device.
The reason for this is that REQ_OP_DISCARD on a loop device translates into blkdev_issue_zeroout(), rather than blkdev_issue_discard(). This presents a consistent interface for loop devices (that discarded data is zeroed), regardless of the backing device type of the loop device. There should be no behavior change for loop devices backed by regular files.
This change fixes blktest block/003, and removes an extraneous error print in block/013 when testing on a loop device backed by a block device that does not support discard.
--- drivers/block/loop.c | 42 +++++++++++++++++++++++++++++++----------- 1 file changed, 31 insertions(+), 11 deletions(-)
drivers/block/loop.c +31 -11
@@ -427,11 +427,12 @@ static int lo_fallocate(struct loop_device *lo, struct request *rq, loff_t pos,* information. */ struct file *file = lo->lo_backing_file; +struct request_queue *q = lo->lo_queue;int ret; mode |=FALLOC_FL_KEEP_SIZE ; -if ((!file->f_op->fallocate) || lo->lo_encrypt_key_size) { +if (!blk_queue_discard (q)) { ret = -EOPNOTSUPP ; goto out; }
@@ -865,28 +866,47 @@ static void loop_config_discard(struct loop_device *lo)struct inode *inode = file->f_mapping->host;struct request_queue *q = lo->lo_queue; +/* +* If the backing device is a block device, mirror its zeroing +* capability. Set the discard sectors to the block device's zeroing +* capabilities because loop discards result in blkdev_issue_zeroout(), +* not blkdev_issue_discard(). This maintains consistent behavior with +* file-backed loop devices: discarded regions read back as zero. +*/ +if (S_ISBLK (inode->i_mode) && !lo->lo_encrypt_key_size) { +struct request_queue *backingq; + + backingq =bdev_get_queue (inode->i_bdev); +blk_queue_max_discard_sectors (q, + backingq->limits.max_write_zeroes_sectors); + +blk_queue_max_write_zeroes_sectors (q, + backingq->limits.max_write_zeroes_sectors); +/* * We use punch hole to reclaim the free space used by the * image a.k.a. discard. However we do not support discard if * encryption is enabled, because it may give an attacker * useful information. */ -if ((!file->f_op->fallocate) || - lo->lo_encrypt_key_size) { + }else if (!file->f_op->fallocate || lo->lo_encrypt_key_size) { q->limits.discard_granularity =0 ; q->limits.discard_alignment =0 ;blk_queue_max_discard_sectors (q,0 );blk_queue_max_write_zeroes_sectors (q,0 ); -blk_queue_flag_clear (QUEUE_FLAG_DISCARD , q); -return ; - } - q->limits.discard_granularity = inode->i_sb->s_blocksize; - q->limits.discard_alignment =0 ; + }else { + q->limits.discard_granularity = inode->i_sb->s_blocksize; + q->limits.discard_alignment =0 ; -blk_queue_max_discard_sectors (q,UINT_MAX >>9 ); -blk_queue_max_write_zeroes_sectors (q,UINT_MAX >>9 ); -blk_queue_flag_set (QUEUE_FLAG_DISCARD , q); +blk_queue_max_discard_sectors (q,UINT_MAX >>9 ); +blk_queue_max_write_zeroes_sectors (q,UINT_MAX >>9 ); + } + +if (q->limits.max_write_zeroes_sectors) +blk_queue_flag_set (QUEUE_FLAG_DISCARD , q); +else +blk_queue_flag_clear (QUEUE_FLAG_DISCARD , q); }static void loop_unprepare_queue (struct loop_device *lo)
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 36/75 pwm: pca9685: Fix PWM/GPIO inter-operation
In reply to Sasha LevinFrom: Sven Van Asbroeck <[email protected]>
[ Upstream commit 9cc5f232a4b6a0ef6e9b57876d61b88f61bdd7c2 ]
This driver allows pwms to be requested as gpios via gpiolib. Obviously, it should not be allowed to request a GPIO when its corresponding PWM is already requested (and vice versa). So it requires some exclusion code.
Given that the PWMm and GPIO cores are not synchronized with respect to each other, this exclusion code will also require proper synchronization.
Such a mechanism was in place, but was inadvertently removed by Uwe's clean-up in commit e926b12c611c ("pwm: Clear chip_data in pwm_put()").
Upon revisiting the synchronization mechanism, we found that theoretically, it could allow two threads to successfully request conflicting PWMs/GPIOs.
Replace with a bitmap which tracks PWMs in-use, plus a mutex. As long as PWM and GPIO's respective request/free functions modify the in-use bitmap while holding the mutex, proper synchronization will be guaranteed.
--- drivers/pwm/pwm-pca9685.c | 85 ++++++++++++++++++++++----------------- 1 file changed, 48 insertions(+), 37 deletions(-)
drivers/pwm/pwm-pca9685.c +48 -37
@@ -20,6 +20,7 @@#include <linux/slab.h> #include <linux/delay.h> #include <linux/pm_runtime.h> +#include <linux/bitmap.h> /* * Because the PCA9685 has only one prescaler per chip, changing the period of
@@ -74,6 +75,7 @@ struct pca9685 {#if IS_ENABLED (CONFIG_GPIOLIB )struct mutex lock;struct gpio_chip gpio; +DECLARE_BITMAP (pwms_inuse,PCA9685_MAXCHAN +1 );#endif };
@@ -83,51 +85,51 @@ static inline struct pca9685 *to_pca(struct pwm_chip *chip) }#if IS_ENABLED (CONFIG_GPIOLIB ) -static int pca9685_pwm_gpio_request (struct gpio_chip *gpio,unsigned int offset) +static bool pca9685_pwm_test_and_set_inuse (struct pca9685 *pca,int pwm_idx) { -struct pca9685 *pca =gpiochip_get_data (gpio); -struct pwm_device *pwm; +bool is_inuse;mutex_lock (&pca->lock); - - pwm = &pca->chip.pwms[offset]; - -if (pwm->flags & (PWMF_REQUESTED |PWMF_EXPORTED )) { -mutex_unlock (&pca->lock); -return -EBUSY ; +if (pwm_idx >=PCA9685_MAXCHAN ) { +/* +* "all LEDs" channel: +* pretend already in use if any of the PWMs are requested +*/ +if (!bitmap_empty (pca->pwms_inuse,PCA9685_MAXCHAN )) { + is_inuse = true; + goto out; + } + }else { +/* +* regular channel: +* pretend already in use if the "all LEDs" channel is requested +*/ +if (test_bit (PCA9685_MAXCHAN , pca->pwms_inuse)) { + is_inuse = true; + goto out; + } } - -pwm_set_chip_data (pwm, (void *)1 ); - + is_inuse =test_and_set_bit (pwm_idx, pca->pwms_inuse); +out:mutex_unlock (&pca->lock); -pm_runtime_get_sync (pca->chip.dev); -return 0 ; +return is_inuse; } -static bool pca9685_pwm_is_gpio (struct pca9685 *pca,struct pwm_device *pwm) +static void pca9685_pwm_clear_inuse (struct pca9685 *pca,int pwm_idx) { -bool is_gpio = false; -mutex_lock (&pca->lock); +clear_bit (pwm_idx, pca->pwms_inuse); +mutex_unlock (&pca->lock); +} -if (pwm->hwpwm >=PCA9685_MAXCHAN ) { -unsigned int i; - -/* -* Check if any of the GPIOs are requested and in that case -* prevent using the "all LEDs" channel. -*/ -for (i =0 ; i < pca->gpio.ngpio; i++) -if (gpiochip_is_requested (&pca->gpio, i)) { - is_gpio = true; -break ; - } - }else if (pwm_get_chip_data (pwm)) { - is_gpio = true; - } +static int pca9685_pwm_gpio_request (struct gpio_chip *gpio,unsigned int offset) +{ +struct pca9685 *pca =gpiochip_get_data (gpio); -mutex_unlock (&pca->lock); -return is_gpio; +if (pca9685_pwm_test_and_set_inuse (pca, offset)) +return -EBUSY ; +pm_runtime_get_sync (pca->chip.dev); +return 0 ; }static int pca9685_pwm_gpio_get (struct gpio_chip *gpio,unsigned int offset)
@@ -162,6 +164,7 @@ static void pca9685_pwm_gpio_free(struct gpio_chip *gpio, unsigned int offset)pca9685_pwm_gpio_set (gpio, offset,0 );pm_runtime_put (pca->chip.dev); +pca9685_pwm_clear_inuse (pca, offset); } static int pca9685_pwm_gpio_get_direction(struct gpio_chip *chip,
@@ -213,12 +216,17 @@ static int pca9685_pwm_gpio_probe(struct pca9685 *pca) return devm_gpiochip_add_data(dev, &pca->gpio, pca); }#else -static inline bool pca9685_pwm_is_gpio (struct pca9685 *pca, -struct pwm_device *pwm) +static inline bool pca9685_pwm_test_and_set_inuse (struct pca9685 *pca, +int pwm_idx) {return false; } +static inline void +pca9685_pwm_clear_inuse (struct pca9685 *pca,int pwm_idx) +{ +} +static inline int pca9685_pwm_gpio_probe (struct pca9685 *pca) {return 0 ;
@@ -402,7 +410,7 @@ static int pca9685_pwm_request(struct pwm_chip *chip, struct pwm_device *pwm) {struct pca9685 *pca =to_pca (chip); -if (pca9685_pwm_is_gpio (pca, pwm)) +if (pca9685_pwm_test_and_set_inuse (pca, pwm->hwpwm))return -EBUSY ;pm_runtime_get_sync (chip->dev);
@@ -411,8 +419,11 @@ static int pca9685_pwm_request(struct pwm_chip *chip, struct pwm_device *pwm)static void pca9685_pwm_free (struct pwm_chip *chip,struct pwm_device *pwm) { +struct pca9685 *pca =to_pca (chip); +pca9685_pwm_disable (chip, pwm);pm_runtime_put (chip->dev); +pca9685_pwm_clear_inuse (pca, pwm->hwpwm); }static const struct pwm_ops pca9685_pwm_ops = {
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 37/75 Revert "powerpc/64: irq_work avoid interrupt when called with hardware irqs enabled"
In reply to Sasha LevinFrom: Nicholas Piggin <[email protected]>
[ Upstream commit abc3fce76adbdfa8f87272c784b388cd20b46049 ]
This reverts commit ebb37cf3ffd39fdb6ec5b07111f8bb2f11d92c5f.
That commit does not play well with soft-masked irq state manipulations in idle, interrupt replay, and possibly others due to tracing code sometimes using irq_work_queue (e.g., in trace_hardirqs_on()). That can cause PACA_IRQ_DEC to become set when it is not expected, and be ignored or cleared or cause warnings.
The net result seems to be missing an irq_work until the next timer interrupt in the worst case which is usually not going to be noticed, however it could be a long time if the tick is disabled, which is against the spirit of irq_work and might cause real problems.
The idea is still solid, but it would need more work. It's not really clear if it would be worth added complexity, so revert this for now (not a straight revert, but replace with a comment explaining why we might see interrupts happening, and gives git blame something to find).
--- arch/powerpc/kernel/time.c | 44 +++++++++++--------------------------- 1 file changed, 13 insertions(+), 31 deletions(-)
arch/powerpc/kernel/time.c +13 -31
@@ -522,35 +522,6 @@ static inline void clear_irq_work_pending(void) "i" (offsetof(struct paca_struct, irq_work_pending))); } -void arch_irq_work_raise (void ) -{ -preempt_disable (); -set_irq_work_pending_flag (); -/* -* Non-nmi code running with interrupts disabled will replay -* irq_happened before it re-enables interrupts, so setthe -* decrementer there instead of causing a hardware exception -* which would immediately hit the masked interrupt handler -* and have the net effect of setting the decrementer in -* irq_happened. -* -* NMI interrupts can not check this when they return, so the -* decrementer hardware exception is raised, which will fire -* when interrupts are next enabled. -* -* BookE does not support this yet, it must audit all NMI -* interrupt handlers to ensure they call nmi_enter() so this -* check would be correct. -*/ -if (IS_ENABLED (CONFIG_BOOKE ) || !irqs_disabled () ||in_nmi ()) { -set_dec (1 ); - }else { -hard_irq_disable (); - local_paca->irq_happened |=PACA_IRQ_DEC ; - } -preempt_enable (); -} -#else /* 32-bit */ DEFINE_PER_CPU (u8, irq_work_pending);
@@ -559,16 +530,27 @@ DEFINE_PER_CPU(u8, irq_work_pending);#define test_irq_work_pending () __this_cpu_read(irq_work_pending)#define clear_irq_work_pending () __this_cpu_write(irq_work_pending, 0) +#endif /* 32 vs 64 bit */ +void arch_irq_work_raise (void ) { +/* +* 64-bit code that uses irq soft-mask can just cause an immediate +* interrupt here that gets soft masked, if this is called under +* local_irq_disable(). It might be possible to prevent that happening +* by noticing interrupts are disabled and setting decrementer pending +* to be replayed when irqs are enabled. The problem there is that +* tracing can call irq_work_raise, including in code that does low +* level manipulations of irq soft-mask state (e.g., trace_hardirqs_on) +* which could get tangled up if we're messing with the same state +* here. +*/ preempt_disable ();set_irq_work_pending_flag ();set_dec (1 );preempt_enable (); } -#endif /* 32 vs 64 bit */ -#else /* CONFIG_IRQ_WORK */ #define test_irq_work_pending () 0
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 38/75 powerpc/pseries: Fix MCE handling on pseries
In reply to Sasha LevinFrom: Ganesh Goudar <[email protected]>
[ Upstream commit a95a0a1654f16366360399574e10efd87e867b39 ]
MCE handling on pSeries platform fails as recent rework to use common code for pSeries and PowerNV in machine check error handling tries to access per-cpu variables in realmode. The per-cpu variables may be outside the RMO region on pSeries platform and needs translation to be enabled for access. Just moving these per-cpu variable into RMO region did'nt help because we queue some work to workqueues in real mode, which again tries to touch per-cpu variables. Also fwnmi_release_errinfo() cannot be called when translation is not enabled.
This patch fixes this by enabling translation in the exception handler when all required real mode handling is done. This change only affects the pSeries platform.
Without this fix below kernel crash is seen on injecting SLB multihit:
BUG: Unable to handle kernel data access on read at 0xc00000027b205950 Faulting instruction address: 0xc00000000003b7e0 Oops: Kernel access of bad area, sig: 11 [#1] LE PAGE_SIZE=64K MMU=Hash SMP NR_CPUS=2048 NUMA pSeries Modules linked in: mcetest_slb(OE+) af_packet(E) xt_tcpudp(E) ip6t_rpfilter(E) ip6t_REJECT(E) ipt_REJECT(E) xt_conntrack(E) ip_set(E) nfnetlink(E) ebtable_nat(E) ebtable_broute(E) ip6table_nat(E) ip6table_mangle(E) ip6table_raw(E) ip6table_security(E) iptable_nat(E) nf_nat(E) nf_conntrack(E) nf_defrag_ipv6(E) nf_defrag_ipv4(E) iptable_mangle(E) iptable_raw(E) iptable_security(E) ebtable_filter(E) ebtables(E) ip6table_filter(E) ip6_tables(E) iptable_filter(E) ip_tables(E) x_tables(E) xfs(E) ibmveth(E) vmx_crypto(E) gf128mul(E) uio_pdrv_genirq(E) uio(E) crct10dif_vpmsum(E) rtc_generic(E) btrfs(E) libcrc32c(E) xor(E) zstd_decompress(E) zstd_compress(E) raid6_pq(E) sr_mod(E) sd_mod(E) cdrom(E) ibmvscsi(E) scsi_transport_srp(E) crc32c_vpmsum(E) dm_mod(E) sg(E) scsi_mod(E) CPU: 34 PID: 8154 Comm: insmod Kdump: loaded Tainted: G OE 5.5.0-mahesh #1 NIP: c00000000003b7e0 LR: c0000000000f2218 CTR: 0000000000000000 REGS: c000000007dcb960 TRAP: 0300 Tainted: G OE (5.5.0-mahesh) MSR: 8000000000001003 <SF,ME,RI,LE> CR: 28002428 XER: 20040000 CFAR: c0000000000f2214 DAR: c00000027b205950 DSISR: 40000000 IRQMASK: 0
GPR00: c0000000000f2218 c000000007dcbbf0 c000000001544800 c000000007dcbd70
GPR04: 0000000000000001 c000000007dcbc98 c008000000d00258 c0080000011c0000
GPR08: 0000000000000000 0000000300000003 c000000001035950 0000000003000048
GPR12: 000000027a1d0000 c000000007f9c000 0000000000000558 0000000000000000
GPR16: 0000000000000540 c008000001110000 c008000001110540 0000000000000000
GPR20: c00000000022af10 c00000025480fd70 c008000001280000 c00000004bfbb300
GPR24: c000000001442330 c00800000800000d c008000008000000 4009287a77000510
GPR28: 0000000000000000 0000000000000002 c000000001033d30 0000000000000001 NIP [c00000000003b7e0] save_mce_event+0x30/0x240
LR [c0000000000f2218] pseries_machine_check_realmode+0x2c8/0x4f0
Call Trace: Instruction dump: 3c4c0151 38429050 7c0802a6 60000000 fbc1fff0 fbe1fff8 f821ffd1 3d42ffaf 3fc2ffaf e98d0030 394a1150 3bdef530 <7d6a62aa> 1d2b0048 2f8b0063 380b0001 ---[ end trace 46fd63f36bbdd940 ]---
--- arch/powerpc/platforms/pseries/ras.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
arch/powerpc/platforms/pseries/ras.c +11 -0
@@ -683,6 +683,17 @@ static int mce_handle_error(struct pt_regs *regs, struct rtas_error_log *errp)#endif out: +/* +* Enable translation as we will be accessing per-cpu variables +* in save_mce_event() which may fall outside RMO region, also +* leave it enabled because subsequently we will be queuing work +* to workqueues where again per-cpu variables accessed, besides +* fwnmi_release_errinfo() crashes when called in realmode on +* pseries. +* Note: All the realmode handling like flushing SLB entries for +* SLB multihit is done by now. +*/ +mtmsr (mfmsr () |MSR_IR |MSR_DR );save_mce_event (regs, disposition ==RTAS_DISP_FULLY_RECOVERED , &mce_err, regs->nip, eaddr, paddr);
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 39/75 drm/amdkfd: kfree the wrong pointer
In reply to Sasha LevinFrom: Jack Zhang <[email protected]>
[ Upstream commit 3148a6a0ef3cf93570f30a477292768f7eb5d3c3 ]
Originally, it kfrees the wrong pointer for mem_obj. It would cause memory leak under stress test.
--- drivers/gpu/drm/amd/amdkfd/kfd_device.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdkfd/kfd_device.c +2 -2
@@ -1086,9 +1086,9 @@ int kfd_gtt_sa_allocate(struct kfd_dev *kfd, unsigned int size,return 0 ; kfd_gtt_no_free_chunk: -pr_debug ("Allocation failed with mem_obj = %p\n" , mem_obj); +pr_debug ("Allocation failed with mem_obj = %p\n" , *mem_obj);mutex_unlock (&kfd->gtt_sa_lock); -kfree (mem_obj); +kfree (*mem_obj);return -ENOMEM ; }
Signature · 6 lines
2.20.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Sasha Levin
maintainerPATCH 40/75 nvme: fix compat address handling in several ioctls
In reply to Sasha LevinFrom: Nick Bowler <[email protected]>
[ Upstream commit c95b708d5fa65b4e51f088ee077d127fd5a57b70 ]
On a 32-bit kernel, the upper bits of userspace addresses passed via various ioctls are silently ignored by the nvme driver.
However on a 64-bit kernel running a compat task, these upper bits are not ignored and are in fact required to be zero for the ioctls to work.
Unfortunately, this difference matters. 32-bit smartctl submits the NVME_IOCTL_ADMIN_CMD ioctl with garbage in these upper bits because it seems the pointer value it puts into the nvme_passthru_cmd structure is sign extended. This works fine on 32-bit kernels but fails on a 64-bit one because (at least on my setup) the addresses smartctl uses are consistently above 2G. For example:
# smartctl -x /dev/nvme0n1 smartctl 7.1 2019-12-30 r5022 [x86_64-linux-5.5.11] (local build) Copyright (C) 2002-19, Bruce Allen, Christian Franke, www.smartmontools.org
Read NVMe Identify Controller failed: NVME_IOCTL_ADMIN_CMD: Bad address
Since changing 32-bit kernels to actually check all of the submitted address bits now would break existing userspace, this patch fixes the compat problem by explicitly zeroing the upper bits in the compat case. This enables 32-bit smartctl to work on a 64-bit kernel.
--- drivers/nvme/host/core.c | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-)
drivers/nvme/host/core.c +20 -7
@@ -6,6 +6,7 @@#include <linux/blkdev.h> #include <linux/blk-mq.h> +#include <linux/compat.h> #include <linux/delay.h> #include <linux/errno.h> #include <linux/hdreg.h>
@@ -1248,6 +1249,18 @@ static void nvme_enable_aen(struct nvme_ctrl *ctrl)queue_work (nvme_wq, &ctrl->async_event_work); } +/* +* Convert integer values from ioctl structures to user pointers, silently +* ignoring the upper bits in the compat case to match behaviour of 32-bit +* kernels. +*/ +static void __user *nvme_to_user_ptr (uintptr_t ptrval) +{ +if (in_compat_syscall ()) + ptrval = (compat_uptr_t )ptrval; +return (void __user *)ptrval; +} +static int nvme_submit_io (struct nvme_ns *ns,struct nvme_user_io __user *uio) {struct nvme_user_io io;
@@ -1271,7 +1284,7 @@ static int nvme_submit_io(struct nvme_ns *ns, struct nvme_user_io __user *uio) length = (io.nblocks +1 ) << ns->lba_shift; meta_len = (io.nblocks +1 ) * ns->ms; - metadata = (void __user *)(uintptr_t )io.metadata; + metadata =nvme_to_user_ptr (io.metadata);if (ns->ext) { length += meta_len;
@@ -1294,7 +1307,7 @@ static int nvme_submit_io(struct nvme_ns *ns, struct nvme_user_io __user *uio) c.rw.appmask =cpu_to_le16 (io.appmask);return nvme_submit_user_cmd (ns->queue, &c, - (void __user *)(uintptr_t )io.addr, length, +nvme_to_user_ptr (io.addr), length, metadata, meta_len,lower_32_bits (io.slba),NULL ,0 ); }
@@ -1414,9 +1427,9 @@ static int nvme_user_cmd(struct nvme_ctrl *ctrl, struct nvme_ns *ns, effects =nvme_passthru_start (ctrl, ns, cmd.opcode); status =nvme_submit_user_cmd (ns ? ns->queue : ctrl->admin_q, &c, - (void __user *)(uintptr_t )cmd.addr, cmd.data_len, - (void __user *)(uintptr_t )cmd.metadata, - cmd.metadata_len,0 , &result, timeout); +nvme_to_user_ptr (cmd.addr), cmd.data_len, +nvme_to_user_ptr (cmd.metadata), cmd.metadata_len, +0 , &result, timeout);nvme_passthru_end (ctrl, effects);if (status >=0 ) {
@@ -1461,8 +1474,8 @@ static int nvme_user_cmd64(struct nvme_ctrl *ctrl, struct nvme_ns *ns, effects =nvme_passthru_start (ctrl, ns, cmd.opcode); status =nvme_submit_user_cmd (ns ? ns->queue : ctrl->admin_q, &c, - (void __user *)(uintptr_t )cmd.addr, cmd.data_len, - (void __user *)(uintptr_t )cmd.metadata, cmd.metadata_len, +nvme_to_user_ptr (cmd.addr), cmd.data_len, +nvme_to_user_ptr (cmd.metadata), cmd.metadata_len,0 , &cmd.result, timeout);nvme_passthru_end (ctrl, effects);
Signature · 7 lines
2.20.1 _______________________________________________ linux-nvme mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-nvme
Sasha Levin
maintainerPATCH 41/75 pwm: renesas-tpu: Fix late Runtime PM enablement
In reply to Sasha LevinFrom: Geert Uytterhoeven <[email protected]>
[ Upstream commit d5a3c7a4536e1329a758e14340efd0e65252bd3d ]
Runtime PM should be enabled before calling pwmchip_add(), as PWM users can appear immediately after the PWM chip has been added. Likewise, Runtime PM should always be disabled after the removal of the PWM chip, even if the latter failed.
--- drivers/pwm/pwm-renesas-tpu.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
drivers/pwm/pwm-renesas-tpu.c +4 -5
@@ -415,16 +415,17 @@ static int tpu_probe(struct platform_device *pdev) tpu->chip.base =-1 ; tpu->chip.npwm =TPU_CHANNEL_MAX ; +pm_runtime_enable (&pdev->dev); + ret =pwmchip_add (&tpu->chip);if (ret <0 ) {dev_err (&pdev->dev,"failed to register PWM chip\n" ); +pm_runtime_disable (&pdev->dev);return ret; }dev_info (&pdev->dev,"TPU PWM %d registered\n" , tpu->pdev->id); -pm_runtime_enable (&pdev->dev); -return 0 ; }
@@ -434,12 +435,10 @@ static int tpu_remove(struct platform_device *pdev)int ret; ret =pwmchip_remove (&tpu->chip); -if (ret) -return ret;pm_runtime_disable (&pdev->dev); -return 0 ; +return ret; }#ifdef CONFIG_OF
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 42/75 pwm: bcm2835: Dynamically allocate base
In reply to Sasha LevinFrom: Florian Fainelli <[email protected]>
[ Upstream commit 2c25b07e5ec119cab609e41407a1fb3fa61442f5 ]
The newer 2711 and 7211 chips have two PWM controllers and failure to dynamically allocate the PWM base would prevent the second PWM controller instance being probed for succeeding with an -EEXIST error from alloc_pwms().
--- drivers/pwm/pwm-bcm2835.c | 1 + 1 file changed, 1 insertion(+)
drivers/pwm/pwm-bcm2835.c +1 -0
@@ -166,6 +166,7 @@ static int bcm2835_pwm_probe(struct platform_device *pdev) pc->chip.dev = &pdev->dev; pc->chip.ops = &bcm2835_pwm_ops; + pc->chip.base =-1 ; pc->chip.npwm =2 ; pc->chip.of_xlate = of_pwm_xlate_with_flags; pc->chip.of_pwm_n_cells =3 ;
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 43/75 scsi: lpfc: Fix erroneous cpu limit of 128 on I/O statistics
In reply to Sasha LevinFrom: James Smart <[email protected]>
[ Upstream commit 840eda9602d30342486e85e7e96499f565572e4b ]
The cpu io statistics were capped by a hard define limit of 128. This effectively was a max number of CPUs, not an actual CPU count, nor actual CPU numbers which can be even larger than both of those values. This made stats off/misleading and on large CPU count systems, wrong.
Fix the stats so that all CPUs can have a stats struct. Fix the looping such that it loops by hdwq, finds CPUs that used the hdwq, and sum the stats, then display.
--- drivers/scsi/lpfc/lpfc.h | 9 +- drivers/scsi/lpfc/lpfc_debugfs.c | 204 ++++++++++++++++++------------- drivers/scsi/lpfc/lpfc_debugfs.h | 1 - drivers/scsi/lpfc/lpfc_init.c | 28 +++++ drivers/scsi/lpfc/lpfc_nvme.c | 45 ++++--- drivers/scsi/lpfc/lpfc_nvmet.c | 55 ++++----- drivers/scsi/lpfc/lpfc_scsi.c | 23 +--- drivers/scsi/lpfc/lpfc_sli4.h | 19 +-- 8 files changed, 215 insertions(+), 169 deletions(-)
drivers/scsi/lpfc/lpfc.h +4 -5
@@ -482,7 +482,7 @@ struct lpfc_vport {struct dentry *debug_nvmestat;struct dentry *debug_scsistat;struct dentry *debug_nvmektime; -struct dentry *debug_cpucheck; +struct dentry *debug_hdwqstat;struct dentry *vport_debugfs_root;struct lpfc_debugfs_trc *disc_trc;atomic_t disc_trc_cnt;
@@ -1175,12 +1175,11 @@ struct lpfc_hba {uint16_t sfp_warning;#ifdef CONFIG_SCSI_LPFC_DEBUG_FS -uint16_t cpucheck_on; +uint16_t hdwqstat_on;#define LPFC_CHECK_OFF 0#define LPFC_CHECK_NVME_IO 1 -#define LPFC_CHECK_NVMET_RCV 2 -#define LPFC_CHECK_NVMET_IO 4 -#define LPFC_CHECK_SCSI_IO 8 +#define LPFC_CHECK_NVMET_IO 2 +#define LPFC_CHECK_SCSI_IO 4uint16_t ktime_on;uint64_t ktime_data_samples;uint64_t ktime_status_samples;
drivers/scsi/lpfc/lpfc_debugfs.c +120 -84
318 lines not on this page · raw message
drivers/scsi/lpfc/lpfc_debugfs.h +0 -1
@@ -47,7 +47,6 @@/* nvmestat output buffer size */ #define LPFC_NVMESTAT_SIZE 8192#define LPFC_NVMEKTIME_SIZE 8192 -#define LPFC_CPUCHECK_SIZE 8192#define LPFC_NVMEIO_TRC_SIZE 8192/* scsistat output buffer size */
drivers/scsi/lpfc/lpfc_init.c +28 -0
@@ -6935,6 +6935,17 @@ lpfc_sli4_driver_resource_setup(struct lpfc_hba *phba) rc = -ENOMEM ; goto out_free_hba_cpu_map; } + +#ifdef CONFIG_SCSI_LPFC_DEBUG_FS + phba->sli4_hba.c_stat = alloc_percpu(struct lpfc_hdwq_stat); +if (!phba->sli4_hba.c_stat) { +lpfc_printf_log (phba,KERN_ERR ,LOG_INIT , +"3332 Failed allocating per cpu hdwq stats\n" ); + rc = -ENOMEM ; + goto out_free_hba_eq_info; + } +#endif +/* * Enable sr-iov virtual functions if supported and configured * through the module parameter.
@@ -6954,6 +6965,10 @@ lpfc_sli4_driver_resource_setup(struct lpfc_hba *phba)return 0 ; +#ifdef CONFIG_SCSI_LPFC_DEBUG_FS +out_free_hba_eq_info: +free_percpu (phba->sli4_hba.eq_info); +#endif out_free_hba_cpu_map:kfree (phba->sli4_hba.cpu_map); out_free_hba_eq_hdl:
@@ -6992,6 +7007,9 @@ lpfc_sli4_driver_resource_unset(struct lpfc_hba *phba)struct lpfc_fcf_conn_entry *conn_entry, *next_conn_entry;free_percpu (phba->sli4_hba.eq_info); +#ifdef CONFIG_SCSI_LPFC_DEBUG_FS +free_percpu (phba->sli4_hba.c_stat); +#endif /* Free memory allocated for msi-x interrupt vector to CPU mapping */ kfree (phba->sli4_hba.cpu_map);
@@ -10837,6 +10855,9 @@ lpfc_cpu_affinity_check(struct lpfc_hba *phba, int vectors)#ifdef CONFIG_X86 struct cpuinfo_x86 *cpuinfo;#endif +#ifdef CONFIG_SCSI_LPFC_DEBUG_FS +struct lpfc_hdwq_stat *c_stat; +#endif max_phys_id =0 ; min_phys_id =LPFC_VECTOR_MAP_EMPTY ;
@@ -11088,10 +11109,17 @@ lpfc_cpu_affinity_check(struct lpfc_hba *phba, int vectors) idx =0 ;for_each_possible_cpu (cpu) { cpup = &phba->sli4_hba.cpu_map[cpu]; +#ifdef CONFIG_SCSI_LPFC_DEBUG_FS + c_stat =per_cpu_ptr (phba->sli4_hba.c_stat, cpu); + c_stat->hdwq_no = cpup->hdwq; +#endif if (cpup->hdwq !=LPFC_VECTOR_MAP_EMPTY )continue ; cpup->hdwq = idx++ % phba->cfg_hdw_queue; +#ifdef CONFIG_SCSI_LPFC_DEBUG_FS + c_stat->hdwq_no = cpup->hdwq; +#endif lpfc_printf_log(phba, KERN_INFO, LOG_INIT, "3340 Set Affinity: not present " "CPU %d hdwq %d\n",
drivers/scsi/lpfc/lpfc_nvme.c +21 -24
65 lines not on this page · raw message
drivers/scsi/lpfc/lpfc_nvmet.c +26 -29
86 lines not on this page · raw message
drivers/scsi/lpfc/lpfc_scsi.c +4 -19
@@ -3803,9 +3803,6 @@ lpfc_scsi_cmd_iocb_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *pIocbIn,struct Scsi_Host *shost;int idx;uint32_t logit =LOG_FCP ; -#ifdef CONFIG_SCSI_LPFC_DEBUG_FS -int cpu; -#endif /* Guard against abort handler being called at same time */ spin_lock (&lpfc_cmd->buf_lock);
@@ -3824,11 +3821,8 @@ lpfc_scsi_cmd_iocb_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *pIocbIn, phba->sli4_hba.hdwq[idx].scsi_cstat.io_cmpls++;#ifdef CONFIG_SCSI_LPFC_DEBUG_FS -if (unlikely (phba->cpucheck_on &LPFC_CHECK_SCSI_IO )) { - cpu =raw_smp_processor_id (); -if (cpu <LPFC_CHECK_CPU_CNT && phba->sli4_hba.hdwq) - phba->sli4_hba.hdwq[idx].cpucheck_cmpl_io[cpu]++; - } +if (unlikely (phba->hdwqstat_on &LPFC_CHECK_SCSI_IO )) +this_cpu_inc (phba->sli4_hba.c_stat->cmpl_io);#endif shost = cmd->device->host;
@@ -4501,9 +4495,6 @@ lpfc_queuecommand(struct Scsi_Host *shost, struct scsi_cmnd *cmnd)struct lpfc_io_buf *lpfc_cmd;struct fc_rport *rport =starget_to_rport (scsi_target (cmnd->device));int err, idx; -#ifdef CONFIG_SCSI_LPFC_DEBUG_FS -int cpu; -#endif rdata =lpfc_rport_data_from_scsi_device (cmnd->device);
@@ -4624,14 +4615,8 @@ lpfc_queuecommand(struct Scsi_Host *shost, struct scsi_cmnd *cmnd)lpfc_scsi_prep_cmnd (vport, lpfc_cmd, ndlp);#ifdef CONFIG_SCSI_LPFC_DEBUG_FS -if (unlikely (phba->cpucheck_on &LPFC_CHECK_SCSI_IO )) { - cpu =raw_smp_processor_id (); -if (cpu <LPFC_CHECK_CPU_CNT ) { -struct lpfc_sli4_hdw_queue *hdwq = - &phba->sli4_hba.hdwq[lpfc_cmd->hdwq_no]; - hdwq->cpucheck_xmt_io[cpu]++; - } - } +if (unlikely (phba->hdwqstat_on &LPFC_CHECK_SCSI_IO )) +this_cpu_inc (phba->sli4_hba.c_stat->xmt_io);#endif err =lpfc_sli_issue_iocb (phba,LPFC_FCP_RING , &lpfc_cmd->cur_iocbq,SLI_IOCB_RET_IOCB );
drivers/scsi/lpfc/lpfc_sli4.h +12 -7
@@ -697,13 +697,6 @@ struct lpfc_sli4_hdw_queue {struct lpfc_lock_stat lock_conflict;#endif -#ifdef CONFIG_SCSI_LPFC_DEBUG_FS -#define LPFC_CHECK_CPU_CNT 128 -uint32_t cpucheck_rcv_io[LPFC_CHECK_CPU_CNT ]; -uint32_t cpucheck_xmt_io[LPFC_CHECK_CPU_CNT ]; -uint32_t cpucheck_cmpl_io[LPFC_CHECK_CPU_CNT ]; -#endif -/* Per HDWQ pool resources */ struct list_head sgl_list;struct list_head cmd_rsp_buf_list;
@@ -740,6 +733,15 @@ struct lpfc_sli4_hdw_queue {#define lpfc_qp_spin_lock (lock, qp, lstat) spin_lock(lock)#endif +#ifdef CONFIG_SCSI_LPFC_DEBUG_FS +struct lpfc_hdwq_stat { +u32 hdwq_no; +u32 rcv_io; +u32 xmt_io; +u32 cmpl_io; +}; +#endif +struct lpfc_sli4_hba {void __iomem *conf_regs_memmap_p;/* Kernel memory mapped address for * config space registers
@@ -921,6 +923,9 @@ struct lpfc_sli4_hba {struct cpumask numa_mask;uint16_t curr_disp_cpu;struct lpfc_eq_intr_info __percpu *eq_info; +#ifdef CONFIG_SCSI_LPFC_DEBUG_FS +struct lpfc_hdwq_stat __percpu *c_stat; +#endif uint32_t conf_trunk;#define lpfc_conf_trunk_port0_WORD conf_trunk#define lpfc_conf_trunk_port0_SHIFT 0
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 44/75 drm/vc4: Fix HDMI mode validation
In reply to Sasha LevinFrom: Nicolas Saenz Julienne <[email protected]>
[ Upstream commit b1e7396a1d0e6af6806337fdaaa44098d6b3343c ]
Current mode validation impedes setting up some video modes which should be supported otherwise. Namely 1920x1200@60Hz.
Fix this by lowering the minimum HDMI state machine clock to pixel clock ratio allowed.
--- drivers/gpu/drm/vc4/vc4_hdmi.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-)
drivers/gpu/drm/vc4/vc4_hdmi.c +16 -4
@@ -678,11 +678,23 @@ static enum drm_mode_status vc4_hdmi_encoder_mode_valid(struct drm_encoder *crtc, const struct drm_display_mode *mode) { -/* HSM clock must be 108% of the pixel clock. Additionally, -* the AXI clock needs to be at least 25% of pixel clock, but -* HSM ends up being the limiting factor. +/* +* As stated in RPi's vc4 firmware "HDMI state machine (HSM) clock must +* be faster than pixel clock, infinitesimally faster, tested in +* simulation. Otherwise, exact value is unimportant for HDMI +* operation." This conflicts with bcm2835's vc4 documentation, which +* states HSM's clock has to be at least 108% of the pixel clock. +* +* Real life tests reveal that vc4's firmware statement holds up, and +* users are able to use pixel clocks closer to HSM's, namely for +* 1920x1200@60Hz. So it was decided to have leave a 1% margin between +* both clocks. Which, for RPi0-3 implies a maximum pixel clock of +* 162MHz. +* +* Additionally, the AXI clock needs to be at least 25% of +* pixel clock, but HSM ends up being the limiting factor. */ -if (mode->clock >HSM_CLOCK_FREQ / (1000 *108 /100 )) +if (mode->clock >HSM_CLOCK_FREQ / (1000 *101 /100 ))return MODE_CLOCK_HIGH ;return MODE_OK ;
Signature · 6 lines
2.20.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Sasha Levin
maintainerPATCH 45/75 iommu/virtio: Fix freeing of incomplete domains
In reply to Sasha LevinFrom: Jean-Philippe Brucker <[email protected]>
[ Upstream commit 7062af3ed2ba451029e3733d9f677c68f5ea9e77 ]
Calling viommu_domain_free() on a domain that hasn't been finalised (not attached to any device, for example) can currently cause an Oops, because we attempt to call ida_free() on ID 0, which may either be unallocated or used by another domain.
Only initialise the vdomain->viommu pointer, which denotes a finalised domain, at the end of a successful viommu_domain_finalise().
--- drivers/iommu/virtio-iommu.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-)
drivers/iommu/virtio-iommu.c +9 -7
@@ -613,18 +613,20 @@ static int viommu_domain_finalise(struct viommu_dev *viommu,int ret;struct viommu_domain *vdomain =to_viommu_domain (domain); - vdomain->viommu = viommu; - vdomain->map_flags = viommu->map_flags; + ret =ida_alloc_range (&viommu->domain_ids, viommu->first_domain, + viommu->last_domain,GFP_KERNEL ); +if (ret <0 ) +return ret; + + vdomain->id = (unsigned int )ret; domain->pgsize_bitmap = viommu->pgsize_bitmap; domain->geometry = viommu->geometry; - ret =ida_alloc_range (&viommu->domain_ids, viommu->first_domain, - viommu->last_domain,GFP_KERNEL ); -if (ret >=0 ) - vdomain->id = (unsigned int )ret; + vdomain->map_flags = viommu->map_flags; + vdomain->viommu = viommu; -return ret >0 ?0 : ret; +return 0 ; }static void viommu_domain_free (struct iommu_domain *domain)
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 46/75 scsi: lpfc: Fix lockdep error - register non-static key
In reply to Sasha LevinFrom: James Smart <[email protected]>
[ Upstream commit f861f596714bed06069f1109b89e51f3855c4ddf ]
The following lockdep error was reported when unloading the lpfc driver:
INFO: trying to register non-static key.
the code is fine but needs lockdep annotation.
turning off the locking correctness validator.
...
Call Trace: dump_stack+0x96/0xe0 register_lock_class+0x8b8/0x8c0 ? lockdep_hardirqs_on+0x190/0x280 ? is_dynamic_key+0x150/0x150 ? wait_for_completion_interruptible+0x2a0/0x2a0 ? wake_up_q+0xd0/0xd0 __lock_acquire+0xda/0x21a0 ? register_lock_class+0x8c0/0x8c0 ? synchronize_rcu_expedited+0x500/0x500 ? __call_rcu+0x850/0x850 lock_acquire+0xf3/0x1f0 ? del_timer_sync+0x5/0xb0 del_timer_sync+0x3c/0xb0 ? del_timer_sync+0x5/0xb0 lpfc_pci_remove_one.cold.102+0x8b7/0x935 [lpfc] ...
Unloading the driver resulted in a call to del_timer_sync for the cpuhp_poll_timer. However the call to setup the timer had never been made, so the timer structures used by lockdep checking were not initialized.
Unconditionally call setup_timer for the cpuhp_poll_timer during driver initialization. Calls to start the timer remain "as needed".
--- drivers/scsi/lpfc/lpfc_init.c | 5 ++--- drivers/scsi/lpfc/lpfc_sli.c | 6 ++---- 2 files changed, 4 insertions(+), 7 deletions(-)
drivers/scsi/lpfc/lpfc_init.c +2 -3
@@ -11209,11 +11209,9 @@ static void lpfc_cpuhp_add(struct lpfc_hba *phba)rcu_read_lock (); -if (!list_empty (&phba->poll_list)) { -timer_setup (&phba->cpuhp_poll_timer, lpfc_sli4_poll_hbtimer,0 ); +if (!list_empty (&phba->poll_list))mod_timer (&phba->cpuhp_poll_timer, jiffies +msecs_to_jiffies (LPFC_POLL_HB )); - }rcu_read_unlock ();
@@ -13179,6 +13177,7 @@ lpfc_pci_probe_one_s4(struct pci_dev *pdev, const struct pci_device_id *pid)lpfc_sli4_ras_setup (phba);INIT_LIST_HEAD (&phba->poll_list); +timer_setup (&phba->cpuhp_poll_timer, lpfc_sli4_poll_hbtimer,0 );cpuhp_state_add_instance_nocalls (lpfc_cpuhp_state, &phba->cpuhp);return 0 ;
drivers/scsi/lpfc/lpfc_sli.c +2 -4
@@ -14448,12 +14448,10 @@ static inline void lpfc_sli4_add_to_poll_list(struct lpfc_queue *eq) {struct lpfc_hba *phba = eq->phba; -if (list_empty (&phba->poll_list)) { -timer_setup (&phba->cpuhp_poll_timer, lpfc_sli4_poll_hbtimer,0 ); -/* kickstart slowpath processing for this eq */ +/* kickstart slowpath processing if needed */ +if (list_empty (&phba->poll_list))mod_timer (&phba->cpuhp_poll_timer, jiffies +msecs_to_jiffies (LPFC_POLL_HB )); - }list_add_rcu (&eq->_poll_list, &phba->poll_list);synchronize_rcu ();
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 47/75 iommu/vt-d: Silence RCU-list debugging warning in dmar_find_atsr()
In reply to Sasha LevinFrom: Qian Cai <[email protected]>
[ Upstream commit c6f4ebdeba4cff590594df931ff1ee610c426431 ]
dmar_find_atsr() calls list_for_each_entry_rcu() outside of an RCU read side critical section but with dmar_global_lock held. Silence this false positive.
drivers/iommu/intel-iommu.c:4504 RCU-list traversed in non-reader section!! 1 lock held by swapper/0/1:
#0: ffffffff9755bee8 (dmar_global_lock){+.+.}, at: intel_iommu_init+0x1a6/0xe19
Call Trace: dump_stack+0xa4/0xfe lockdep_rcu_suspicious+0xeb/0xf5 dmar_find_atsr+0x1ab/0x1c0 dmar_parse_one_atsr+0x64/0x220 dmar_walk_remapping_entries+0x130/0x380 dmar_table_init+0x166/0x243 intel_iommu_init+0x1ab/0xe19 pci_iommu_init+0x1a/0x44 do_one_initcall+0xae/0x4d0 kernel_init_freeable+0x412/0x4c5 kernel_init+0x19/0x193
--- drivers/iommu/intel-iommu.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/iommu/intel-iommu.c +2 -1
@@ -4359,7 +4359,8 @@ static struct dmar_atsr_unit *dmar_find_atsr(struct acpi_dmar_atsr *atsr)struct dmar_atsr_unit *atsru;struct acpi_dmar_atsr *tmp; -list_for_each_entry_rcu (atsru, &dmar_atsr_units, list) { +list_for_each_entry_rcu (atsru, &dmar_atsr_units, list, +dmar_rcu_check ()) { tmp = (struct acpi_dmar_atsr *)atsru->hdr;if (atsr->segment != tmp->segment)continue ;
Signature · 6 lines
2.20.1 _______________________________________________ iommu mailing list [email protected] https://lists.linuxfoundation.org/mailman/listinfo/iommu
Sasha Levin
maintainerPATCH 48/75 platform/chrome: cros_ec_rpmsg: Fix race with host event
In reply to Sasha LevinFrom: Pi-Hsun Shih <[email protected]>
[ Upstream commit f775ac78fcfc6bdc96bdda07029d11f2a5e84869 ]
Host event can be sent by remoteproc by any time, and cros_ec_rpmsg_callback would be called after cros_ec_rpmsg_create_ept. But the cros_ec_device is initialized after that, which cause host event handler to use cros_ec_device that are not initialized properly yet.
Fix this by don't schedule host event handler before cros_ec_register returns. Instead, remember that we have a pending host event, and schedule host event handler after cros_ec_register.
--- drivers/platform/chrome/cros_ec_rpmsg.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-)
drivers/platform/chrome/cros_ec_rpmsg.c +15 -1
@@ -42,6 +42,8 @@ struct cros_ec_rpmsg {struct completion xfer_ack;struct work_struct host_event_work;struct rpmsg_endpoint *ept; +bool has_pending_host_event; +bool probe_done; };/**
@@ -175,7 +177,14 @@ static int cros_ec_rpmsg_callback(struct rpmsg_device *rpdev, void *data,memcpy (ec_dev->din, resp->data, len);complete (&ec_rpmsg->xfer_ack); }else if (resp->type ==HOST_EVENT_MARK ) { -schedule_work (&ec_rpmsg->host_event_work); +/* +* If the host event is sent before cros_ec_register is +* finished, queue the host event. +*/ +if (ec_rpmsg->probe_done) +schedule_work (&ec_rpmsg->host_event_work); +else + ec_rpmsg->has_pending_host_event = true; }else {dev_warn (ec_dev->dev,"rpmsg received invalid type = %d" , resp->type);
@@ -238,6 +247,11 @@ static int cros_ec_rpmsg_probe(struct rpmsg_device *rpdev)return ret; } + ec_rpmsg->probe_done = true; + +if (ec_rpmsg->has_pending_host_event) +schedule_work (&ec_rpmsg->host_event_work); +return 0 ; }
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 49/75 libnvdimm: Out of bounds read in __nd_ioctl()
In reply to Sasha LevinFrom: Dan Carpenter <[email protected]>
[ Upstream commit f84afbdd3a9e5e10633695677b95422572f920dc ]
The "cmd" comes from the user and it can be up to 255. It it's more than the number of bits in long, it results out of bounds read when we check test_bit(cmd, &cmd_mask). The highest valid value for "cmd" is ND_CMD_CALL (10) so I added a compare against that.
--- drivers/nvdimm/bus.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/nvdimm/bus.c +4 -2
@@ -1042,8 +1042,10 @@ static int __nd_ioctl(struct nvdimm_bus *nvdimm_bus, struct nvdimm *nvdimm,return -EFAULT ; } -if (!desc || (desc->out_num + desc->in_num ==0 ) || - !test_bit (cmd, &cmd_mask)) +if (!desc || + (desc->out_num + desc->in_num ==0 ) || + cmd >ND_CMD_CALL || + !test_bit (cmd, &cmd_mask))return -ENOTTY ;/* fail write commands (when read-only) */
Signature · 4 lines
2.20.1 _______________________________________________ Linux-nvdimm mailing list -- [email protected] To unsubscribe send an email to [email protected]
Sasha Levin
maintainerPATCH 50/75 platform/chrome: cros_ec: Query EC protocol version if EC transitions between RO/RW
In reply to Sasha LevinFrom: Yicheng Li <[email protected]>
[ Upstream commit 42cd0ab476e2daffc23982c37822a78f9a53cdd5 ]
RO and RW of EC may have different EC protocol version. If EC transitions between RO and RW, but AP does not reboot (this is true for fingerprint microcontroller / cros_fp, but not true for main ec / cros_ec), the AP still uses the protocol version queried before transition, which can cause problems. In the case of fingerprint microcontroller, this causes AP to send the wrong version of EC_CMD_GET_NEXT_EVENT to RO in the interrupt handler, which in turn prevents RO to clear the interrupt line to AP, in an infinite loop.
Once an EC_HOST_EVENT_INTERFACE_READY is received, we know that there might have been a transition between RO and RW, so re-query the protocol.
--- drivers/platform/chrome/cros_ec.c | 30 +++++++++++++++++++++ include/linux/platform_data/cros_ec_proto.h | 4 +++ 2 files changed, 34 insertions(+)
drivers/platform/chrome/cros_ec.c +30 -0
@@ -137,6 +137,24 @@ static int cros_ec_sleep_event(struct cros_ec_device *ec_dev, u8 sleep_event)return ret; } +static int cros_ec_ready_event (struct notifier_block *nb, +unsigned long queued_during_suspend, +void *_notify) +{ + struct cros_ec_device *ec_dev = container_of(nb, struct cros_ec_device, + notifier_ready); +u32 host_event =cros_ec_get_host_event (ec_dev); + +if (host_event &EC_HOST_EVENT_MASK (EC_HOST_EVENT_INTERFACE_READY )) { +mutex_lock (&ec_dev->lock); +cros_ec_query_all (ec_dev); +mutex_unlock (&ec_dev->lock); +return NOTIFY_OK ; + } + +return NOTIFY_DONE ; +} +/** * cros_ec_register() - Register a new ChromeOS EC, using the provided info. * @ec_dev: Device to register.
@@ -236,6 +254,18 @@ int cros_ec_register(struct cros_ec_device *ec_dev)dev_dbg (ec_dev->dev,"Error %d clearing sleep event to ec" , err); +if (ec_dev->mkbp_event_supported) { +/* +* Register the notifier for EC_HOST_EVENT_INTERFACE_READY +* event. +*/ + ec_dev->notifier_ready.notifier_call = cros_ec_ready_event; + err =blocking_notifier_chain_register (&ec_dev->event_notifier, + &ec_dev->notifier_ready); +if (err) +return err; + } +dev_info (dev,"Chrome EC device registered\n" );return 0 ;
include/linux/platform_data/cros_ec_proto.h +4 -0
@@ -126,6 +126,9 @@ struct cros_ec_command {* @host_event_wake_mask: Mask of host events that cause wake from suspend. * @last_event_time: exact time from the hard irq when we got notified of * a new event. +* @notifier_ready: The notifier_block to let the kernel re-query EC +* communication protocol when the EC sends +* EC_HOST_EVENT_INTERFACE_READY. * @ec: The platform_device used by the mfd driver to interface with the * main EC. * @pd: The platform_device used by the mfd driver to interface with the
@@ -167,6 +170,7 @@ struct cros_ec_device {u32 host_event_wake_mask;u32 last_resume_result;ktime_t last_event_time; +struct notifier_block notifier_ready;/* The platform devices used by the mfd driver */ struct platform_device *ec;
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 51/75 ocfs2: no need try to truncate file beyond i_size
In reply to Sasha LevinFrom: Changwei Ge <[email protected]>
[ Upstream commit 783fda856e1034dee90a873f7654c418212d12d7 ]
Linux fallocate(2) with FALLOC_FL_PUNCH_HOLE mode set, its offset can exceed the inode size. Ocfs2 now doesn't allow that offset beyond inode size. This restriction is not necessary and violates fallocate(2) semantics.
If fallocate(2) offset is beyond inode size, just return success and do nothing further.
Otherwise, ocfs2 will crash the kernel.
kernel BUG at fs/ocfs2//alloc.c:7264!
ocfs2_truncate_inline+0x20f/0x360 [ocfs2] ocfs2_remove_inode_range+0x23c/0xcb0 [ocfs2] __ocfs2_change_file_space+0x4a5/0x650 [ocfs2] ocfs2_fallocate+0x83/0xa0 [ocfs2] vfs_fallocate+0x148/0x230 SyS_fallocate+0x48/0x80 do_syscall_64+0x79/0x170
--- fs/ocfs2/alloc.c | 4 ++++ 1 file changed, 4 insertions(+)
fs/ocfs2/alloc.c +4 -0
@@ -7403,6 +7403,10 @@ int ocfs2_truncate_inline(struct inode *inode, struct buffer_head *di_bh,struct ocfs2_dinode *di = (struct ocfs2_dinode *)di_bh->b_data;struct ocfs2_inline_data *idata = &di->id2.i_data; +/* No need to punch hole beyond i_size. */ +if (start >=i_size_read (inode)) +return 0 ; +if (end >i_size_read (inode)) end =i_size_read (inode);
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 52/75 hfsplus: fix crash and filesystem corruption when deleting files
In reply to Sasha LevinFrom: Simon Gander <[email protected]>
[ Upstream commit 25efb2ffdf991177e740b2f63e92b4ec7d310a92 ]
When removing files containing extended attributes, the hfsplus driver may remove the wrong entries from the attributes b-tree, causing major filesystem damage and in some cases even kernel crashes.
To remove a file, all its extended attributes have to be removed as well. The driver does this by looking up all keys in the attributes b-tree with the cnid of the file. Each of these entries then gets deleted using the key used for searching, which doesn't contain the attribute's name when it should. Since the key doesn't contain the name, the deletion routine will not find the correct entry and instead remove the one in front of it. If parent nodes have to be modified, these become corrupt as well. This causes invalid links and unsorted entries that not even macOS's fsck_hfs is able to fix.
To fix this, modify the search key before an entry is deleted from the attributes b-tree by copying the found entry's key into the search key, therefore ensuring that the correct entry gets removed from the tree.
--- fs/hfsplus/attributes.c | 4 ++++ 1 file changed, 4 insertions(+)
fs/hfsplus/attributes.c +4 -0
@@ -292,6 +292,10 @@ static int __hfsplus_delete_attr(struct inode *inode, u32 cnid,return -ENOENT ; } +/* Avoid btree corruption */ +hfs_bnode_read (fd->bnode, fd->search_key, + fd->keyoffset, fd->keylength); + err =hfs_brec_remove (fd);if (err)return err;
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 53/75 ALSA: hda: Add driver blacklist
In reply to Sasha LevinFrom: Takashi Iwai <[email protected]>
[ Upstream commit 3c6fd1f07ed03a04debbb9a9d782205f1ef5e2ab ]
The recent AMD platform exposes an HD-audio bus but without any actual codecs, which is internally tied with a USB-audio device, supposedly. It results in "no codecs" error of HD-audio bus driver, and it's nothing but a waste of resources.
This patch introduces a static blacklist table for skipping such a known bogus PCI SSID entry. As of writing this patch, the known SSIDs are:
* 1043:874f - ASUS ROG Zenith II / Strix
* 1462:cb59 - MSI TRX40 Creator
* 1462:cb60 - MSI TRX40
--- sound/pci/hda/hda_intel.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
sound/pci/hda/hda_intel.c +16 -0
@@ -2074,6 +2074,17 @@ static void pcm_mmap_prepare(struct snd_pcm_substream *substream,#endif } +/* Blacklist for skipping the whole probe: +* some HD-audio PCI entries are exposed without any codecs, and such devices +* should be ignored from the beginning. +*/ +static const struct snd_pci_quirk driver_blacklist[] = { +SND_PCI_QUIRK (0x1043 ,0x874f ,"ASUS ROG Zenith II / Strix" ,0 ), +SND_PCI_QUIRK (0x1462 ,0xcb59 ,"MSI TRX40 Creator" ,0 ), +SND_PCI_QUIRK (0x1462 ,0xcb60 ,"MSI TRX40" ,0 ), + {} +}; +static const struct hda_controller_ops pci_hda_ops = { .disable_msi_reset_irq = disable_msi_reset_irq, .pcm_mmap_prepare = pcm_mmap_prepare,
@@ -2090,6 +2101,11 @@ static int azx_probe(struct pci_dev *pci,bool schedule_probe;int err; +if (snd_pci_quirk_lookup (pci, driver_blacklist)) { +dev_info (&pci->dev,"Skipping the blacklisted device\n" ); +return -ENODEV ; + } +if (dev >=SNDRV_CARDS )return -ENODEV ;if (!enable[dev]) {
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 54/75 ALSA: hda/realtek - Add quirk for MSI GL63
In reply to Sasha LevinFrom: Takashi Iwai <[email protected]>
[ Upstream commit 1d3aa4a5516d2e4933fe3cca11d3349ef63bc547 ]
MSI GL63 laptop requires the similar quirk like other MSI models, ALC1220_FIXUP_CLEVO_P950. The board BIOS doesn't provide a PCI SSID for the device, hence we need to take the codec SSID (1462:1275) instead.
--- sound/pci/hda/patch_realtek.c | 1 + 1 file changed, 1 insertion(+)
sound/pci/hda/patch_realtek.c +1 -0
@@ -2449,6 +2449,7 @@ static const struct snd_pci_quirk alc882_fixup_tbl[] = {SND_PCI_QUIRK (0x1458 ,0xa0b8 ,"Gigabyte AZ370-Gaming" ,ALC1220_FIXUP_GB_DUAL_CODECS ),SND_PCI_QUIRK (0x1458 ,0xa0cd ,"Gigabyte X570 Aorus Master" ,ALC1220_FIXUP_CLEVO_P950 ),SND_PCI_QUIRK (0x1462 ,0x1228 ,"MSI-GP63" ,ALC1220_FIXUP_CLEVO_P950 ), +SND_PCI_QUIRK (0x1462 ,0x1275 ,"MSI-GL63" ,ALC1220_FIXUP_CLEVO_P950 ),SND_PCI_QUIRK (0x1462 ,0x1276 ,"MSI-GL73" ,ALC1220_FIXUP_CLEVO_P950 ),SND_PCI_QUIRK (0x1462 ,0x1293 ,"MSI-GP65" ,ALC1220_FIXUP_CLEVO_P950 ), SND_PCI_QUIRK(0x1462, 0x7350, "MSI-7350", ALC889_FIXUP_CD),
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 55/75 perf/core: Disable page faults when getting phys address
In reply to Sasha LevinFrom: Jiri Olsa <[email protected]>
[ Upstream commit d3296fb372bf7497b0e5d0478c4e7a677ec6f6e9 ]
We hit following warning when running tests on kernel compiled with CONFIG_DEBUG_ATOMIC_SLEEP=y:
WARNING: CPU: 19 PID: 4472 at mm/gup.c:2381 __get_user_pages_fast+0x1a4/0x200 CPU: 19 PID: 4472 Comm: dummy Not tainted 5.6.0-rc6+ #3 RIP: 0010:__get_user_pages_fast+0x1a4/0x200 ... Call Trace: perf_prepare_sample+0xff1/0x1d90 perf_event_output_forward+0xe8/0x210 __perf_event_overflow+0x11a/0x310 __intel_pmu_pebs_event+0x657/0x850 intel_pmu_drain_pebs_nhm+0x7de/0x11d0 handle_pmi_common+0x1b2/0x650 intel_pmu_handle_irq+0x17b/0x370 perf_event_nmi_handler+0x40/0x60 nmi_handle+0x192/0x590 default_do_nmi+0x6d/0x150 do_nmi+0x2f9/0x3c0 nmi+0x8e/0xd7
While __get_user_pages_fast() is IRQ-safe, it calls access_ok(), which warns on:
WARN_ON_ONCE(!in_task() && !pagefault_disabled())
Peter suggested disabling page faults around __get_user_pages_fast(), which gets rid of the warning in access_ok() call.
--- kernel/events/core.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
kernel/events/core.c +6 -3
@@ -6748,9 +6748,12 @@ static u64 perf_virt_to_phys(u64 virt)* Try IRQ-safe __get_user_pages_fast first. * If failed, leave phys_addr as 0. */ -if ((current->mm !=NULL ) && - (__get_user_pages_fast (virt,1 ,0 , &p) ==1 )) - phys_addr =page_to_phys (p) + virt %PAGE_SIZE ; +if (current->mm !=NULL ) { +pagefault_disable (); +if (__get_user_pages_fast (virt,1 ,0 , &p) ==1 ) + phys_addr =page_to_phys (p) + virt %PAGE_SIZE ; +pagefault_enable (); + }if (p)put_page (p);
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 56/75 libata: Return correct status in sata_pmp_eh_recover_pm() when ATA_DFLAG_DETACH is set
In reply to Sasha LevinFrom: Kai-Heng Feng <[email protected]>
[ Upstream commit 8305f72f952cff21ce8109dc1ea4b321c8efc5af ]
During system resume from suspend, this can be observed on ASM1062 PMP controller:
ata10.01: SATA link down (SStatus 0 SControl 330)
ata10.02: hard resetting link
ata10.02: SATA link down (SStatus 0 SControl 330)
ata10.00: configured for UDMA/133
Kernel panic - not syncing: stack-protector: Kernel in: sata_pmp_eh_recover+0xa2b/0xa40 CPU: 2 PID: 230 Comm: scsi_eh_9 Tainted: P OE #49-Ubuntu Hardware name: System manufacturer System Product 1001 12/10/2017 Call Trace: dump_stack+0x63/0x8b panic+0xe4/0x244 ? sata_pmp_eh_recover+0xa2b/0xa40 __stack_chk_fail+0x19/0x20 sata_pmp_eh_recover+0xa2b/0xa40 ? ahci_do_softreset+0x260/0x260 [libahci] ? ahci_do_hardreset+0x140/0x140 [libahci] ? ata_phys_link_offline+0x60/0x60 ? ahci_stop_engine+0xc0/0xc0 [libahci] sata_pmp_error_handler+0x22/0x30 ahci_error_handler+0x45/0x80 [libahci] ata_scsi_port_error_handler+0x29b/0x770 ? ata_scsi_cmd_error_handler+0x101/0x140 ata_scsi_error+0x95/0xd0 ? scsi_try_target_reset+0x90/0x90 scsi_error_handler+0xd0/0x5b0 kthread+0x121/0x140 ? scsi_eh_get_sense+0x200/0x200 ? kthread_create_worker_on_cpu+0x70/0x70 ret_from_fork+0x22/0x40
Kernel Offset: 0xcc00000 from 0xffffffff81000000 (relocation range: 0xffffffff80000000-0xffffffffbfffffff)
Since sata_pmp_eh_recover_pmp() doens't set rc when ATA_DFLAG_DETACH is set, sata_pmp_eh_recover() continues to run. During retry it triggers the stack protector.
Set correct rc in sata_pmp_eh_recover_pmp() to let sata_pmp_eh_recover() jump to pmp_fail directly.
--- drivers/ata/libata-pmp.c | 1 + 1 file changed, 1 insertion(+)
drivers/ata/libata-pmp.c +1 -0
@@ -763,6 +763,7 @@ static int sata_pmp_eh_recover_pmp(struct ata_port *ap,if (dev->flags &ATA_DFLAG_DETACH ) { detach =1 ; + rc = -ENODEV ; goto fail; }
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 57/75 drm/amd/display: Calculate scaling ratios on every medium/full update
In reply to Sasha LevinFrom: Nicholas Kazlauskas <[email protected]>
[ Upstream commit 3bae20137cae6c03f58f96c0bc9f3d46f0bc17d4 ]
[Why]
If a plane isn't being actively enabled or disabled then DC won't always recalculate scaling rects and ratios for the primary plane.
This results in only a partial or corrupted rect being displayed on the screen instead of scaling to fit the screen.
[How]
Add back the logic to recalculate the scaling rects into dc_commit_updates_for_stream since this is the expected place to do it in DC.
This was previously removed a few years ago to fix an underscan issue but underscan is still functional now with this change - and it should be, since this is only updating to the latest plane state getting passed in.
--- drivers/gpu/drm/amd/display/dc/core/dc.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/core/dc.c +12 -1
@@ -2283,7 +2283,7 @@ void dc_commit_updates_for_stream(struct dc *dc,enum surface_update_type update_type;struct dc_state *context;struct dc_context *dc_ctx = dc->ctx; -int i; +int i, j; stream_status =dc_stream_get_status (stream); context = dc->current_state;
@@ -2321,6 +2321,17 @@ void dc_commit_updates_for_stream(struct dc *dc,copy_surface_update_to_plane (surface, &srf_updates[i]); +if (update_type >=UPDATE_TYPE_MED ) { +for (j =0 ; j < dc->res_pool->pipe_count; j++) { +struct pipe_ctx *pipe_ctx = + &context->res_ctx.pipe_ctx[j]; + +if (pipe_ctx->plane_state != surface) +continue ; + +resource_build_scaling_params (pipe_ctx); + } + } }copy_stream_update_to_stream (dc, context, stream, stream_update);
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Sasha Levin
maintainerPATCH 58/75 ALSA: ice1724: Fix invalid access for enumerated ctl items
In reply to Sasha LevinFrom: Takashi Iwai <[email protected]>
[ Upstream commit c47914c00be346bc5b48c48de7b0da5c2d1a296c ]
The access to Analog Capture Source control value implemented in prodigy_hifi.c is wrong, as caught by the recently introduced sanity check; it should be accessing value.enumerated.item[] instead of value.integer.value[]. This patch corrects the wrong access pattern.
--- sound/pci/ice1712/prodigy_hifi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
sound/pci/ice1712/prodigy_hifi.c +2 -2
@@ -536,7 +536,7 @@ static int wm_adc_mux_enum_get(struct snd_kcontrol *kcontrol,struct snd_ice1712 *ice =snd_kcontrol_chip (kcontrol);mutex_lock (&ice->gpio_mutex); - ucontrol->value.integer.value[0 ] =wm_get (ice,WM_ADC_MUX ) &0x1f ; + ucontrol->value.enumerated.item[0 ] =wm_get (ice,WM_ADC_MUX ) &0x1f ;mutex_unlock (&ice->gpio_mutex);return 0 ; }
@@ -550,7 +550,7 @@ static int wm_adc_mux_enum_put(struct snd_kcontrol *kcontrol,mutex_lock (&ice->gpio_mutex); oval =wm_get (ice,WM_ADC_MUX ); - nval = (oval &0xe0 ) | ucontrol->value.integer.value[0 ]; + nval = (oval &0xe0 ) | ucontrol->value.enumerated.item[0 ];if (nval != oval) {wm_put (ice,WM_ADC_MUX , nval); change =1 ;
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 59/75 ALSA: hda: Fix potential access overflow in beep helper
In reply to Sasha LevinFrom: Takashi Iwai <[email protected]>
[ Upstream commit 0ad3f0b384d58f3bd1f4fb87d0af5b8f6866f41a ]
The beep control helper function blindly stores the values in two stereo channels no matter whether the actual control is mono or stereo. This is practically harmless, but it annoys the recently introduced sanity check, resulting in an error when the checker is enabled.
This patch corrects the behavior to store only on the defined array member.
--- sound/pci/hda/hda_beep.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
sound/pci/hda/hda_beep.c +5 -1
@@ -290,8 +290,12 @@ int snd_hda_mixer_amp_switch_get_beep(struct snd_kcontrol *kcontrol, {struct hda_codec *codec =snd_kcontrol_chip (kcontrol);struct hda_beep *beep = codec->beep; +int chs =get_amp_channels (kcontrol); +if (beep && (!beep->enabled || !ctl_has_mute (kcontrol))) { - ucontrol->value.integer.value[0 ] = +if (chs &1 ) + ucontrol->value.integer.value[0 ] = beep->enabled; +if (chs &2 ) ucontrol->value.integer.value[1 ] = beep->enabled;return 0 ; }
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 60/75 KVM: s390: vsie: Fix delivery of addressing exceptions
In reply to Sasha LevinFrom: David Hildenbrand <[email protected]>
[ Upstream commit 4d4cee96fb7a3cc53702a9be8299bf525be4ee98 ]
Whenever we get an -EFAULT, we failed to read in guest 2 physical address space. Such addressing exceptions are reported via a program intercept to the nested hypervisor.
We faked the intercept, we have to return to guest 2. Instead, right now we would be returning -EFAULT from the intercept handler, eventually crashing the VM.
the correct thing to do is to return 1 as rc == 1 is the internal representation of "we have to go back into g2".
Addressing exceptions can only happen if the g2->g3 page tables reference invalid g2 addresses (say, either a table or the final page is not accessible - so something that basically never happens in sane environments.
Identified by manual code inspection.
--- arch/s390/kvm/vsie.c | 1 + 1 file changed, 1 insertion(+)
arch/s390/kvm/vsie.c +1 -0
@@ -1202,6 +1202,7 @@ static int vsie_run(struct kvm_vcpu *vcpu, struct vsie_page *vsie_page) scb_s->iprcc =PGM_ADDRESSING ; scb_s->pgmilc =4 ; scb_s->gpsw.addr =__rewind_psw (scb_s->gpsw,4 ); + rc =1 ; }return rc; }
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 61/75 ASoC: Intel: bytcr_rt5640: Add quirk for MPMAN MPWIN895CL tablet
In reply to Sasha LevinFrom: Hans de Goede <[email protected]>
[ Upstream commit c8b78f24c1247b7bd0882885c672d9dec5800bc6 ]
The MPMAN MPWIN895CL tablet almost fully works with out default settings. The only problem is that it has only 1 speaker so any sounds only playing on the right channel get lost.
Add a quirk for this model using the default settings + MONO_SPEAKER.
--- sound/soc/intel/boards/bytcr_rt5640.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
sound/soc/intel/boards/bytcr_rt5640.c +11 -0
@@ -591,6 +591,17 @@ static const struct dmi_system_id byt_rt5640_quirk_table[] = {BYT_RT5640_SSP0_AIF1 | BYT_RT5640_MCLK_EN), }, + { +/* MPMAN MPWIN895CL */ + .matches = { +DMI_EXACT_MATCH (DMI_SYS_VENDOR ,"MPMAN" ), + DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "MPWIN8900CL"), + }, + .driver_data = (void *)(BYTCR_INPUT_DEFAULTS | +BYT_RT5640_MONO_SPEAKER | +BYT_RT5640_SSP0_AIF1 | + BYT_RT5640_MCLK_EN), + }, { /* MSI S100 tablet */ .matches = { DMI_EXACT_MATCH(DMI_SYS_VENDOR, "Micro-Star International Co., Ltd."),
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 62/75 ipmi: fix hung processes in __get_guid()
In reply to Sasha LevinFrom: Wen Yang <[email protected]>
[ Upstream commit 32830a0534700f86366f371b150b17f0f0d140d7 ]
The wait_event() function is used to detect command completion. When send_guid_cmd() returns an error, smi_send() has not been called to send data. Therefore, wait_event() should not be used on the error path, otherwise it will cause the following warning:
[ 1361.588808] systemd-udevd D 0 1501 1436 0x00000004 [ 1361.588813] ffff883f4b1298c0 0000000000000000 ffff883f4b188000 ffff887f7e3d9f40 [ 1361.677952] ffff887f64bd4280 ffffc90037297a68 ffffffff8173ca3b ffffc90000000010 [ 1361.767077] 00ffc90037297ad0 ffff887f7e3d9f40 0000000000000286 ffff883f4b188000 [ 1361.856199] Call Trace: [ 1361.885578] [<ffffffff8173ca3b>] ? __schedule+0x23b/0x780 [ 1361.951406] [<ffffffff8173cfb6>] schedule+0x36/0x80 [ 1362.010979] [<ffffffffa071f178>] get_guid+0x118/0x150 [ipmi_msghandler] [ 1362.091281] [<ffffffff810d5350>] ? prepare_to_wait_event+0x100/0x100 [ 1362.168533] [<ffffffffa071f755>] ipmi_register_smi+0x405/0x940 [ipmi_msghandler] [ 1362.258337] [<ffffffffa0230ae9>] try_smi_init+0x529/0x950 [ipmi_si] [ 1362.334521] [<ffffffffa022f350>] ? std_irq_setup+0xd0/0xd0 [ipmi_si] [ 1362.411701] [<ffffffffa0232bd2>] init_ipmi_si+0x492/0x9e0 [ipmi_si] [ 1362.487917] [<ffffffffa0232740>] ? ipmi_pci_probe+0x280/0x280 [ipmi_si] [ 1362.568219] [<ffffffff810021a0>] do_one_initcall+0x50/0x180 [ 1362.636109] [<ffffffff812231b2>] ? kmem_cache_alloc_trace+0x142/0x190 [ 1362.714330] [<ffffffff811b2ae1>] do_init_module+0x5f/0x200 [ 1362.781208] [<ffffffff81123ca8>] load_module+0x1898/0x1de0 [ 1362.848069] [<ffffffff811202e0>] ? __symbol_put+0x60/0x60 [ 1362.913886] [<ffffffff8130696b>] ? security_kernel_post_read_file+0x6b/0x80 [ 1362.998514] [<ffffffff81124465>] SYSC_finit_module+0xe5/0x120 [ 1363.068463] [<ffffffff81124465>] ? SYSC_finit_module+0xe5/0x120 [ 1363.140513] [<ffffffff811244be>] SyS_finit_module+0xe/0x10 [ 1363.207364] [<ffffffff81003c04>] do_syscall_64+0x74/0x180
Message-Id: <[email protected]>
--- drivers/char/ipmi/ipmi_msghandler.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/char/ipmi/ipmi_msghandler.c +2 -2
@@ -3188,8 +3188,8 @@ static void __get_guid(struct ipmi_smi *intf)if (rv)/* Send failed, no GUID available. */ bmc->dyn_guid_set =0 ; - -wait_event (intf->waitq, bmc->dyn_guid_set !=2 ); +else +wait_event (intf->waitq, bmc->dyn_guid_set !=2 );/* dyn_guid_set makes the guid data available. */ smp_rmb ();
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 63/75 ALSA: usb-audio: Add Pioneer DJ DJM-250MK2 quirk
In reply to Sasha LevinFrom: František Kučera <[email protected]>
[ Upstream commit 73d8c94084341e2895169a0462dbc18167f01683 ]
Pioneer DJ DJM-250MK2 is a mixer that acts like a USB sound card. The MIDI controller part is standard but the PCM part is "vendor specific". Output is enabled by this quirk: 8 channels, 48 000 Hz, S24_3LE. Input is not working.
--- sound/usb/quirks-table.h | 42 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+)
sound/usb/quirks-table.h +42 -0
@@ -3592,5 +3592,47 @@ AU0828_DEVICE(0x2040, 0x7270, "Hauppauge", "HVR-950Q"), } } }, +{ +/* +* Pioneer DJ DJM-250MK2 +* PCM is 8 channels out @ 48 fixed (endpoints 0x01). +* The output from computer to the mixer is usable. +* +* The input (phono or line to computer) is not working. +* It should be at endpoint 0x82 and probably also 8 channels, +* but it seems that it works only with Pioneer proprietary software. +* Even on officially supported OS, the Audacity was unable to record +* and Mixxx to recognize the control vinyls. +*/ + USB_DEVICE_VENDOR_SPEC(0x2b73, 0x0017), + .driver_info = (unsigned long ) &(const struct snd_usb_audio_quirk ) { + .ifnum =QUIRK_ANY_INTERFACE , + .type =QUIRK_COMPOSITE , + .data = (const struct snd_usb_audio_quirk []) { + { + .ifnum =0 , + .type =QUIRK_AUDIO_FIXED_ENDPOINT , + .data = &(const struct audioformat ) { + .formats =SNDRV_PCM_FMTBIT_S24_3LE , + .channels =8 ,// outputs + .iface =0 , + .altsetting =1 , + .altset_idx =1 , + .endpoint =0x01 , + .ep_attr =USB_ENDPOINT_XFER_ISOC | +USB_ENDPOINT_SYNC_ASYNC , + .rates =SNDRV_PCM_RATE_48000 , + .rate_min =48000 , + .rate_max =48000 , + .nr_rates =1 , + .rate_table = (unsigned int []) {48000 } + } + }, + { + .ifnum =-1 + } + } + } +}, #undef USB_DEVICE_VENDOR_SPEC
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 64/75 ALSA: hda/realtek - Add quirk for Lenovo Carbon X1 8th gen
In reply to Sasha LevinFrom: Hans de Goede <[email protected]>
[ Upstream commit ca707b3f00b4f31a6e1eb37e8ae99f15f2bb1fe5 ]
The audio setup on the Lenovo Carbon X1 8th gen is the same as that on the Lenovo Carbon X1 7th gen, as such it needs the same ALC285_FIXUP_THINKPAD_HEADSET_JACK quirk.
This fixes volume control of the speaker not working among other things.
--- sound/pci/hda/patch_realtek.c | 1 + 1 file changed, 1 insertion(+)
sound/pci/hda/patch_realtek.c +1 -0
@@ -7300,6 +7300,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {SND_PCI_QUIRK (0x17aa ,0x225d ,"Thinkpad T480" ,ALC269_FIXUP_LIMIT_INT_MIC_BOOST ),SND_PCI_QUIRK (0x17aa ,0x2292 ,"Thinkpad X1 Yoga 7th" ,ALC285_FIXUP_THINKPAD_HEADSET_JACK ),SND_PCI_QUIRK (0x17aa ,0x2293 ,"Thinkpad X1 Carbon 7th" ,ALC285_FIXUP_THINKPAD_HEADSET_JACK ), +SND_PCI_QUIRK (0x17aa ,0x22be ,"Thinkpad X1 Carbon 8th" ,ALC285_FIXUP_THINKPAD_HEADSET_JACK ),SND_PCI_QUIRK (0x17aa ,0x30bb ,"ThinkCentre AIO" ,ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY ),SND_PCI_QUIRK (0x17aa ,0x30e2 ,"ThinkCentre AIO" ,ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY ), SND_PCI_QUIRK(0x17aa, 0x310c, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 65/75 scsi: mpt3sas: Fix kernel panic observed on soft HBA unplug
In reply to Sasha LevinFrom: Sreekanth Reddy <[email protected]>
[ Upstream commit cc41f11a21a51d6869d71e525a7264c748d7c0d7 ]
Generic protection fault type kernel panic is observed when user performs soft (ordered) HBA unplug operation while IOs are running on drives connected to HBA.
When user performs ordered HBA removal operation, the kernel calls PCI device's .remove() call back function where driver is flushing out all the outstanding SCSI IO commands with DID_NO_CONNECT host byte and also unmaps sg buffers allocated for these IO commands.
However, in the ordered HBA removal case (unlike of real HBA hot removal), HBA device is still alive and hence HBA hardware is performing the DMA operations to those buffers on the system memory which are already unmapped while flushing out the outstanding SCSI IO commands and this leads to kernel panic.
Don't flush out the outstanding IOs from .remove() path in case of ordered removal since HBA will be still alive in this case and it can complete the outstanding IOs. Flush out the outstanding IOs only in case of 'physical HBA hot unplug' where there won't be any communication with the HBA.
During shutdown also it is possible that HBA hardware can perform DMA operations on those outstanding IO buffers which are completed with DID_NO_CONNECT by the driver from .shutdown(). So same above fix is applied in shutdown path as well.
It is safe to drop the outstanding commands when HBA is inaccessible such as when permanent PCI failure happens, when HBA is in non-operational state, or when someone does a real HBA hot unplug operation. Since driver knows that HBA is inaccessible during these cases, it is safe to drop the outstanding commands instead of waiting for SCSI error recovery to kick in and clear these outstanding commands.
--- drivers/scsi/mpt3sas/mpt3sas_scsih.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/scsi/mpt3sas/mpt3sas_scsih.c +4 -4
@@ -9747,8 +9747,8 @@ static void scsih_remove(struct pci_dev *pdev) ioc->remove_host =1 ; -mpt3sas_wait_for_commands_to_complete (ioc); -_scsih_flush_running_cmds (ioc); +if (!pci_device_is_present (pdev)) +_scsih_flush_running_cmds (ioc);_scsih_fw_event_cleanup_queue (ioc);
@@ -9831,8 +9831,8 @@ scsih_shutdown(struct pci_dev *pdev) ioc->remove_host =1 ; -mpt3sas_wait_for_commands_to_complete (ioc); -_scsih_flush_running_cmds (ioc); +if (!pci_device_is_present (pdev)) +_scsih_flush_running_cmds (ioc);_scsih_fw_event_cleanup_queue (ioc);
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 66/75 xhci: Ensure link state is U3 after setting USB_SS_PORT_LS_U3
In reply to Sasha LevinFrom: Kai-Heng Feng <[email protected]>
[ Upstream commit eb002726fac7cefb98ff39ddb89e150a1c24fe85 ]
The xHCI spec doesn't specify the upper bound of U3 transition time. For some devices 20ms is not enough, so we need to make sure the link state is in U3 before further actions.
I've tried to use U3 Entry Capability by setting U3 Entry Enable in config register, however the port change event for U3 transition interrupts the system suspend process.
For now let's use the less ideal method by polling PLS.
--- drivers/usb/host/xhci-hub.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
drivers/usb/host/xhci-hub.c +10 -1
@@ -1322,7 +1322,16 @@ int xhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,xhci_set_link_state (xhci, ports[wIndex], link_state);spin_unlock_irqrestore (&xhci->lock, flags); -msleep (20 );/* wait device to enter */ +if (link_state ==USB_SS_PORT_LS_U3 ) { +int retries =16 ; + +while (retries--) { +usleep_range (4000 ,8000 ); + temp =readl (ports[wIndex]->addr); +if ((temp &PORT_PLS_MASK ) ==XDEV_U3 ) +break ; + } + }spin_lock_irqsave (&xhci->lock, flags); temp =readl (ports[wIndex]->addr);
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 67/75 xhci: Wait until link state trainsits to U0 after setting USB_SS_PORT_LS_U0
In reply to Sasha LevinFrom: Kai-Heng Feng <[email protected]>
[ Upstream commit 0200b9f790b0fc9e9a42f685f5ad54b23fe959f4 ]
Like U3 case, xHCI spec doesn't specify the upper bound of U0 transition time. The 20ms is not enough for some devices.
Intead of polling PLS or PLC, we can facilitate the port change event to know that the link transits to U0 is completed.
While at it, also separate U0 and U3 case to make the code cleaner.
--- drivers/usb/host/xhci-hub.c | 44 +++++++++++++++++++++++++----------- drivers/usb/host/xhci-mem.c | 1 + drivers/usb/host/xhci-ring.c | 1 + drivers/usb/host/xhci.h | 1 + 4 files changed, 34 insertions(+), 13 deletions(-)
drivers/usb/host/xhci-hub.c +31 -13
@@ -1306,7 +1306,33 @@ int xhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, wIndex, link_state); goto error; } + +if (link_state ==USB_SS_PORT_LS_U0 ) { +if ((temp &PORT_PLS_MASK ) ==XDEV_U0 ) +break ; + +if (!((temp &PORT_PLS_MASK ) ==XDEV_U1 || + (temp &PORT_PLS_MASK ) ==XDEV_U2 || + (temp &PORT_PLS_MASK ) ==XDEV_U3 )) { +xhci_warn (xhci,"Can only set port %d to U0 from U state\n" , + wIndex); + goto error; + } +reinit_completion (&bus_state->u3exit_done[wIndex]); +xhci_set_link_state (xhci, ports[wIndex], +USB_SS_PORT_LS_U0 ); +spin_unlock_irqrestore (&xhci->lock, flags); +if (!wait_for_completion_timeout (&bus_state->u3exit_done[wIndex], +msecs_to_jiffies (100 ))) +xhci_dbg (xhci,"missing U0 port change event for port %d\n" , + wIndex); +spin_lock_irqsave (&xhci->lock, flags); + temp =readl (ports[wIndex]->addr); +break ; + } +if (link_state ==USB_SS_PORT_LS_U3 ) { +int retries =16 ; slot_id =xhci_find_slot_id_by_port (hcd, xhci, wIndex +1 );if (slot_id) {
@@ -1317,26 +1343,18 @@ int xhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,xhci_stop_device (xhci, slot_id,1 );spin_lock_irqsave (&xhci->lock, flags); } - } - -xhci_set_link_state (xhci, ports[wIndex], link_state); - -spin_unlock_irqrestore (&xhci->lock, flags); -if (link_state ==USB_SS_PORT_LS_U3 ) { -int retries =16 ; - +xhci_set_link_state (xhci, ports[wIndex],USB_SS_PORT_LS_U3 ); +spin_unlock_irqrestore (&xhci->lock, flags);while (retries--) {usleep_range (4000 ,8000 ); temp =readl (ports[wIndex]->addr);if ((temp &PORT_PLS_MASK ) ==XDEV_U3 )break ; } - } -spin_lock_irqsave (&xhci->lock, flags); - - temp =readl (ports[wIndex]->addr); -if (link_state ==USB_SS_PORT_LS_U3 ) +spin_lock_irqsave (&xhci->lock, flags); + temp =readl (ports[wIndex]->addr); bus_state->suspended_ports |=1 << wIndex; + }break ;case USB_PORT_FEAT_POWER :/*
drivers/usb/host/xhci-mem.c +1 -0
@@ -2552,6 +2552,7 @@ int xhci_mem_init(struct xhci_hcd *xhci, gfp_t flags) xhci->usb3_rhub.bus_state.resume_done[i] =0 ;/* Only the USB 2.0 completions will ever be used. */ init_completion (&xhci->usb2_rhub.bus_state.rexit_done[i]); +init_completion (&xhci->usb3_rhub.bus_state.u3exit_done[i]); }if (scratchpad_alloc (xhci, flags))
drivers/usb/host/xhci-ring.c +1 -0
@@ -1677,6 +1677,7 @@ static void handle_port_status(struct xhci_hcd *xhci, (portsc & PORT_PLS_MASK) == XDEV_U1 || (portsc & PORT_PLS_MASK) == XDEV_U2)) {xhci_dbg (xhci,"resume SS port %d finished\n" , port_id); +complete (&bus_state->u3exit_done[hcd_portnum]);/* We've just brought the device into U0/1/2 through either the * Resume state after a device remote wakeup, or through the * U3Exit state after a host-initiated resume. If it's a device
drivers/usb/host/xhci.h +1 -0
@@ -1694,6 +1694,7 @@ struct xhci_bus_state {/* Which ports are waiting on RExit to U0 transition. */ unsigned long rexit_ports;struct completion rexit_done[USB_MAXCHILDREN ]; +struct completion u3exit_done[USB_MAXCHILDREN ]; };
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 68/75 xhci: Finetune host initiated USB3 rootport link suspend and resume
In reply to Sasha LevinFrom: Mathias Nyman <[email protected]>
[ Upstream commit ceca49382ac20e06ce04c21279c7f2868c4ec1d4 ]
Depending on the current link state the steps to resume the link to U0 varies. The normal case when a port is suspended (U3) we set the link to U0 and wait for a port event when U3exit completed and port moved to U0.
If the port is in U1/U2, then no event is issued, just set link to U0
If port is in Resume or Recovery state then the device has already initiated resume, and this host initiated resume is racing against it. Port event handler for device initiated resume will set link to U0, just wait for the port to reach U0 before returning.
--- drivers/usb/host/xhci-hub.c | 36 +++++++++++++++++++++++++----------- 1 file changed, 25 insertions(+), 11 deletions(-)
drivers/usb/host/xhci-hub.c +25 -11
@@ -1307,20 +1307,34 @@ int xhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, goto error; } +/* +* set link to U0, steps depend on current link state. +* U3: set link to U0 and wait for u3exit completion. +* U1/U2: no PLC complete event, only set link to U0. +* Resume/Recovery: device initiated U0, only wait for +* completion +*/ if (link_state ==USB_SS_PORT_LS_U0 ) { -if ((temp &PORT_PLS_MASK ) ==XDEV_U0 ) -break ; +u32 pls = temp &PORT_PLS_MASK ; +bool wait_u0 = false; -if (!((temp &PORT_PLS_MASK ) ==XDEV_U1 || - (temp &PORT_PLS_MASK ) ==XDEV_U2 || - (temp &PORT_PLS_MASK ) ==XDEV_U3 )) { -xhci_warn (xhci,"Can only set port %d to U0 from U state\n" , - wIndex); - goto error; +/* already in U0 */ +if (pls ==XDEV_U0 ) +break ; +if (pls ==XDEV_U3 || + pls ==XDEV_RESUME || + pls ==XDEV_RECOVERY ) { + wait_u0 = true; +reinit_completion (&bus_state->u3exit_done[wIndex]); + } +if (pls <=XDEV_U3 )/* U1, U2, U3 */ +xhci_set_link_state (xhci, ports[wIndex], +USB_SS_PORT_LS_U0 ); +if (!wait_u0) { +if (pls >XDEV_U3 ) + goto error; +break ; } -reinit_completion (&bus_state->u3exit_done[wIndex]); -xhci_set_link_state (xhci, ports[wIndex], -USB_SS_PORT_LS_U0 );spin_unlock_irqrestore (&xhci->lock, flags);if (!wait_for_completion_timeout (&bus_state->u3exit_done[wIndex],msecs_to_jiffies (100 )))
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 69/75 drm/amd/display: Not doing optimize bandwidth if flip pending.
In reply to Sasha LevinFrom: Yongqiang Sun <[email protected]>
[ Upstream commit 9941b8129030c9202aaf39114477a0e58c0d6ffc ]
[Why]
In some scenario like 1366x768 VSR enabled connected with a 4K monitor and playing 4K video in clone mode, underflow will be observed due to decrease dppclk when previouse surface scan isn't finished
[How]
In this use case, surface flip is switching between 4K and 1366x768, 1366x768 needs smaller dppclk, and when decrease the clk and previous surface scan is for 4K and scan isn't done, underflow will happen. Not doing optimize bandwidth in case of flip pending.
--- drivers/gpu/drm/amd/display/dc/core/dc.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+)
drivers/gpu/drm/amd/display/dc/core/dc.c +23 -0
@@ -1281,6 +1281,26 @@ bool dc_commit_state(struct dc *dc, struct dc_state *context)return (result ==DC_OK ); } +static bool is_flip_pending_in_pipes (struct dc *dc,struct dc_state *context) +{ +int i; +struct pipe_ctx *pipe; + +for (i =0 ; i <MAX_PIPES ; i++) { + pipe = &context->res_ctx.pipe_ctx[i]; + +if (!pipe->plane_state) +continue ; + +/* Must set to false to start with, due to OR in update function */ + pipe->plane_state->status.is_flip_pending = false; + dc->hwss.update_pending_status (pipe); +if (pipe->plane_state->status.is_flip_pending) +return true; + } +return false; +} +bool dc_post_update_surfaces_to_stream (struct dc *dc) {int i;
@@ -1291,6 +1311,9 @@ bool dc_post_update_surfaces_to_stream(struct dc *dc)post_surface_trace (dc); +if (is_flip_pending_in_pipes (dc, context)) +return true; +for (i =0 ; i < dc->res_pool->pipe_count; i++)if (context->res_ctx.pipe_ctx[i].stream ==NULL || context->res_ctx.pipe_ctx[i].plane_state ==NULL ) {
Signature · 6 lines
2.20.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Sasha Levin
maintainerPATCH 70/75 ASoC: SOF: trace: fix unconditional free in trace release
In reply to Sasha LevinFrom: Kai Vehmanen <[email protected]>
[ Upstream commit e6110114d18d330c05fd6de9f31283fd086a5a3a ]
Check if DMA pages were successfully allocated in initialization before calling free. For many types of memory (like sgbufs) the extra free is harmless, but not all backends track allocation state, so add an explicit check.
--- sound/soc/sof/trace.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
sound/soc/sof/trace.c +5 -2
@@ -343,7 +343,10 @@ void snd_sof_free_trace(struct snd_sof_dev *sdev)snd_sof_release_trace (sdev); -snd_dma_free_pages (&sdev->dmatb); -snd_dma_free_pages (&sdev->dmatp); +if (sdev->dma_trace_pages) { +snd_dma_free_pages (&sdev->dmatb); +snd_dma_free_pages (&sdev->dmatp); + sdev->dma_trace_pages =0 ; + } }EXPORT_SYMBOL (snd_sof_free_trace);
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 71/75 powerpc/powernv/ioda: Fix ref count for devices with their own PE
In reply to Sasha LevinFrom: Frederic Barrat <[email protected]>
[ Upstream commit 05dd7da76986937fb288b4213b1fa10dbe0d1b33 ]
The pci_dn structure used to store a pointer to the struct pci_dev, so taking a reference on the device was required. However, the pci_dev pointer was later removed from the pci_dn structure, but the reference was kept for the npu device.
See commit 902bdc57451c ("powerpc/powernv/idoa: Remove unnecessary pcidev from pci_dn").
We don't need to take a reference on the device when assigning the PE as the struct pnv_ioda_pe is cleaned up at the same time as the (physical) device is released. Doing so prevents the device from being released, which is a problem for opencapi devices, since we want to be able to remove them through PCI hotplug.
Now the ugly part: nvlink npu devices are not meant to be released. Because of the above, we've always leaked a reference and simply removing it now is dangerous and would likely require more work. There's currently no release device callback for nvlink devices for example. So to be safe, this patch leaks a reference on the npu device, but only for nvlink and not opencapi.
--- arch/powerpc/platforms/powernv/pci-ioda.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-)
arch/powerpc/platforms/powernv/pci-ioda.c +12 -7
@@ -1062,14 +1062,13 @@ static struct pnv_ioda_pe *pnv_ioda_setup_dev_PE(struct pci_dev *dev)return NULL ; } -/* NOTE: We get only one ref to the pci_dev for the pdn, not for the -* pointer in the PE data structure, both should be destroyed at the -* same time. However, this needs to be looked at more closely again -* once we actually start removing things (Hotplug, SR-IOV, ...) +/* NOTE: We don't get a reference for the pointer in the PE +* data structure, both the device and PE structures should be +* destroyed at the same time. However, removing nvlink +* devices will need some work. * * At some point we want to remove the PDN completely anyways */ -pci_dev_get (dev); pdn->pe_number = pe->pe_number; pe->flags =PNV_IODA_PE_DEV ; pe->pdev = dev;
@@ -1084,7 +1083,6 @@ static struct pnv_ioda_pe *pnv_ioda_setup_dev_PE(struct pci_dev *dev)pnv_ioda_free_pe (pe); pdn->pe_number =IODA_INVALID_PE ; pe->pdev =NULL ; -pci_dev_put (dev);return NULL ; }
@@ -1205,6 +1203,14 @@ static struct pnv_ioda_pe *pnv_ioda_setup_npu_PE(struct pci_dev *npu_pdev)struct pci_controller *hose =pci_bus_to_host (npu_pdev->bus);struct pnv_phb *phb = hose->private_data; +/* +* Intentionally leak a reference on the npu device (for +* nvlink only; this is not an opencapi path) to make sure it +* never goes away, as it's been the case all along and some +* work is needed otherwise. +*/ +pci_dev_get (npu_pdev); +/* * Due to a hardware errata PE#0 on the NPU is reserved for * error handling. This means we only have three PEs remaining
@@ -1228,7 +1234,6 @@ static struct pnv_ioda_pe *pnv_ioda_setup_npu_PE(struct pci_dev *npu_pdev)*/ dev_info (&npu_pdev->dev,"Associating to existing PE %x\n" , pe_num); -pci_dev_get (npu_pdev); npu_pdn =pci_get_pdn (npu_pdev); rid = npu_pdev->bus->number <<8 | npu_pdn->devfn; npu_pdn->pe_number = pe_num;
Signature · 1 line
2.20.1
Re: [PATCH AUTOSEL 5.5 71/75] powerpc/powernv/ioda: Fix ref count for devices with their own PE
Le 18/04/2020 à 16:09, Sasha Levin a écrit :
Quoted 3 lines
From: Frederic Barrat <[email protected]>
[ Upstream commit
05dd7da76986937fb288b4213b1fa10dbe0d1b33]
Like for other stable kernels, patches 71, 72, 73 of this series are not desirable for stable.
Fred
Quoted 84 lines
The
pci_dnstructure used to store a pointer to the structpci_dev, so taking a reference on the device was required. However, thepci_devpointer was later removed from thepci_dnstructure, but the reference was kept for the npu device.
See commit902bdc57451c("powerpc/powernv/idoa: Remove unnecessary pcidev frompci_dn").We don't need to take a reference on the device when assigning the PE as the struct
pnv_ioda_peis cleaned up at the same time as the (physical) device is released. Doing so prevents the device from being released, which is a problem for opencapi devices, since we want to be able to remove them through PCI hotplug.Now the ugly part: nvlink npu devices are not meant to be released. Because of the above, we've always leaked a reference and simply removing it now is dangerous and would likely require more work. There's currently no release device callback for nvlink devices for example. So to be safe, this patch leaks a reference on the npu device, but only for nvlink and not opencapi.
Signed-off-by Frederic Barrat <[email protected]>Reviewed-by Andrew Donnellan <[email protected]>Signed-off-by Michael Ellerman <[email protected]>Signed-off-by Sasha Levin <[email protected]>--- arch/powerpc/platforms/powernv/pci-ioda.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-)arch/powerpc/platforms/powernv/pci-ioda.c +12
-7@@ -1062,14 +1062,13 @@ static struct pnv_ioda_pe *pnv_ioda_setup_dev_PE(struct pci_dev *dev)return NULL ; } -/* NOTE: We get only one ref to the pci_dev for the pdn, not for the -* pointer in the PE data structure, both should be destroyed at the -* same time. However, this needs to be looked at more closely again -* once we actually start removing things (Hotplug, SR-IOV, ...) +/* NOTE: We don't get a reference for the pointer in the PE +* data structure, both the device and PE structures should be +* destroyed at the same time. However, removing nvlink +* devices will need some work. * * At some point we want to remove the PDN completely anyways */ -pci_dev_get (dev); pdn->pe_number = pe->pe_number; pe->flags =PNV_IODA_PE_DEV ; pe->pdev = dev;@@ -1084,7 +1083,6 @@ static struct pnv_ioda_pe *pnv_ioda_setup_dev_PE(struct pci_dev *dev)pnv_ioda_free_pe (pe); pdn->pe_number =IODA_INVALID_PE ; pe->pdev =NULL ; -pci_dev_put (dev);return NULL ; }@@ -1205,6 +1203,14 @@ static struct pnv_ioda_pe *pnv_ioda_setup_npu_PE(struct pci_dev *npu_pdev)struct pci_controller *hose =pci_bus_to_host (npu_pdev->bus);struct pnv_phb *phb = hose->private_data; +/* +* Intentionally leak a reference on the npu device (for +* nvlink only; this is not an opencapi path) to make sure it +* never goes away, as it's been the case all along and some +* work is needed otherwise. +*/ +pci_dev_get (npu_pdev); +/* * Due to a hardware errata PE#0 on the NPU is reserved for * error handling. This means we only have three PEs remaining @@ -1228,7 +1234,6 @@ static struct pnv_ioda_pe *pnv_ioda_setup_npu_PE(struct pci_dev *npu_pdev)*/ dev_info (&npu_pdev->dev,"Associating to existing PE %x\n" , pe_num); -pci_dev_get (npu_pdev); npu_pdn =pci_get_pdn (npu_pdev); rid = npu_pdev->bus->number <<8 | npu_pdn->devfn; npu_pdn->pe_number = pe_num;
Sasha Levin
maintainerPATCH 72/75 pci/hotplug/pnv-php: Remove erroneous warning
In reply to Sasha LevinFrom: Frederic Barrat <[email protected]>
[ Upstream commit 658ab186dd22060408d94f5c5a6d02d809baba44 ]
On powernv, when removing a device through hotplug, the following warning is logged:
Invalid refcount <.> on <...>
It may be incorrect, the refcount may be set to a higher value than 1 and be valid. of_detach_node() can drop more than one reference. As it doesn't seem trivial to assert the correct value, let's remove the warning.
--- drivers/pci/hotplug/pnv_php.c | 6 ------ 1 file changed, 6 deletions(-)
drivers/pci/hotplug/pnv_php.c +0 -6
@@ -151,17 +151,11 @@ static void pnv_php_rmv_pdns(struct device_node *dn)static void pnv_php_detach_device_nodes (struct device_node *parent) {struct device_node *dn; -int refcount;for_each_child_of_node (parent, dn) {pnv_php_detach_device_nodes (dn);of_node_put (dn); - refcount =kref_read (&dn->kobj.kref); -if (refcount !=1 ) -pr_warn ("Invalid refcount %d on <%pOF>\n" , - refcount, dn); -of_detach_node (dn); } }
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 73/75 ocxl: Add PCI hotplug dependency to Kconfig
In reply to Sasha LevinFrom: Frederic Barrat <[email protected]>
[ Upstream commit 49ce94b8677c7d7a15c4d7cbbb9ff1cd8387827b ]
The PCI hotplug framework is used to update the devices when a new image is written to the FPGA.
--- drivers/misc/ocxl/Kconfig | 1 + 1 file changed, 1 insertion(+)
drivers/misc/ocxl/Kconfig +1 -0
@@ -11,6 +11,7 @@ config OCXL tristate "OpenCAPI coherent accelerator support" depends on PPC_POWERNV && PCI && EEH select OCXL_BASE + select HOTPLUG_PCI_POWERNV default m help Select this option to enable the ocxl driver for Open
Signature · 1 line
2.20.1
Re: [PATCH AUTOSEL 5.5 73/75] ocxl: Add PCI hotplug dependency to Kconfig
Quoted 7 lines · Sasha Levin
From: Frederic Barrat <[email protected]>
[ Upstream commit
49ce94b8677c7d7a15c4d7cbbb9ff1cd8387827b]The PCI hotplug framework is used to update the devices when a new image is written to the FPGA.
Quoted 6 lines
Reviewed-by Alastair D'Silva <[email protected]>Reviewed-by Andrew Donnellan <[email protected]>Signed-off-by Frederic Barrat <[email protected]>Signed-off-by Michael Ellerman <[email protected]>Signed-off-by Sasha Levin <[email protected]>
This shouldn't be backported to any of the stable trees.
Signature · 2 lines
Andrew Donnellan OzLabs, ADL Canberra [email protected] IBM Australia Limited
Sasha Levin
maintainerRe: [PATCH AUTOSEL 5.5 73/75] ocxl: Add PCI hotplug dependency to Kconfig
Quoted 8 lines · Andrew Donnellan
Quoted 7 lines · Sasha Levin
From: Frederic Barrat <[email protected]>
[ Upstream commit
49ce94b8677c7d7a15c4d7cbbb9ff1cd8387827b]The PCI hotplug framework is used to update the devices when a new image is written to the FPGA.
Quoted 8 lines
Quoted 6 lines
Reviewed-by Alastair D'Silva <[email protected]>Reviewed-by Andrew Donnellan <[email protected]>Signed-off-by Frederic Barrat <[email protected]>Signed-off-by Michael Ellerman <[email protected]>Signed-off-by Sasha Levin <[email protected]>This shouldn't be backported to any of the stable trees.
I'll drop it, thanks!
Signature · 2 lines
Thanks, Sasha
Sasha Levin
maintainerPATCH 74/75 virtio-blk: improve virtqueue error to BLK_STS
In reply to Sasha LevinFrom: Halil Pasic <[email protected]>
[ Upstream commit 3d973b2e9a625996ee997c7303cd793b9d197c65 ]
Let's change the mapping between virtqueue_add errors to BLK_STS statuses, so that -ENOSPC, which indicates virtqueue full is still mapped to BLK_STS_DEV_RESOURCE, but -ENOMEM which indicates non-device specific resource outage is mapped to BLK_STS_RESOURCE.
--- drivers/block/virtio_blk.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/block/virtio_blk.c +7 -2
@@ -345,9 +345,14 @@ static blk_status_t virtio_queue_rq(struct blk_mq_hw_ctx *hctx,if (err == -ENOSPC )blk_mq_stop_hw_queue (hctx);spin_unlock_irqrestore (&vblk->vqs[qid].lock, flags); -if (err == -ENOMEM || err == -ENOSPC ) +switch (err) { +case -ENOSPC :return BLK_STS_DEV_RESOURCE ; -return BLK_STS_IOERR ; +case -ENOMEM : +return BLK_STS_RESOURCE ; +default : +return BLK_STS_IOERR ; + } }if (bd->last &&virtqueue_kick_prepare (vblk->vqs[qid].vq))
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 75/75 block: fix busy device checking in blk_drop_partitions again
In reply to Sasha LevinFrom: Christoph Hellwig <[email protected]>
[ Upstream commit cb6b771b05c3026a85ed4817c1b87c5e6f41d136 ]
The previous fix had an off by one in the bd_openers checking, counting the callers blkdev_get.
--- block/partition-generic.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
block/partition-generic.c +1 -1
@@ -468,7 +468,7 @@ int blk_drop_partitions(struct gendisk *disk, struct block_device *bdev)if (!disk_part_scan_enabled (disk))return 0 ; -if (bdev->bd_part_count || bdev->bd_openers) +if (bdev->bd_part_count || bdev->bd_openers >1 )return -EBUSY ; res =invalidate_partition (disk,0 );if (res)
Signature · 1 line
2.20.1