···105105 G coefficient for temperature equation.106106 Default for series 5 = 60000107107 Default for series 6 = 57400108108- multipleOf: 1000108108+ multipleOf: 100109109 minimum: 1000110110 $ref: /schemas/types.yaml#/definitions/uint32111111···114114 H coefficient for temperature equation.115115 Default for series 5 = 200000116116 Default for series 6 = 249400117117- multipleOf: 1000117117+ multipleOf: 100118118 minimum: 1000119119 $ref: /schemas/types.yaml#/definitions/uint32120120···131131 J coefficient for temperature equation.132132 Default for series 5 = -100133133 Default for series 6 = 0134134- multipleOf: 1000134134+ multipleOf: 100135135 maximum: 0136136 $ref: /schemas/types.yaml#/definitions/int32137137
···11-* Universal Asynchronous Receiver/Transmitter (UART)22-33-- compatible: "cavium,octeon-3860-uart"44-55- Compatibility with all cn3XXX, cn5XXX and cn6XXX SOCs.66-77-- reg: The base address of the UART register bank.88-99-- interrupts: A single interrupt specifier.1010-1111-- current-speed: Optional, the current bit rate in bits per second.1212-1313-Example:1414- uart1: serial@1180000000c00 {1515- compatible = "cavium,octeon-3860-uart","ns16550";1616- reg = <0x11800 0x00000c00 0x0 0x400>;1717- current-speed = <115200>;1818- interrupts = <0 35>;1919- };
···11-* NXP LPC1850 UART22-33-Required properties:44-- compatible : "nxp,lpc1850-uart", "ns16550a".55-- reg : offset and length of the register set for the device.66-- interrupts : should contain uart interrupt.77-- clocks : phandle to the input clocks.88-- clock-names : required elements: "uartclk", "reg".99-1010-Optional properties:1111-- dmas : Two or more DMA channel specifiers following the1212- convention outlined in bindings/dma/dma.txt1313-- dma-names : Names for the dma channels, if present. There must1414- be at least one channel named "tx" for transmit1515- and named "rx" for receive.1616-1717-Since it's also possible to also use the of_serial.c driver all1818-parameters from 8250.txt also apply but are optional.1919-2020-Example:2121-uart0: serial@40081000 {2222- compatible = "nxp,lpc1850-uart", "ns16550a";2323- reg = <0x40081000 0x1000>;2424- reg-shift = <2>;2525- interrupts = <24>;2626- clocks = <&ccu2 CLK_APB0_UART0>, <&ccu1 CLK_CPU_UART0>;2727- clock-names = "uartclk", "reg";2828-};
···727727#define DBG_SS_ACTIVE_PENDING __vcpu_single_flag(sflags, BIT(5))728728/* PMUSERENR for the guest EL0 is on physical CPU */729729#define PMUSERENR_ON_CPU __vcpu_single_flag(sflags, BIT(6))730730+/* WFI instruction trapped */731731+#define IN_WFI __vcpu_single_flag(sflags, BIT(7))730732731733732734/* Pointer to the vcpu's SVE FFR for sve_{save,load}_state() */
+9-17
arch/arm64/include/asm/kvm_pgtable.h
···608608kvm_pte_t kvm_pgtable_stage2_mkyoung(struct kvm_pgtable *pgt, u64 addr);609609610610/**611611- * kvm_pgtable_stage2_mkold() - Clear the access flag in a page-table entry.611611+ * kvm_pgtable_stage2_test_clear_young() - Test and optionally clear the access612612+ * flag in a page-table entry.612613 * @pgt: Page-table structure initialised by kvm_pgtable_stage2_init*().613614 * @addr: Intermediate physical address to identify the page-table entry.615615+ * @size: Size of the address range to visit.616616+ * @mkold: True if the access flag should be cleared.614617 *615618 * The offset of @addr within a page is ignored.616619 *617617- * If there is a valid, leaf page-table entry used to translate @addr, then618618- * clear the access flag in that entry.620620+ * Tests and conditionally clears the access flag for every valid, leaf621621+ * page-table entry used to translate the range [@addr, @addr + @size).619622 *620623 * Note that it is the caller's responsibility to invalidate the TLB after621624 * calling this function to ensure that the updated permissions are visible622625 * to the CPUs.623626 *624624- * Return: The old page-table entry prior to clearing the flag, 0 on failure.627627+ * Return: True if any of the visited PTEs had the access flag set.625628 */626626-kvm_pte_t kvm_pgtable_stage2_mkold(struct kvm_pgtable *pgt, u64 addr);629629+bool kvm_pgtable_stage2_test_clear_young(struct kvm_pgtable *pgt, u64 addr,630630+ u64 size, bool mkold);627631628632/**629633 * kvm_pgtable_stage2_relax_perms() - Relax the permissions enforced by a···648644 */649645int kvm_pgtable_stage2_relax_perms(struct kvm_pgtable *pgt, u64 addr,650646 enum kvm_pgtable_prot prot);651651-652652-/**653653- * kvm_pgtable_stage2_is_young() - Test whether a page-table entry has the654654- * access flag set.655655- * @pgt: Page-table structure initialised by kvm_pgtable_stage2_init*().656656- * @addr: Intermediate physical address to identify the page-table entry.657657- *658658- * The offset of @addr within a page is ignored.659659- *660660- * Return: True if the page-table entry has the access flag set, false otherwise.661661- */662662-bool kvm_pgtable_stage2_is_young(struct kvm_pgtable *pgt, u64 addr);663647664648/**665649 * kvm_pgtable_stage2_flush_range() - Clean and invalidate data cache to Point
···847847int vec_set_vector_length(struct task_struct *task, enum vec_type type,848848 unsigned long vl, unsigned long flags)849849{850850+ bool free_sme = false;851851+850852 if (flags & ~(unsigned long)(PR_SVE_VL_INHERIT |851853 PR_SVE_SET_VL_ONEXEC))852854 return -EINVAL;···899897 task->thread.fp_type = FP_STATE_FPSIMD;900898 }901899902902- if (system_supports_sme() && type == ARM64_VEC_SME) {903903- task->thread.svcr &= ~(SVCR_SM_MASK |904904- SVCR_ZA_MASK);905905- clear_thread_flag(TIF_SME);900900+ if (system_supports_sme()) {901901+ if (type == ARM64_VEC_SME ||902902+ !(task->thread.svcr & (SVCR_SM_MASK | SVCR_ZA_MASK))) {903903+ /*904904+ * We are changing the SME VL or weren't using905905+ * SME anyway, discard the state and force a906906+ * reallocation.907907+ */908908+ task->thread.svcr &= ~(SVCR_SM_MASK |909909+ SVCR_ZA_MASK);910910+ clear_thread_flag(TIF_SME);911911+ free_sme = true;912912+ }906913 }907914908915 if (task == current)909916 put_cpu_fpsimd_context();910917911918 /*912912- * Force reallocation of task SVE and SME state to the correct913913- * size on next use:919919+ * Free the changed states if they are not in use, SME will be920920+ * reallocated to the correct size on next use and we just921921+ * allocate SVE now in case it is needed for use in streaming922922+ * mode.914923 */915915- sve_free(task);916916- if (system_supports_sme() && type == ARM64_VEC_SME)924924+ if (system_supports_sve()) {925925+ sve_free(task);926926+ sve_alloc(task, true);927927+ }928928+929929+ if (free_sme)917930 sme_free(task);918931919932 task_set_vl(task, type, vl);
···827827 assign_clear_set_bit(tpt, CNTHCTL_EL1PCEN << 10, set, clr);828828 assign_clear_set_bit(tpc, CNTHCTL_EL1PCTEN << 10, set, clr);829829830830- /* This only happens on VHE, so use the CNTKCTL_EL1 accessor */831831- sysreg_clear_set(cntkctl_el1, clr, set);830830+ /* This only happens on VHE, so use the CNTHCTL_EL2 accessor. */831831+ sysreg_clear_set(cnthctl_el2, clr, set);832832}833833834834void kvm_timer_vcpu_load(struct kvm_vcpu *vcpu)···15631563void kvm_timer_init_vhe(void)15641564{15651565 if (cpus_have_final_cap(ARM64_HAS_ECV_CNTPOFF))15661566- sysreg_clear_set(cntkctl_el1, 0, CNTHCTL_ECV);15661566+ sysreg_clear_set(cnthctl_el2, 0, CNTHCTL_ECV);15671567}1568156815691569int kvm_arm_timer_set_attr(struct kvm_vcpu *vcpu, struct kvm_device_attr *attr)
+24-4
arch/arm64/kvm/arm.c
···53535454DECLARE_KVM_NVHE_PER_CPU(struct kvm_cpu_context, kvm_hyp_ctxt);55555656-static bool vgic_present;5656+static bool vgic_present, kvm_arm_initialised;57575858static DEFINE_PER_CPU(unsigned char, kvm_arm_hardware_enabled);5959DEFINE_STATIC_KEY_FALSE(userspace_irqchip_in_use);6060+6161+bool is_kvm_arm_initialised(void)6262+{6363+ return kvm_arm_initialised;6464+}60656166int kvm_arch_vcpu_should_kick(struct kvm_vcpu *vcpu)6267{···718713 */719714 preempt_disable();720715 kvm_vgic_vmcr_sync(vcpu);721721- vgic_v4_put(vcpu, true);716716+ vcpu_set_flag(vcpu, IN_WFI);717717+ vgic_v4_put(vcpu);722718 preempt_enable();723719724720 kvm_vcpu_halt(vcpu);725721 vcpu_clear_flag(vcpu, IN_WFIT);726722727723 preempt_disable();724724+ vcpu_clear_flag(vcpu, IN_WFI);728725 vgic_v4_load(vcpu);729726 preempt_enable();730727}···794787 if (kvm_check_request(KVM_REQ_RELOAD_GICv4, vcpu)) {795788 /* The distributor enable bits were changed */796789 preempt_disable();797797- vgic_v4_put(vcpu, false);790790+ vgic_v4_put(vcpu);798791 vgic_v4_load(vcpu);799792 preempt_enable();800793 }···1874186718751868int kvm_arch_hardware_enable(void)18761869{18771877- int was_enabled = __this_cpu_read(kvm_arm_hardware_enabled);18701870+ int was_enabled;1878187118721872+ /*18731873+ * Most calls to this function are made with migration18741874+ * disabled, but not with preemption disabled. The former is18751875+ * enough to ensure correctness, but most of the helpers18761876+ * expect the later and will throw a tantrum otherwise.18771877+ */18781878+ preempt_disable();18791879+18801880+ was_enabled = __this_cpu_read(kvm_arm_hardware_enabled);18791881 _kvm_arch_hardware_enable(NULL);1880188218811883 if (!was_enabled) {18821884 kvm_vgic_cpu_up();18831885 kvm_timer_cpu_up();18841886 }18871887+18881888+ preempt_enable();1885188918861890 return 0;18871891}···24992481 err = kvm_init(sizeof(struct kvm_vcpu), 0, THIS_MODULE);25002482 if (err)25012483 goto out_subs;24842484+24852485+ kvm_arm_initialised = true;2502248625032487 return 0;25042488
+8
arch/arm64/kvm/hyp/hyp-entry.S
···154154 esb155155 stp x0, x1, [sp, #-16]!156156662:157157+ /*158158+ * spectre vectors __bp_harden_hyp_vecs generate br instructions at runtime159159+ * that jump at offset 8 at __kvm_hyp_vector.160160+ * As hyp .text is guarded section, it needs bti j.161161+ */162162+ bti j157163 b \target158164159165check_preamble_length 661b, 662b···171165 nop172166 stp x0, x1, [sp, #-16]!173167662:168168+ /* Check valid_vect */169169+ bti j174170 b \target175171176172check_preamble_length 661b, 662b
+10
arch/arm64/kvm/hyp/nvhe/host.S
···297297298298 ret299299SYM_CODE_END(__kvm_hyp_host_forward_smc)300300+301301+/*302302+ * kvm_host_psci_cpu_entry is called through br instruction, which requires303303+ * bti j instruction as compilers (gcc and llvm) doesn't insert bti j for external304304+ * functions, but bti c instead.305305+ */306306+SYM_CODE_START(kvm_host_psci_cpu_entry)307307+ bti j308308+ b __kvm_host_psci_cpu_entry309309+SYM_CODE_END(kvm_host_psci_cpu_entry)
···244244{245245 int ret;246246247247- if (!is_protected_kvm_enabled())247247+ if (!is_protected_kvm_enabled() || !is_kvm_arm_initialised())248248 return 0;249249250250 /*
···2424#include <linux/bug.h>2525#include <linux/mm.h>2626#include <linux/mmzone.h>2727+#include <linux/kfence.h>27282829static void *trans_alloc(struct trans_pgd_info *info)2930{···4241 * the temporary mappings we use during restore.4342 */4443 set_pte(dst_ptep, pte_mkwrite(pte));4545- } else if (debug_pagealloc_enabled() && !pte_none(pte)) {4444+ } else if ((debug_pagealloc_enabled() ||4545+ is_kfence_address((void *)addr)) && !pte_none(pte)) {4646 /*4747 * debug_pagealloc will removed the PTE_VALID bit if4848 * the page isn't in use by the resume kernel. It may have
+7-1
arch/arm64/net/bpf_jit_comp.c
···322322 *323323 */324324325325- emit_bti(A64_BTI_C, ctx);325325+ /* bpf function may be invoked by 3 instruction types:326326+ * 1. bl, attached via freplace to bpf prog via short jump327327+ * 2. br, attached via freplace to bpf prog via long jump328328+ * 3. blr, working as a function pointer, used by emit_call.329329+ * So BTI_JC should used here to support both br and blr.330330+ */331331+ emit_bti(A64_BTI_JC, ctx);326332327333 emit(A64_MOV(1, A64_R(9), A64_LR), ctx);328334 emit(A64_NOP, ctx);
···2727#include <linux/elf-randomize.h>28282929/*3030- * Construct an artificial page offset for the mapping based on the physical3030+ * Construct an artificial page offset for the mapping based on the virtual3131 * address of the kernel file mapping variable.3232+ * If filp is zero the calculated pgoff value aliases the memory of the given3333+ * address. This is useful for io_uring where the mapping shall alias a kernel3434+ * address and a userspace adress where both the kernel and the userspace3535+ * access the same memory region.3236 */3333-#define GET_FILP_PGOFF(filp) \3434- (filp ? (((unsigned long) filp->f_mapping) >> 8) \3535- & ((SHM_COLOUR-1) >> PAGE_SHIFT) : 0UL)3737+#define GET_FILP_PGOFF(filp, addr) \3838+ ((filp ? (((unsigned long) filp->f_mapping) >> 8) \3939+ & ((SHM_COLOUR-1) >> PAGE_SHIFT) : 0UL) \4040+ + (addr >> PAGE_SHIFT))36413742static unsigned long shared_align_offset(unsigned long filp_pgoff,3843 unsigned long pgoff)···117112 do_color_align = 0;118113 if (filp || (flags & MAP_SHARED))119114 do_color_align = 1;120120- filp_pgoff = GET_FILP_PGOFF(filp);115115+ filp_pgoff = GET_FILP_PGOFF(filp, addr);121116122117 if (flags & MAP_FIXED) {123118 /* Even MAP_FIXED mappings must reside within TASK_SIZE */
···744744 }745745746746 task_ref = &win->vas_win.task_ref;747747+ /*748748+ * VAS mmap (coproc_mmap()) and its fault handler749749+ * (vas_mmap_fault()) are called after holding mmap lock.750750+ * So hold mmap mutex after mmap_lock to avoid deadlock.751751+ */752752+ mmap_write_lock(task_ref->mm);747753 mutex_lock(&task_ref->mmap_mutex);748754 vma = task_ref->vma;749755 /*···758752 */759753 win->vas_win.status |= flag;760754761761- mmap_write_lock(task_ref->mm);762755 /*763756 * vma is set in the original mapping. But this mapping764757 * is done with mmap() after the window is opened with ioctl.···767762 if (vma)768763 zap_vma_pages(vma);769764770770- mmap_write_unlock(task_ref->mm);771765 mutex_unlock(&task_ref->mmap_mutex);766766+ mmap_write_unlock(task_ref->mm);772767 /*773768 * Close VAS window in the hypervisor, but do not774769 * free vas_window struct since it may be reused
···411411 u16 _rc, _rrc;412412 int cc = 0;413413414414- /* Make sure the counter does not reach 0 before calling s390_uv_destroy_range */415415- atomic_inc(&kvm->mm->context.protected_count);414414+ /*415415+ * Nothing to do if the counter was already 0. Otherwise make sure416416+ * the counter does not reach 0 before calling s390_uv_destroy_range.417417+ */418418+ if (!atomic_inc_not_zero(&kvm->mm->context.protected_count))419419+ return 0;416420417421 *rc = 1;418422 /* If the current VM is protected, destroy it */
+2
arch/s390/mm/fault.c
···421421 vma_end_read(vma);422422 if (!(fault & VM_FAULT_RETRY)) {423423 count_vm_vma_lock_event(VMA_LOCK_SUCCESS);424424+ if (likely(!(fault & VM_FAULT_ERROR)))425425+ fault = 0;424426 goto out;425427 }426428 count_vm_vma_lock_event(VMA_LOCK_RETRY);
···11441144{11451145 if (!list_empty(&plug->cb_list))11461146 flush_plug_callbacks(plug, from_schedule);11471147- if (!rq_list_empty(plug->mq_list))11481148- blk_mq_flush_plug_list(plug, from_schedule);11471147+ blk_mq_flush_plug_list(plug, from_schedule);11491148 /*11501149 * Unconditionally flush out cached requests, even if the unplug11511150 * event came from schedule. Since we know hold references to the
+4
block/blk-iocost.c
···25162516 u64 seek_pages = 0;25172517 u64 cost = 0;2518251825192519+ /* Can't calculate cost for empty bio */25202520+ if (!bio->bi_iter.bi_size)25212521+ goto out;25222522+25192523 switch (bio_op(bio)) {25202524 case REQ_OP_READ:25212525 coef_seqio = ioc->params.lcoefs[LCOEF_RSEQIO];
+8-1
block/blk-mq.c
···27542754{27552755 struct request *rq;2756275627572757- if (rq_list_empty(plug->mq_list))27572757+ /*27582758+ * We may have been called recursively midway through handling27592759+ * plug->mq_list via a schedule() in the driver's queue_rq() callback.27602760+ * To avoid mq_list changing under our feet, clear rq_count early and27612761+ * bail out specifically if rq_count is 0 rather than checking27622762+ * whether the mq_list is empty.27632763+ */27642764+ if (plug->rq_count == 0)27582765 return;27592766 plug->rq_count = 0;27602767
···1414#include <linux/mm.h>1515#include <linux/moduleparam.h>1616#include <linux/mutex.h>1717+#include <linux/overflow.h>1718#include <linux/pci.h>1819#include <linux/scatterlist.h>1920#include <linux/types.h>···367366 if (in_trans->hdr.len % 8 != 0)368367 return -EINVAL;369368370370- if (msg_hdr_len + in_trans->hdr.len > QAIC_MANAGE_EXT_MSG_LENGTH)369369+ if (size_add(msg_hdr_len, in_trans->hdr.len) > QAIC_MANAGE_EXT_MSG_LENGTH)371370 return -ENOSPC;372371373372 trans_wrapper = add_wrapper(wrappers,···419418 }420419421420 ret = get_user_pages_fast(xfer_start_addr, nr_pages, 0, page_list);422422- if (ret < 0 || ret != nr_pages) {423423- ret = -EFAULT;421421+ if (ret < 0)424422 goto free_page_list;423423+ if (ret != nr_pages) {424424+ nr_pages = ret;425425+ ret = -EFAULT;426426+ goto put_pages;425427 }426428427429 sgt = kmalloc(sizeof(*sgt), GFP_KERNEL);···561557 msg = &wrapper->msg;562558 msg_hdr_len = le32_to_cpu(msg->hdr.len);563559564564- if (msg_hdr_len > (UINT_MAX - QAIC_MANAGE_EXT_MSG_LENGTH))565565- return -EINVAL;566566-567560 /* There should be enough space to hold at least one ASP entry. */568568- if (msg_hdr_len + sizeof(*out_trans) + sizeof(struct wire_addr_size_pair) >561561+ if (size_add(msg_hdr_len, sizeof(*out_trans) + sizeof(struct wire_addr_size_pair)) >569562 QAIC_MANAGE_EXT_MSG_LENGTH)570563 return -ENOMEM;571564···635634 msg = &wrapper->msg;636635 msg_hdr_len = le32_to_cpu(msg->hdr.len);637636638638- if (msg_hdr_len + sizeof(*out_trans) > QAIC_MANAGE_MAX_MSG_LENGTH)637637+ if (size_add(msg_hdr_len, sizeof(*out_trans)) > QAIC_MANAGE_MAX_MSG_LENGTH)639638 return -ENOSPC;640639641640 if (!in_trans->queue_size)···719718 msg = &wrapper->msg;720719 msg_hdr_len = le32_to_cpu(msg->hdr.len);721720722722- if (msg_hdr_len + in_trans->hdr.len > QAIC_MANAGE_MAX_MSG_LENGTH)721721+ if (size_add(msg_hdr_len, in_trans->hdr.len) > QAIC_MANAGE_MAX_MSG_LENGTH)723722 return -ENOSPC;724723725724 trans_wrapper = add_wrapper(wrappers, sizeof(*trans_wrapper));···749748 int ret;750749 int i;751750752752- if (!user_msg->count) {751751+ if (!user_msg->count ||752752+ user_msg->len < sizeof(*trans_hdr)) {753753 ret = -EINVAL;754754 goto out;755755 }···767765 }768766769767 for (i = 0; i < user_msg->count; ++i) {770770- if (user_len >= user_msg->len) {768768+ if (user_len > user_msg->len - sizeof(*trans_hdr)) {771769 ret = -EINVAL;772770 break;773771 }774772 trans_hdr = (struct qaic_manage_trans_hdr *)(user_msg->data + user_len);775775- if (user_len + trans_hdr->len > user_msg->len) {773773+ if (trans_hdr->len < sizeof(trans_hdr) ||774774+ size_add(user_len, trans_hdr->len) > user_msg->len) {776775 ret = -EINVAL;777776 break;778777 }···956953 int ret;957954 int i;958955959959- if (msg_hdr_len > QAIC_MANAGE_MAX_MSG_LENGTH)956956+ if (msg_hdr_len < sizeof(*trans_hdr) ||957957+ msg_hdr_len > QAIC_MANAGE_MAX_MSG_LENGTH)960958 return -EINVAL;961959962960 user_msg->len = 0;963961 user_msg->count = le32_to_cpu(msg->hdr.count);964962965963 for (i = 0; i < user_msg->count; ++i) {964964+ u32 hdr_len;965965+966966+ if (msg_len > msg_hdr_len - sizeof(*trans_hdr))967967+ return -EINVAL;968968+966969 trans_hdr = (struct wire_trans_hdr *)(msg->data + msg_len);967967- if (msg_len + le32_to_cpu(trans_hdr->len) > msg_hdr_len)970970+ hdr_len = le32_to_cpu(trans_hdr->len);971971+ if (hdr_len < sizeof(*trans_hdr) ||972972+ size_add(msg_len, hdr_len) > msg_hdr_len)968973 return -EINVAL;969974970975 switch (le32_to_cpu(trans_hdr->type)) {
+2
drivers/ata/pata_parport/aten.c
···139139};140140141141MODULE_LICENSE("GPL");142142+MODULE_AUTHOR("Grant R. Guenther <grant@torque.net>");143143+MODULE_DESCRIPTION("ATEN EH-100 parallel port IDE adapter protocol driver");142144module_pata_parport_driver(aten);
+2
drivers/ata/pata_parport/bpck.c
···502502};503503504504MODULE_LICENSE("GPL");505505+MODULE_AUTHOR("Grant R. Guenther <grant@torque.net>");506506+MODULE_DESCRIPTION("MicroSolutions BACKPACK parallel port IDE adapter protocol driver");505507module_pata_parport_driver(bpck);
+2-1
drivers/ata/pata_parport/bpck6.c
···459459460460MODULE_LICENSE("GPL");461461MODULE_AUTHOR("Micro Solutions Inc.");462462-MODULE_DESCRIPTION("BACKPACK Protocol module, compatible with PARIDE");462462+MODULE_DESCRIPTION("Micro Solutions BACKPACK parallel port IDE adapter "463463+ "(version 6 drives) protocol driver");463464module_pata_parport_driver(bpck6);
+2
drivers/ata/pata_parport/comm.c
···201201};202202203203MODULE_LICENSE("GPL");204204+MODULE_AUTHOR("Grant R. Guenther <grant@torque.net>");205205+MODULE_DESCRIPTION("DataStor Commuter parallel port IDE adapter protocol driver");204206module_pata_parport_driver(comm);
+2
drivers/ata/pata_parport/dstr.c
···230230};231231232232MODULE_LICENSE("GPL");233233+MODULE_AUTHOR("Grant R. Guenther <grant@torque.net>");234234+MODULE_DESCRIPTION("DataStor EP2000 parallel port IDE adapter protocol driver");233235module_pata_parport_driver(dstr);
+3
drivers/ata/pata_parport/epat.c
···358358}359359360360MODULE_LICENSE("GPL");361361+MODULE_AUTHOR("Grant R. Guenther <grant@torque.net>");362362+MODULE_DESCRIPTION("Shuttle Technologies EPAT parallel port IDE adapter "363363+ "protocol driver");361364module_init(epat_init)362365module_exit(epat_exit)
+3
drivers/ata/pata_parport/epia.c
···306306};307307308308MODULE_LICENSE("GPL");309309+MODULE_AUTHOR("Grant R. Guenther <grant@torque.net>");310310+MODULE_DESCRIPTION("Shuttle Technologies EPIA parallel port IDE adapter "311311+ "protocol driver");309312module_pata_parport_driver(epia);
+3
drivers/ata/pata_parport/fit2.c
···132132};133133134134MODULE_LICENSE("GPL");135135+MODULE_AUTHOR("Grant R. Guenther <grant@torque.net>");136136+MODULE_DESCRIPTION("Fidelity International Technology parallel port IDE adapter"137137+ "(older models) protocol driver");135138module_pata_parport_driver(fit2);
+3
drivers/ata/pata_parport/fit3.c
···193193};194194195195MODULE_LICENSE("GPL");196196+MODULE_AUTHOR("Grant R. Guenther <grant@torque.net>");197197+MODULE_DESCRIPTION("Fidelity International Technology parallel port IDE adapter"198198+ "(newer models) protocol driver");196199module_pata_parport_driver(fit3);
+2
drivers/ata/pata_parport/friq.c
···259259};260260261261MODULE_LICENSE("GPL");262262+MODULE_AUTHOR("Grant R. Guenther <grant@torque.net>");263263+MODULE_DESCRIPTION("Freecom IQ parallel port IDE adapter protocol driver");262264module_pata_parport_driver(friq);
+2
drivers/ata/pata_parport/frpw.c
···293293};294294295295MODULE_LICENSE("GPL");296296+MODULE_AUTHOR("Grant R. Guenther <grant@torque.net>");297297+MODULE_DESCRIPTION("Freecom Power parallel port IDE adapter protocol driver");296298module_pata_parport_driver(frpw);
+3
drivers/ata/pata_parport/kbic.c
···301301}302302303303MODULE_LICENSE("GPL");304304+MODULE_AUTHOR("Grant R. Guenther <grant@torque.net>");305305+MODULE_DESCRIPTION("KingByte Information Systems KBIC-951A and KBIC-971A "306306+ "parallel port IDE adapter protocol driver");304307module_init(kbic_init)305308module_exit(kbic_exit)
+2
drivers/ata/pata_parport/ktti.c
···106106};107107108108MODULE_LICENSE("GPL");109109+MODULE_AUTHOR("Grant R. Guenther <grant@torque.net>");110110+MODULE_DESCRIPTION("KT Technology parallel port IDE adapter protocol driver");109111module_pata_parport_driver(ktti);
+2
drivers/ata/pata_parport/on20.c
···142142};143143144144MODULE_LICENSE("GPL");145145+MODULE_AUTHOR("Grant R. Guenther <grant@torque.net>");146146+MODULE_DESCRIPTION("Onspec 90c20 parallel port IDE adapter protocol driver");145147module_pata_parport_driver(on20);
+2
drivers/ata/pata_parport/on26.c
···310310};311311312312MODULE_LICENSE("GPL");313313+MODULE_AUTHOR("Grant R. Guenther <grant@torque.net>");314314+MODULE_DESCRIPTION("Onspec 90c26 parallel port IDE adapter protocol driver");313315module_pata_parport_driver(on26);
+4
drivers/base/regmap/regcache-rbtree.c
···471471 unsigned int start, end;472472 int ret;473473474474+ map->async = true;475475+474476 rbtree_ctx = map->cache;475477 for (node = rb_first(&rbtree_ctx->root); node; node = rb_next(node)) {476478 rbnode = rb_entry(node, struct regcache_rbtree_node, node);···500498 if (ret != 0)501499 return ret;502500 }501501+502502+ map->async = false;503503504504 return regmap_async_complete(map);505505}
-3
drivers/base/regmap/regcache.c
···368368 if (!map->cache_dirty)369369 goto out;370370371371- map->async = true;372372-373371 /* Apply any patch first */374372 map->cache_bypass = true;375373 for (i = 0; i < map->patch_regs; i++) {···390392391393out:392394 /* Restore the bypass state */393393- map->async = false;394395 map->cache_bypass = bypass;395396 map->no_sync_defaults = false;396397 map->unlock(map->lock_arg);
···17751775/*17761776 * If max_loop is specified, create that many devices upfront.17771777 * This also becomes a hard limit. If max_loop is not specified,17781778+ * the default isn't a hard limit (as before commit 85c50197716c17791779+ * changed the default value from 0 for max_loop=0 reasons), just17781780 * create CONFIG_BLK_DEV_LOOP_MIN_COUNT loop devices at module17791781 * init time. Loop devices can be requested on-demand with the17801782 * /dev/loop-control interface, or be instantiated by accessing17811783 * a 'dead' device node.17821784 */17831785static int max_loop = CONFIG_BLK_DEV_LOOP_MIN_COUNT;17841784-module_param(max_loop, int, 0444);17861786+17871787+#ifdef CONFIG_BLOCK_LEGACY_AUTOLOAD17881788+static bool max_loop_specified;17891789+17901790+static int max_loop_param_set_int(const char *val,17911791+ const struct kernel_param *kp)17921792+{17931793+ int ret;17941794+17951795+ ret = param_set_int(val, kp);17961796+ if (ret < 0)17971797+ return ret;17981798+17991799+ max_loop_specified = true;18001800+ return 0;18011801+}18021802+18031803+static const struct kernel_param_ops max_loop_param_ops = {18041804+ .set = max_loop_param_set_int,18051805+ .get = param_get_int,18061806+};18071807+18081808+module_param_cb(max_loop, &max_loop_param_ops, &max_loop, 0444);17851809MODULE_PARM_DESC(max_loop, "Maximum number of loop devices");18101810+#else18111811+module_param(max_loop, int, 0444);18121812+MODULE_PARM_DESC(max_loop, "Initial number of loop devices");18131813+#endif18141814+17861815module_param(max_part, int, 0444);17871816MODULE_PARM_DESC(max_part, "Maximum number of partitions per loop device");17881817···21222093 put_disk(lo->lo_disk);21232094}2124209520962096+#ifdef CONFIG_BLOCK_LEGACY_AUTOLOAD21252097static void loop_probe(dev_t dev)21262098{21272099 int idx = MINOR(dev) >> part_shift;2128210021292129- if (max_loop && idx >= max_loop)21012101+ if (max_loop_specified && max_loop && idx >= max_loop)21302102 return;21312103 loop_add(idx);21322104}21052105+#else21062106+#define loop_probe NULL21072107+#endif /* !CONFIG_BLOCK_LEGACY_AUTOLOAD */2133210821342109static int loop_control_remove(int idx)21352110{···23142281static int __init max_loop_setup(char *str)23152282{23162283 max_loop = simple_strtol(str, NULL, 0);22842284+#ifdef CONFIG_BLOCK_LEGACY_AUTOLOAD22852285+ max_loop_specified = true;22862286+#endif23172287 return 1;23182288}23192289
···563563 u32 rsp_size;564564 int ret;565565566566- INIT_LIST_HEAD(&acpi_resource_list);567567- ret = acpi_dev_get_resources(device, &acpi_resource_list,568568- crb_check_resource, iores_array);569569- if (ret < 0)570570- return ret;571571- acpi_dev_free_resource_list(&acpi_resource_list);572572-573573- /* Pluton doesn't appear to define ACPI memory regions */566566+ /*567567+ * Pluton sometimes does not define ACPI memory regions.568568+ * Mapping is then done in crb_map_pluton569569+ */574570 if (priv->sm != ACPI_TPM2_COMMAND_BUFFER_WITH_PLUTON) {571571+ INIT_LIST_HEAD(&acpi_resource_list);572572+ ret = acpi_dev_get_resources(device, &acpi_resource_list,573573+ crb_check_resource, iores_array);574574+ if (ret < 0)575575+ return ret;576576+ acpi_dev_free_resource_list(&acpi_resource_list);577577+575578 if (resource_type(iores_array) != IORESOURCE_MEM) {576579 dev_err(dev, FW_BUG "TPM2 ACPI table does not define a memory resource\n");577580 return -EINVAL;
···6868 enum AMDGPU_XCP_IP_BLOCK ip_blk;6969 uint32_t inst_mask;70707171- ring->xcp_id = ~0;7171+ ring->xcp_id = AMDGPU_XCP_NO_PARTITION;7272 if (adev->xcp_mgr->mode == AMDGPU_XCP_MODE_NONE)7373 return;7474···177177 u32 sel_xcp_id;178178 int i;179179180180- if (fpriv->xcp_id == ~0) {180180+ if (fpriv->xcp_id == AMDGPU_XCP_NO_PARTITION) {181181 u32 least_ref_cnt = ~0;182182183183 fpriv->xcp_id = 0;
+1
drivers/gpu/drm/amd/amdgpu/psp_v13_0.c
···4949MODULE_FIRMWARE("amdgpu/psp_13_0_11_toc.bin");5050MODULE_FIRMWARE("amdgpu/psp_13_0_11_ta.bin");5151MODULE_FIRMWARE("amdgpu/psp_13_0_6_sos.bin");5252+MODULE_FIRMWARE("amdgpu/psp_13_0_6_ta.bin");52535354/* For large FW files the time to complete can be very long */5455#define USBC_PD_POLLING_LIMIT_S 240
+103-153
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
···424424425425 spin_lock_irqsave(&adev_to_drm(adev)->event_lock, flags);426426427427- if (amdgpu_crtc->pflip_status != AMDGPU_FLIP_SUBMITTED){428428- DC_LOG_PFLIP("amdgpu_crtc->pflip_status = %d !=AMDGPU_FLIP_SUBMITTED(%d) on crtc:%d[%p] \n",429429- amdgpu_crtc->pflip_status,430430- AMDGPU_FLIP_SUBMITTED,431431- amdgpu_crtc->crtc_id,432432- amdgpu_crtc);427427+ if (amdgpu_crtc->pflip_status != AMDGPU_FLIP_SUBMITTED) {428428+ DC_LOG_PFLIP("amdgpu_crtc->pflip_status = %d !=AMDGPU_FLIP_SUBMITTED(%d) on crtc:%d[%p]\n",429429+ amdgpu_crtc->pflip_status,430430+ AMDGPU_FLIP_SUBMITTED,431431+ amdgpu_crtc->crtc_id,432432+ amdgpu_crtc);433433 spin_unlock_irqrestore(&adev_to_drm(adev)->event_lock, flags);434434 return;435435 }···883883}884884885885/* Prototypes of private functions */886886-static int dm_early_init(void* handle);886886+static int dm_early_init(void *handle);887887888888/* Allocate memory for FBC compressed data */889889static void amdgpu_dm_fbc_init(struct drm_connector *connector)···12821282 pa_config->system_aperture.start_addr = (uint64_t)logical_addr_low << 18;12831283 pa_config->system_aperture.end_addr = (uint64_t)logical_addr_high << 18;1284128412851285- pa_config->system_aperture.agp_base = (uint64_t)agp_base << 24 ;12851285+ pa_config->system_aperture.agp_base = (uint64_t)agp_base << 24;12861286 pa_config->system_aperture.agp_bot = (uint64_t)agp_bot << 24;12871287 pa_config->system_aperture.agp_top = (uint64_t)agp_top << 24;12881288···13471347 if (amdgpu_in_reset(adev))13481348 goto skip;1349134913501350+ if (offload_work->data.bytes.device_service_irq.bits.UP_REQ_MSG_RDY ||13511351+ offload_work->data.bytes.device_service_irq.bits.DOWN_REP_MSG_RDY) {13521352+ dm_handle_mst_sideband_msg_ready_event(&aconnector->mst_mgr, DOWN_OR_UP_MSG_RDY_EVENT);13531353+ spin_lock_irqsave(&offload_work->offload_wq->offload_lock, flags);13541354+ offload_work->offload_wq->is_handling_mst_msg_rdy_event = false;13551355+ spin_unlock_irqrestore(&offload_work->offload_wq->offload_lock, flags);13561356+ goto skip;13571357+ }13581358+13501359 mutex_lock(&adev->dm.dc_lock);13511360 if (offload_work->data.bytes.device_service_irq.bits.AUTOMATED_TEST) {13521361 dc_link_dp_handle_automated_test(dc_link);···13741365 DP_TEST_RESPONSE,13751366 &test_response.raw,13761367 sizeof(test_response));13771377- }13781378- else if ((dc_link->connector_signal != SIGNAL_TYPE_EDP) &&13681368+ } else if ((dc_link->connector_signal != SIGNAL_TYPE_EDP) &&13791369 dc_link_check_link_loss_status(dc_link, &offload_work->data) &&13801370 dc_link_dp_allow_hpd_rx_irq(dc_link)) {13811371 /* offload_work->data is from handle_hpd_rx_irq->···15621554 mutex_init(&adev->dm.dc_lock);15631555 mutex_init(&adev->dm.audio_lock);1564155615651565- if(amdgpu_dm_irq_init(adev)) {15571557+ if (amdgpu_dm_irq_init(adev)) {15661558 DRM_ERROR("amdgpu: failed to initialize DM IRQ support.\n");15671559 goto error;15681560 }···17041696 if (amdgpu_dc_debug_mask & DC_DISABLE_STUTTER)17051697 adev->dm.dc->debug.disable_stutter = true;1706169817071707- if (amdgpu_dc_debug_mask & DC_DISABLE_DSC) {16991699+ if (amdgpu_dc_debug_mask & DC_DISABLE_DSC)17081700 adev->dm.dc->debug.disable_dsc = true;17091709- }1710170117111702 if (amdgpu_dc_debug_mask & DC_DISABLE_CLOCK_GATING)17121703 adev->dm.dc->debug.disable_clock_gate = true;···19491942 mutex_destroy(&adev->dm.audio_lock);19501943 mutex_destroy(&adev->dm.dc_lock);19511944 mutex_destroy(&adev->dm.dpia_aux_lock);19521952-19531953- return;19541945}1955194619561947static int load_dmcu_fw(struct amdgpu_device *adev)···19571952 int r;19581953 const struct dmcu_firmware_header_v1_0 *hdr;1959195419601960- switch(adev->asic_type) {19551955+ switch (adev->asic_type) {19611956#if defined(CONFIG_DRM_AMD_DC_SI)19621957 case CHIP_TAHITI:19631958 case CHIP_PITCAIRN:···27142709 struct dc_scaling_info scaling_infos[MAX_SURFACES];27152710 struct dc_flip_addrs flip_addrs[MAX_SURFACES];27162711 struct dc_stream_update stream_update;27172717- } * bundle;27122712+ } *bundle;27182713 int k, m;2719271427202715 bundle = kzalloc(sizeof(*bundle), GFP_KERNEL);···2744273927452740cleanup:27462741 kfree(bundle);27472747-27482748- return;27492742}2750274327512744static int dm_resume(void *handle)···29572954 .set_powergating_state = dm_set_powergating_state,29582955};2959295629602960-const struct amdgpu_ip_block_version dm_ip_block =29612961-{29572957+const struct amdgpu_ip_block_version dm_ip_block = {29622958 .type = AMD_IP_BLOCK_TYPE_DCE,29632959 .major = 1,29642960 .minor = 0,···30023000 caps->ext_caps = &aconnector->dc_link->dpcd_sink_ext_caps;30033001 caps->aux_support = false;3004300230053005- if (caps->ext_caps->bits.oled == 1 /*||30063006- caps->ext_caps->bits.sdr_aux_backlight_control == 1 ||30073007- caps->ext_caps->bits.hdr_aux_backlight_control == 1*/)30033003+ if (caps->ext_caps->bits.oled == 130043004+ /*30053005+ * ||30063006+ * caps->ext_caps->bits.sdr_aux_backlight_control == 1 ||30073007+ * caps->ext_caps->bits.hdr_aux_backlight_control == 130083008+ */)30083009 caps->aux_support = true;3009301030103011 if (amdgpu_backlight == 0)···3241323632423237}3243323832443244-static void dm_handle_mst_sideband_msg(struct amdgpu_dm_connector *aconnector)32453245-{32463246- u8 esi[DP_PSR_ERROR_STATUS - DP_SINK_COUNT_ESI] = { 0 };32473247- u8 dret;32483248- bool new_irq_handled = false;32493249- int dpcd_addr;32503250- int dpcd_bytes_to_read;32513251-32523252- const int max_process_count = 30;32533253- int process_count = 0;32543254-32553255- const struct dc_link_status *link_status = dc_link_get_status(aconnector->dc_link);32563256-32573257- if (link_status->dpcd_caps->dpcd_rev.raw < 0x12) {32583258- dpcd_bytes_to_read = DP_LANE0_1_STATUS - DP_SINK_COUNT;32593259- /* DPCD 0x200 - 0x201 for downstream IRQ */32603260- dpcd_addr = DP_SINK_COUNT;32613261- } else {32623262- dpcd_bytes_to_read = DP_PSR_ERROR_STATUS - DP_SINK_COUNT_ESI;32633263- /* DPCD 0x2002 - 0x2005 for downstream IRQ */32643264- dpcd_addr = DP_SINK_COUNT_ESI;32653265- }32663266-32673267- dret = drm_dp_dpcd_read(32683268- &aconnector->dm_dp_aux.aux,32693269- dpcd_addr,32703270- esi,32713271- dpcd_bytes_to_read);32723272-32733273- while (dret == dpcd_bytes_to_read &&32743274- process_count < max_process_count) {32753275- u8 ack[DP_PSR_ERROR_STATUS - DP_SINK_COUNT_ESI] = {};32763276- u8 retry;32773277- dret = 0;32783278-32793279- process_count++;32803280-32813281- DRM_DEBUG_DRIVER("ESI %02x %02x %02x\n", esi[0], esi[1], esi[2]);32823282- /* handle HPD short pulse irq */32833283- if (aconnector->mst_mgr.mst_state)32843284- drm_dp_mst_hpd_irq_handle_event(&aconnector->mst_mgr,32853285- esi,32863286- ack,32873287- &new_irq_handled);32883288-32893289- if (new_irq_handled) {32903290- /* ACK at DPCD to notify down stream */32913291- for (retry = 0; retry < 3; retry++) {32923292- ssize_t wret;32933293-32943294- wret = drm_dp_dpcd_writeb(&aconnector->dm_dp_aux.aux,32953295- dpcd_addr + 1,32963296- ack[1]);32973297- if (wret == 1)32983298- break;32993299- }33003300-33013301- if (retry == 3) {33023302- DRM_ERROR("Failed to ack MST event.\n");33033303- return;33043304- }33053305-33063306- drm_dp_mst_hpd_irq_send_new_request(&aconnector->mst_mgr);33073307- /* check if there is new irq to be handled */33083308- dret = drm_dp_dpcd_read(33093309- &aconnector->dm_dp_aux.aux,33103310- dpcd_addr,33113311- esi,33123312- dpcd_bytes_to_read);33133313-33143314- new_irq_handled = false;33153315- } else {33163316- break;33173317- }33183318- }33193319-33203320- if (process_count == max_process_count)33213321- DRM_DEBUG_DRIVER("Loop exceeded max iterations\n");33223322-}33233323-33243239static void schedule_hpd_rx_offload_work(struct hpd_rx_irq_offload_work_queue *offload_wq,33253240 union hpd_irq_data hpd_irq_data)33263241{···33023377 if (dc_link_dp_allow_hpd_rx_irq(dc_link)) {33033378 if (hpd_irq_data.bytes.device_service_irq.bits.UP_REQ_MSG_RDY ||33043379 hpd_irq_data.bytes.device_service_irq.bits.DOWN_REP_MSG_RDY) {33053305- dm_handle_mst_sideband_msg(aconnector);33803380+ bool skip = false;33813381+33823382+ /*33833383+ * DOWN_REP_MSG_RDY is also handled by polling method33843384+ * mgr->cbs->poll_hpd_irq()33853385+ */33863386+ spin_lock(&offload_wq->offload_lock);33873387+ skip = offload_wq->is_handling_mst_msg_rdy_event;33883388+33893389+ if (!skip)33903390+ offload_wq->is_handling_mst_msg_rdy_event = true;33913391+33923392+ spin_unlock(&offload_wq->offload_lock);33933393+33943394+ if (!skip)33953395+ schedule_hpd_rx_offload_work(offload_wq, hpd_irq_data);33963396+33063397 goto out;33073398 }33083399···34093468 aconnector = to_amdgpu_dm_connector(connector);34103469 dc_link = aconnector->dc_link;3411347034123412- if (DC_IRQ_SOURCE_INVALID != dc_link->irq_source_hpd) {34713471+ if (dc_link->irq_source_hpd != DC_IRQ_SOURCE_INVALID) {34133472 int_params.int_context = INTERRUPT_LOW_IRQ_CONTEXT;34143473 int_params.irq_source = dc_link->irq_source_hpd;34153474···34183477 (void *) aconnector);34193478 }3420347934213421- if (DC_IRQ_SOURCE_INVALID != dc_link->irq_source_hpd_rx) {34803480+ if (dc_link->irq_source_hpd_rx != DC_IRQ_SOURCE_INVALID) {3422348134233482 /* Also register for DP short pulse (hpd_rx). */34243483 int_params.int_context = INTERRUPT_LOW_IRQ_CONTEXT;···34273486 amdgpu_dm_irq_register_interrupt(adev, &int_params,34283487 handle_hpd_rx_irq,34293488 (void *) aconnector);34303430-34313431- if (adev->dm.hpd_rx_offload_wq)34323432- adev->dm.hpd_rx_offload_wq[dc_link->link_index].aconnector =34333433- aconnector;34343489 }34903490+34913491+ if (adev->dm.hpd_rx_offload_wq)34923492+ adev->dm.hpd_rx_offload_wq[connector->index].aconnector =34933493+ aconnector;34353494 }34363495}34373496···34443503 struct dc_interrupt_params int_params = {0};34453504 int r;34463505 int i;34473447- unsigned client_id = AMDGPU_IRQ_CLIENTID_LEGACY;35063506+ unsigned int client_id = AMDGPU_IRQ_CLIENTID_LEGACY;3448350734493508 int_params.requested_polarity = INTERRUPT_POLARITY_DEFAULT;34503509 int_params.current_polarity = INTERRUPT_POLARITY_DEFAULT;···34583517 * Base driver will call amdgpu_dm_irq_handler() for ALL interrupts34593518 * coming from DC hardware.34603519 * amdgpu_dm_irq_handler() will re-direct the interrupt to DC34613461- * for acknowledging and handling. */35203520+ * for acknowledging and handling.35213521+ */3462352234633523 /* Use VBLANK interrupt */34643524 for (i = 0; i < adev->mode_info.num_crtc; i++) {34653465- r = amdgpu_irq_add_id(adev, client_id, i+1 , &adev->crtc_irq);35253525+ r = amdgpu_irq_add_id(adev, client_id, i + 1, &adev->crtc_irq);34663526 if (r) {34673527 DRM_ERROR("Failed to add crtc irq id!\n");34683528 return r;···3471352934723530 int_params.int_context = INTERRUPT_HIGH_IRQ_CONTEXT;34733531 int_params.irq_source =34743474- dc_interrupt_to_irq_source(dc, i+1 , 0);35323532+ dc_interrupt_to_irq_source(dc, i + 1, 0);3475353334763534 c_irq_params = &adev->dm.vblank_params[int_params.irq_source - DC_IRQ_SOURCE_VBLANK1];34773535···35273585 struct dc_interrupt_params int_params = {0};35283586 int r;35293587 int i;35303530- unsigned client_id = AMDGPU_IRQ_CLIENTID_LEGACY;35883588+ unsigned int client_id = AMDGPU_IRQ_CLIENTID_LEGACY;3531358935323590 if (adev->family >= AMDGPU_FAMILY_AI)35333591 client_id = SOC15_IH_CLIENTID_DCE;···35443602 * Base driver will call amdgpu_dm_irq_handler() for ALL interrupts35453603 * coming from DC hardware.35463604 * amdgpu_dm_irq_handler() will re-direct the interrupt to DC35473547- * for acknowledging and handling. */36053605+ * for acknowledging and handling.36063606+ */3548360735493608 /* Use VBLANK interrupt */35503609 for (i = VISLANDS30_IV_SRCID_D1_VERTICAL_INTERRUPT0; i <= VISLANDS30_IV_SRCID_D6_VERTICAL_INTERRUPT0; i++) {···39924049}3993405039944051static int get_brightness_range(const struct amdgpu_dm_backlight_caps *caps,39953995- unsigned *min, unsigned *max)40524052+ unsigned int *min, unsigned int *max)39964053{39974054 if (!caps)39984055 return 0;···40124069static u32 convert_brightness_from_user(const struct amdgpu_dm_backlight_caps *caps,40134070 uint32_t brightness)40144071{40154015- unsigned min, max;40724072+ unsigned int min, max;4016407340174074 if (!get_brightness_range(caps, &min, &max))40184075 return brightness;···40254082static u32 convert_brightness_to_user(const struct amdgpu_dm_backlight_caps *caps,40264083 uint32_t brightness)40274084{40284028- unsigned min, max;40854085+ unsigned int min, max;4029408640304087 if (!get_brightness_range(caps, &min, &max))40314088 return brightness;···45054562static void amdgpu_dm_destroy_drm_device(struct amdgpu_display_manager *dm)45064563{45074564 drm_atomic_private_obj_fini(&dm->atomic_obj);45084508- return;45094565}4510456645114567/******************************************************************************···53365394{53375395 enum dc_color_depth depth = timing_out->display_color_depth;53385396 int normalized_clk;53975397+53395398 do {53405399 normalized_clk = timing_out->pix_clk_100hz / 10;53415400 /* YCbCr 4:2:0 requires additional adjustment of 1/2 */···55525609{55535610 struct dc_sink_init_data sink_init_data = { 0 };55545611 struct dc_sink *sink = NULL;56125612+55555613 sink_init_data.link = aconnector->dc_link;55565614 sink_init_data.sink_signal = aconnector->dc_link->connector_signal;55575615···56765732 return &aconnector->freesync_vid_base;5677573356785734 /* Find the preferred mode */56795679- list_for_each_entry (m, list_head, head) {57355735+ list_for_each_entry(m, list_head, head) {56805736 if (m->type & DRM_MODE_TYPE_PREFERRED) {56815737 m_pref = m;56825738 break;···57005756 * For some monitors, preferred mode is not the mode with highest57015757 * supported refresh rate.57025758 */57035703- list_for_each_entry (m, list_head, head) {57595759+ list_for_each_entry(m, list_head, head) {57045760 current_refresh = drm_mode_vrefresh(m);5705576157065762 if (m->hdisplay == m_pref->hdisplay &&···59726028 * This may not be an error, the use case is when we have no59736029 * usermode calls to reset and set mode upon hotplug. In this59746030 * case, we call set mode ourselves to restore the previous mode59755975- * and the modelist may not be filled in in time.60316031+ * and the modelist may not be filled in time.59766032 */59776033 DRM_DEBUG_DRIVER("No preferred mode found\n");59786034 } else {···59956051 drm_mode_set_crtcinfo(&mode, 0);5996605259976053 /*59985998- * If scaling is enabled and refresh rate didn't change59995999- * we copy the vic and polarities of the old timings60006000- */60546054+ * If scaling is enabled and refresh rate didn't change60556055+ * we copy the vic and polarities of the old timings60566056+ */60016057 if (!scale || mode_refresh != preferred_refresh)60026058 fill_stream_properties_from_drm_display_mode(60036059 stream, &mode, &aconnector->base, con_state, NULL,···6761681767626818 if (!state->duplicated) {67636819 int max_bpc = conn_state->max_requested_bpc;68206820+67646821 is_y420 = drm_mode_is_420_also(&connector->display_info, adjusted_mode) &&67656822 aconnector->force_yuv420_output;67666823 color_depth = convert_color_depth_from_display_info(connector,···70807135{70817136 struct drm_display_mode *m;7082713770837083- list_for_each_entry (m, &aconnector->base.probed_modes, head) {71387138+ list_for_each_entry(m, &aconnector->base.probed_modes, head) {70847139 if (drm_mode_equal(m, mode))70857140 return true;70867141 }···72407295 aconnector->as_type = ADAPTIVE_SYNC_TYPE_NONE;72417296 memset(&aconnector->vsdb_info, 0, sizeof(aconnector->vsdb_info));72427297 mutex_init(&aconnector->hpd_lock);72987298+ mutex_init(&aconnector->handle_mst_msg_ready);7243729972447300 /*72457301 * configure support HPD hot plug connector_>polled default value is 0···7400745474017455 link->priv = aconnector;7402745674037403- DRM_DEBUG_DRIVER("%s()\n", __func__);7404745774057458 i2c = create_i2c(link->ddc, link->link_index, &res);74067459 if (!i2c) {···80708125 * Only allow immediate flips for fast updates that don't80718126 * change memory domain, FB pitch, DCC state, rotation or80728127 * mirroring.81288128+ *81298129+ * dm_crtc_helper_atomic_check() only accepts async flips with81308130+ * fast updates.80738131 */81328132+ if (crtc->state->async_flip &&81338133+ acrtc_state->update_type != UPDATE_TYPE_FAST)81348134+ drm_warn_once(state->dev,81358135+ "[PLANE:%d:%s] async flip with non-fast update\n",81368136+ plane->base.id, plane->name);80748137 bundle->flip_addrs[planes_count].flip_immediate =80758138 crtc->state->async_flip &&80768139 acrtc_state->update_type == UPDATE_TYPE_FAST &&···81218168 * DRI3/Present extension with defined target_msc.81228169 */81238170 last_flip_vblank = amdgpu_get_vblank_counter_kms(pcrtc);81248124- }81258125- else {81718171+ } else {81268172 /* For variable refresh rate mode only:81278173 * Get vblank of last completed flip to avoid > 1 vrr81288174 * flips per video frame by use of throttling, but allow···84548502 dc_resource_state_copy_construct_current(dm->dc, dc_state);84558503 }8456850484578457- for_each_oldnew_crtc_in_state (state, crtc, old_crtc_state,84588458- new_crtc_state, i) {85058505+ for_each_oldnew_crtc_in_state(state, crtc, old_crtc_state,85068506+ new_crtc_state, i) {84598507 struct amdgpu_crtc *acrtc = to_amdgpu_crtc(crtc);8460850884618509 dm_old_crtc_state = to_dm_crtc_state(old_crtc_state);···84788526 dm_old_crtc_state = to_dm_crtc_state(old_crtc_state);8479852784808528 drm_dbg_state(state->dev,84818481- "amdgpu_crtc id:%d crtc_state_flags: enable:%d, active:%d, "84828482- "planes_changed:%d, mode_changed:%d,active_changed:%d,"84838483- "connectors_changed:%d\n",85298529+ "amdgpu_crtc id:%d crtc_state_flags: enable:%d, active:%d, planes_changed:%d, mode_changed:%d,active_changed:%d,connectors_changed:%d\n",84848530 acrtc->crtc_id,84858531 new_crtc_state->enable,84868532 new_crtc_state->active,···90549104 &commit->flip_done, 10*HZ);9055910590569106 if (ret == 0)90579057- DRM_ERROR("[CRTC:%d:%s] hw_done or flip_done "90589058- "timed out\n", crtc->base.id, crtc->name);91079107+ DRM_ERROR("[CRTC:%d:%s] hw_done or flip_done timed out\n",91089108+ crtc->base.id, crtc->name);9059910990609110 drm_crtc_commit_put(commit);90619111 }···91409190 return false;91419191}9142919291439143-static void set_freesync_fixed_config(struct dm_crtc_state *dm_new_crtc_state) {91939193+static void set_freesync_fixed_config(struct dm_crtc_state *dm_new_crtc_state)91949194+{91449195 u64 num, den, res;91459196 struct drm_crtc_state *new_crtc_state = &dm_new_crtc_state->base;91469197···92639312 goto skip_modeset;9264931392659314 drm_dbg_state(state->dev,92669266- "amdgpu_crtc id:%d crtc_state_flags: enable:%d, active:%d, "92679267- "planes_changed:%d, mode_changed:%d,active_changed:%d,"92689268- "connectors_changed:%d\n",93159315+ "amdgpu_crtc id:%d crtc_state_flags: enable:%d, active:%d, planes_changed:%d, mode_changed:%d,active_changed:%d,connectors_changed:%d\n",92699316 acrtc->crtc_id,92709317 new_crtc_state->enable,92719318 new_crtc_state->active,···92929343 old_crtc_state)) {92939344 new_crtc_state->mode_changed = false;92949345 DRM_DEBUG_DRIVER(92959295- "Mode change not required for front porch change, "92969296- "setting mode_changed to %d",93469346+ "Mode change not required for front porch change, setting mode_changed to %d",92979347 new_crtc_state->mode_changed);9298934892999349 set_freesync_fixed_config(dm_new_crtc_state);···93049356 struct drm_display_mode *high_mode;9305935793069358 high_mode = get_highest_refresh_rate_mode(aconnector, false);93079307- if (!drm_mode_equal(&new_crtc_state->mode, high_mode)) {93599359+ if (!drm_mode_equal(&new_crtc_state->mode, high_mode))93089360 set_freesync_fixed_config(dm_new_crtc_state);93099309- }93109361 }9311936293129363 ret = dm_atomic_get_state(state, &dm_state);···94739526 */94749527 for_each_oldnew_plane_in_state(state, other, old_other_state, new_other_state, i) {94759528 struct amdgpu_framebuffer *old_afb, *new_afb;95299529+94769530 if (other->type == DRM_PLANE_TYPE_CURSOR)94779531 continue;94789532···95729624 }9573962595749626 /* Core DRM takes care of checking FB modifiers, so we only need to95759575- * check tiling flags when the FB doesn't have a modifier. */96279627+ * check tiling flags when the FB doesn't have a modifier.96289628+ */95769629 if (!(fb->flags & DRM_MODE_FB_MODIFIERS)) {95779630 if (adev->family < AMDGPU_FAMILY_AI) {95789631 linear = AMDGPU_TILING_GET(afb->tiling_flags, ARRAY_MODE) != DC_ARRAY_2D_TILED_THIN1 &&95799579- AMDGPU_TILING_GET(afb->tiling_flags, ARRAY_MODE) != DC_ARRAY_1D_TILED_THIN1 &&96329632+ AMDGPU_TILING_GET(afb->tiling_flags, ARRAY_MODE) != DC_ARRAY_1D_TILED_THIN1 &&95809633 AMDGPU_TILING_GET(afb->tiling_flags, MICRO_TILE_MODE) == 0;95819634 } else {95829635 linear = AMDGPU_TILING_GET(afb->tiling_flags, SWIZZLE_MODE) == 0;···97999850 /* On DCE and DCN there is no dedicated hardware cursor plane. We get a98009851 * cursor per pipe but it's going to inherit the scaling and98019852 * positioning from the underlying pipe. Check the cursor plane's98029802- * blending properties match the underlying planes'. */98539853+ * blending properties match the underlying planes'.98549854+ */9803985598049856 new_cursor_state = drm_atomic_get_new_plane_state(state, cursor);98059805- if (!new_cursor_state || !new_cursor_state->fb) {98579857+ if (!new_cursor_state || !new_cursor_state->fb)98069858 return 0;98079807- }9808985998099860 dm_get_oriented_plane_size(new_cursor_state, &cursor_src_w, &cursor_src_h);98109861 cursor_scale_w = new_cursor_state->crtc_w * 1000 / cursor_src_w;···98499900 struct drm_connector_state *conn_state, *old_conn_state;98509901 struct amdgpu_dm_connector *aconnector = NULL;98519902 int i;99039903+98529904 for_each_oldnew_connector_in_state(state, connector, old_conn_state, conn_state, i) {98539905 if (!conn_state->crtc)98549906 conn_state = old_conn_state;···1028410334 }10285103351028610336 /* Store the overall update type for use later in atomic check. */1028710287- for_each_new_crtc_in_state (state, crtc, new_crtc_state, i) {1033710337+ for_each_new_crtc_in_state(state, crtc, new_crtc_state, i) {1028810338 struct dm_crtc_state *dm_new_crtc_state =1028910339 to_dm_crtc_state(new_crtc_state);1029010340···1030610356 else if (ret == -EINTR || ret == -EAGAIN || ret == -ERESTARTSYS)1030710357 DRM_DEBUG_DRIVER("Atomic check stopped due to signal.\n");1030810358 else1030910309- DRM_DEBUG_DRIVER("Atomic check failed with err: %d \n", ret);1035910359+ DRM_DEBUG_DRIVER("Atomic check failed with err: %d\n", ret);10310103601031110361 trace_amdgpu_dm_atomic_check_finish(state, ret);1031210362
+7
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h
···195195 */196196 bool is_handling_link_loss;197197 /**198198+ * @is_handling_mst_msg_rdy_event: Used to prevent inserting mst message199199+ * ready event when we're already handling mst message ready event200200+ */201201+ bool is_handling_mst_msg_rdy_event;202202+ /**198203 * @aconnector: The aconnector that this work queue is attached to199204 */200205 struct amdgpu_dm_connector *aconnector;···643638 struct drm_dp_mst_port *mst_output_port;644639 struct amdgpu_dm_connector *mst_root;645640 struct drm_dp_aux *dsc_aux;641641+ struct mutex handle_mst_msg_ready;642642+646643 /* TODO see if we can merge with ddc_bus or make a dm_connector */647644 struct amdgpu_i2c_adapter *i2c;648645
···398398 return -EINVAL;399399 }400400401401+ /*402402+ * Only allow async flips for fast updates that don't change the FB403403+ * pitch, the DCC state, rotation, etc.404404+ */405405+ if (crtc_state->async_flip &&406406+ dm_crtc_state->update_type != UPDATE_TYPE_FAST) {407407+ drm_dbg_atomic(crtc->dev,408408+ "[CRTC:%d:%s] async flips are only supported for fast updates\n",409409+ crtc->base.id, crtc->name);410410+ return -EINVAL;411411+ }412412+401413 /* In some use cases, like reset, no stream is attached */402414 if (!dm_crtc_state->stream)403415 return 0;
···11+/*22+ * Copyright 2020 Advanced Micro Devices, Inc.33+ *44+ * Permission is hereby granted, free of charge, to any person obtaining a55+ * copy of this software and associated documentation files (the "Software"),66+ * to deal in the Software without restriction, including without limitation77+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,88+ * and/or sell copies of the Software, and to permit persons to whom the99+ * Software is furnished to do so, subject to the following conditions:1010+ *1111+ * The above copyright notice and this permission notice shall be included in1212+ * all copies or substantial portions of the Software.1313+ *1414+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR1515+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,1616+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL1717+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR1818+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,1919+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR2020+ * OTHER DEALINGS IN THE SOFTWARE.2121+ *2222+ * Authors: AMD2323+ *2424+ */2525+2626+#ifndef __DC_OPTC_DCN301_H__2727+#define __DC_OPTC_DCN301_H__2828+2929+#include "dcn20/dcn20_optc.h"3030+#include "dcn30/dcn30_optc.h"3131+3232+void dcn301_timing_generator_init(struct optc *optc1);3333+void optc301_setup_manual_trigger(struct timing_generator *optc);3434+void optc301_set_drr(struct timing_generator *optc, const struct drr_params *params);3535+3636+#endif /* __DC_OPTC_DCN301_H__ */
···3838#include "i915_reg.h"3939#include "intel_pci_config.h"40404141-__diag_push();4242-__diag_ignore_all("-Woverride-init", "Allow overriding inherited members");4343-4441#define PLATFORM(x) .platform = (x)4542#define GEN(x) \4643 .__runtime.graphics.ip.ver = (x), \···842845};843846844847#undef PLATFORM845845-846846-__diag_pop();847848848849/*849850 * Make sure any device matches here are from most specific to most
···199199 return __intel_idle(dev, drv, index);200200}201201202202-static __always_inline int __intel_idle_hlt(struct cpuidle_device *dev,203203- struct cpuidle_driver *drv, int index)204204-{205205- raw_safe_halt();206206- raw_local_irq_disable();207207- return index;208208-}209209-210210-/**211211- * intel_idle_hlt - Ask the processor to enter the given idle state using hlt.212212- * @dev: cpuidle device of the target CPU.213213- * @drv: cpuidle driver (assumed to point to intel_idle_driver).214214- * @index: Target idle state index.215215- *216216- * Use the HLT instruction to notify the processor that the CPU represented by217217- * @dev is idle and it can try to enter the idle state corresponding to @index.218218- *219219- * Must be called under local_irq_disable().220220- */221221-static __cpuidle int intel_idle_hlt(struct cpuidle_device *dev,222222- struct cpuidle_driver *drv, int index)223223-{224224- return __intel_idle_hlt(dev, drv, index);225225-}226226-227227-static __cpuidle int intel_idle_hlt_irq_on(struct cpuidle_device *dev,228228- struct cpuidle_driver *drv, int index)229229-{230230- int ret;231231-232232- raw_local_irq_enable();233233- ret = __intel_idle_hlt(dev, drv, index);234234- raw_local_irq_disable();235235-236236- return ret;237237-}238238-239202/**240203 * intel_idle_s2idle - Ask the processor to enter the given idle state.241204 * @dev: cpuidle device of the target CPU.···12421279 .enter = NULL }12431280};1244128112451245-static struct cpuidle_state vmguest_cstates[] __initdata = {12461246- {12471247- .name = "C1",12481248- .desc = "HLT",12491249- .flags = MWAIT2flg(0x00) | CPUIDLE_FLAG_IRQ_ENABLE,12501250- .exit_latency = 5,12511251- .target_residency = 10,12521252- .enter = &intel_idle_hlt, },12531253- {12541254- .name = "C1L",12551255- .desc = "Long HLT",12561256- .flags = MWAIT2flg(0x00) | CPUIDLE_FLAG_TLB_FLUSHED,12571257- .exit_latency = 5,12581258- .target_residency = 200,12591259- .enter = &intel_idle_hlt, },12601260- {12611261- .enter = NULL }12621262-};12631263-12641282static const struct idle_cpu idle_cpu_nehalem __initconst = {12651283 .state_table = nehalem_cstates,12661284 .auto_demotion_disable_flags = NHM_C1_AUTO_DEMOTE | NHM_C3_AUTO_DEMOTE,···1841189718421898static void state_update_enter_method(struct cpuidle_state *state, int cstate)18431899{18441844- if (state->enter == intel_idle_hlt) {18451845- if (force_irq_on) {18461846- pr_info("forced intel_idle_irq for state %d\n", cstate);18471847- state->enter = intel_idle_hlt_irq_on;18481848- }18491849- return;18501850- }18511851- if (state->enter == intel_idle_hlt_irq_on)18521852- return; /* no update scenarios */18531853-18541900 if (state->flags & CPUIDLE_FLAG_INIT_XSTATE) {18551901 /*18561902 * Combining with XSTATE with IBRS or IRQ_ENABLE flags···18721938 pr_info("forced intel_idle_irq for state %d\n", cstate);18731939 state->enter = intel_idle_irq;18741940 }18751875-}18761876-18771877-/*18781878- * For mwait based states, we want to verify the cpuid data to see if the state18791879- * is actually supported by this specific CPU.18801880- * For non-mwait based states, this check should be skipped.18811881- */18821882-static bool should_verify_mwait(struct cpuidle_state *state)18831883-{18841884- if (state->enter == intel_idle_hlt)18851885- return false;18861886- if (state->enter == intel_idle_hlt_irq_on)18871887- return false;18881888-18891889- return true;18901941}1891194218921943static void __init intel_idle_init_cstates_icpu(struct cpuidle_driver *drv)···19222003 }1923200419242005 mwait_hint = flg2MWAIT(cpuidle_state_table[cstate].flags);19251925- if (should_verify_mwait(&cpuidle_state_table[cstate]) && !intel_idle_verify_cstate(mwait_hint))20062006+ if (!intel_idle_verify_cstate(mwait_hint))19262007 continue;1927200819282009 /* Structure copy. */···20562137 cpuidle_unregister_device(per_cpu_ptr(intel_idle_cpuidle_devices, i));20572138}2058213920592059-/*20602060- * Match up the latency and break even point of the bare metal (cpu based)20612061- * states with the deepest VM available state.20622062- *20632063- * We only want to do this for the deepest state, the ones that has20642064- * the TLB_FLUSHED flag set on the .20652065- *20662066- * All our short idle states are dominated by vmexit/vmenter latencies,20672067- * not the underlying hardware latencies so we keep our values for these.20682068- */20692069-static void __init matchup_vm_state_with_baremetal(void)20702070-{20712071- int cstate;20722072-20732073- for (cstate = 0; cstate < CPUIDLE_STATE_MAX; ++cstate) {20742074- int matching_cstate;20752075-20762076- if (intel_idle_max_cstate_reached(cstate))20772077- break;20782078-20792079- if (!cpuidle_state_table[cstate].enter)20802080- break;20812081-20822082- if (!(cpuidle_state_table[cstate].flags & CPUIDLE_FLAG_TLB_FLUSHED))20832083- continue;20842084-20852085- for (matching_cstate = 0; matching_cstate < CPUIDLE_STATE_MAX; ++matching_cstate) {20862086- if (!icpu->state_table[matching_cstate].enter)20872087- break;20882088- if (icpu->state_table[matching_cstate].exit_latency > cpuidle_state_table[cstate].exit_latency) {20892089- cpuidle_state_table[cstate].exit_latency = icpu->state_table[matching_cstate].exit_latency;20902090- cpuidle_state_table[cstate].target_residency = icpu->state_table[matching_cstate].target_residency;20912091- }20922092- }20932093-20942094- }20952095-}20962096-20972097-20982098-static int __init intel_idle_vminit(const struct x86_cpu_id *id)20992099-{21002100- int retval;21012101-21022102- cpuidle_state_table = vmguest_cstates;21032103-21042104- icpu = (const struct idle_cpu *)id->driver_data;21052105-21062106- pr_debug("v" INTEL_IDLE_VERSION " model 0x%X\n",21072107- boot_cpu_data.x86_model);21082108-21092109- intel_idle_cpuidle_devices = alloc_percpu(struct cpuidle_device);21102110- if (!intel_idle_cpuidle_devices)21112111- return -ENOMEM;21122112-21132113- /*21142114- * We don't know exactly what the host will do when we go idle, but as a worst estimate21152115- * we can assume that the exit latency of the deepest host state will be hit for our21162116- * deep (long duration) guest idle state.21172117- * The same logic applies to the break even point for the long duration guest idle state.21182118- * So lets copy these two properties from the table we found for the host CPU type.21192119- */21202120- matchup_vm_state_with_baremetal();21212121-21222122- intel_idle_cpuidle_driver_init(&intel_idle_driver);21232123-21242124- retval = cpuidle_register_driver(&intel_idle_driver);21252125- if (retval) {21262126- struct cpuidle_driver *drv = cpuidle_get_driver();21272127- printk(KERN_DEBUG pr_fmt("intel_idle yielding to %s\n"),21282128- drv ? drv->name : "none");21292129- goto init_driver_fail;21302130- }21312131-21322132- retval = cpuhp_setup_state(CPUHP_AP_ONLINE_DYN, "idle/intel:online",21332133- intel_idle_cpu_online, NULL);21342134- if (retval < 0)21352135- goto hp_setup_fail;21362136-21372137- return 0;21382138-hp_setup_fail:21392139- intel_idle_cpuidle_devices_uninit();21402140- cpuidle_unregister_driver(&intel_idle_driver);21412141-init_driver_fail:21422142- free_percpu(intel_idle_cpuidle_devices);21432143- return retval;21442144-}21452145-21462140static int __init intel_idle_init(void)21472141{21482142 const struct x86_cpu_id *id;···20742242 id = x86_match_cpu(intel_idle_ids);20752243 if (id) {20762244 if (!boot_cpu_has(X86_FEATURE_MWAIT)) {20772077- if (boot_cpu_has(X86_FEATURE_HYPERVISOR))20782078- return intel_idle_vminit(id);20792245 pr_debug("Please enable MWAIT in BIOS SETUP\n");20802246 return -ENODEV;20812247 }
···2681268126822682 ring->rx_max_pending = ICE_MAX_NUM_DESC;26832683 ring->tx_max_pending = ICE_MAX_NUM_DESC;26842684- ring->rx_pending = vsi->rx_rings[0]->count;26852685- ring->tx_pending = vsi->tx_rings[0]->count;26842684+ if (vsi->tx_rings && vsi->rx_rings) {26852685+ ring->rx_pending = vsi->rx_rings[0]->count;26862686+ ring->tx_pending = vsi->tx_rings[0]->count;26872687+ } else {26882688+ ring->rx_pending = 0;26892689+ ring->tx_pending = 0;26902690+ }2686269126872692 /* Rx mini and jumbo rings are not supported */26882693 ring->rx_mini_max_pending = 0;···27202715 ICE_REQ_DESC_MULTIPLE);27212716 return -EINVAL;27222717 }27182718+27192719+ /* Return if there is no rings (device is reloading) */27202720+ if (!vsi->tx_rings || !vsi->rx_rings)27212721+ return -EBUSY;2723272227242723 new_tx_cnt = ALIGN(ring->tx_pending, ICE_REQ_DESC_MULTIPLE);27252724 if (new_tx_cnt != ring->tx_pending)
-27
drivers/net/ethernet/intel/ice/ice_lib.c
···29722972 return -ENODEV;29732973 pf = vsi->back;2974297429752975- /* do not unregister while driver is in the reset recovery pending29762976- * state. Since reset/rebuild happens through PF service task workqueue,29772977- * it's not a good idea to unregister netdev that is associated to the29782978- * PF that is running the work queue items currently. This is done to29792979- * avoid check_flush_dependency() warning on this wq29802980- */29812981- if (vsi->netdev && !ice_is_reset_in_progress(pf->state) &&29822982- (test_bit(ICE_VSI_NETDEV_REGISTERED, vsi->state))) {29832983- unregister_netdev(vsi->netdev);29842984- clear_bit(ICE_VSI_NETDEV_REGISTERED, vsi->state);29852985- }29862986-29872987- if (vsi->type == ICE_VSI_PF)29882988- ice_devlink_destroy_pf_port(pf);29892989-29902975 if (test_bit(ICE_FLAG_RSS_ENA, pf->flags))29912976 ice_rss_clean(vsi);2992297729932978 ice_vsi_close(vsi);29942979 ice_vsi_decfg(vsi);29952995-29962996- if (vsi->netdev) {29972997- if (test_bit(ICE_VSI_NETDEV_REGISTERED, vsi->state)) {29982998- unregister_netdev(vsi->netdev);29992999- clear_bit(ICE_VSI_NETDEV_REGISTERED, vsi->state);30003000- }30013001- if (test_bit(ICE_VSI_NETDEV_ALLOCD, vsi->state)) {30023002- free_netdev(vsi->netdev);30033003- vsi->netdev = NULL;30043004- clear_bit(ICE_VSI_NETDEV_ALLOCD, vsi->state);30053005- }30063006- }3007298030082981 /* retain SW VSI data structure since it is needed to unregister and30092982 * free VSI netdev when PF is not in reset recovery pending state,\
···12601260 if (skb->protocol == htons(ETH_P_IP)) {12611261 u32 pkt_len = ((unsigned char *)ip_hdr(skb) - skb->data)12621262 + ntohs(ip_hdr(skb)->tot_len);12631263- if (skb->len > pkt_len)12641264- pskb_trim(skb, pkt_len);12631263+ if (skb->len > pkt_len) {12641264+ ret = pskb_trim(skb, pkt_len);12651265+ if (unlikely(ret))12661266+ return ret;12671267+ }12651268 }1266126912671270 hdr_len = skb_tcp_all_headers(skb);
+34-11
drivers/net/ethernet/realtek/r8169_main.c
···623623 int cfg9346_usage_count;624624625625 unsigned supports_gmii:1;626626+ unsigned aspm_manageable:1;626627 dma_addr_t counters_phys_addr;627628 struct rtl8169_counters *counters;628629 struct rtl8169_tc_offsets tc_offset;···27472746 if (tp->mac_version < RTL_GIGA_MAC_VER_32)27482747 return;2749274827502750- if (enable) {27492749+ /* Don't enable ASPM in the chip if OS can't control ASPM */27502750+ if (enable && tp->aspm_manageable) {27512751+ /* On these chip versions ASPM can even harm27522752+ * bus communication of other PCI devices.27532753+ */27542754+ if (tp->mac_version == RTL_GIGA_MAC_VER_42 ||27552755+ tp->mac_version == RTL_GIGA_MAC_VER_43)27562756+ return;27572757+27512758 rtl_mod_config5(tp, 0, ASPM_en);27522759 rtl_mod_config2(tp, 0, ClkReqEn);27532760···45234514 }4524451545254516 if (napi_schedule_prep(&tp->napi)) {45264526- rtl_unlock_config_regs(tp);45274527- rtl_hw_aspm_clkreq_enable(tp, false);45284528- rtl_lock_config_regs(tp);45294529-45304517 rtl_irq_disable(tp);45314518 __napi_schedule(&tp->napi);45324519 }···4582457745834578 work_done = rtl_rx(dev, tp, budget);4584457945854585- if (work_done < budget && napi_complete_done(napi, work_done)) {45804580+ if (work_done < budget && napi_complete_done(napi, work_done))45864581 rtl_irq_enable(tp);45874587-45884588- rtl_unlock_config_regs(tp);45894589- rtl_hw_aspm_clkreq_enable(tp, true);45904590- rtl_lock_config_regs(tp);45914591- }4592458245934583 return work_done;45944584}···51585158 rtl_rar_set(tp, mac_addr);51595159}5160516051615161+/* register is set if system vendor successfully tested ASPM 1.2 */51625162+static bool rtl_aspm_is_safe(struct rtl8169_private *tp)51635163+{51645164+ if (tp->mac_version >= RTL_GIGA_MAC_VER_61 &&51655165+ r8168_mac_ocp_read(tp, 0xc0b2) & 0xf)51665166+ return true;51675167+51685168+ return false;51695169+}51705170+51615171static int rtl_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)51625172{51635173 struct rtl8169_private *tp;···52365226 "unknown chip XID %03x, contact r8169 maintainers (see MAINTAINERS file)\n",52375227 xid);52385228 tp->mac_version = chipset;52295229+52305230+ /* Disable ASPM L1 as that cause random device stop working52315231+ * problems as well as full system hangs for some PCIe devices users.52325232+ * Chips from RTL8168h partially have issues with L1.2, but seem52335233+ * to work fine with L1 and L1.1.52345234+ */52355235+ if (rtl_aspm_is_safe(tp))52365236+ rc = 0;52375237+ else if (tp->mac_version >= RTL_GIGA_MAC_VER_46)52385238+ rc = pci_disable_link_state(pdev, PCIE_LINK_STATE_L1_2);52395239+ else52405240+ rc = pci_disable_link_state(pdev, PCIE_LINK_STATE_L1);52415241+ tp->aspm_manageable = !rc;5239524252405243 tp->dash_type = rtl_check_dash(tp);52415244
···34513451{34523452 int rc;3453345334543454+ ethtool_set_ethtool_phy_ops(&phy_ethtool_phy_ops);34553455+34543456 rc = mdio_bus_init();34553457 if (rc)34563456- return rc;34583458+ goto err_ethtool_phy_ops;3457345934583458- ethtool_set_ethtool_phy_ops(&phy_ethtool_phy_ops);34593460 features_init();3460346134613462 rc = phy_driver_register(&genphy_c45_driver, THIS_MODULE);34623463 if (rc)34633463- goto err_c45;34643464+ goto err_mdio_bus;3464346534653466 rc = phy_driver_register(&genphy_driver, THIS_MODULE);34663466- if (rc) {34673467- phy_driver_unregister(&genphy_c45_driver);34673467+ if (rc)34683468+ goto err_c45;34693469+34703470+ return 0;34713471+34683472err_c45:34693469- mdio_bus_exit();34703470- }34733473+ phy_driver_unregister(&genphy_c45_driver);34743474+err_mdio_bus:34753475+ mdio_bus_exit();34763476+err_ethtool_phy_ops:34773477+ ethtool_set_ethtool_phy_ops(NULL);3471347834723479 return rc;34733480}
+6
drivers/net/usb/usbnet.c
···17751775 } else if (!info->in || !info->out)17761776 status = usbnet_get_endpoints (dev, udev);17771777 else {17781778+ u8 ep_addrs[3] = {17791779+ info->in + USB_DIR_IN, info->out + USB_DIR_OUT, 017801780+ };17811781+17781782 dev->in = usb_rcvbulkpipe (xdev, info->in);17791783 dev->out = usb_sndbulkpipe (xdev, info->out);17801784 if (!(info->flags & FLAG_NO_SETINT))···17881784 else17891785 status = 0;1790178617871787+ if (status == 0 && !usb_check_bulk_endpoints(udev, ep_addrs))17881788+ status = -EINVAL;17911789 }17921790 if (status >= 0 && dev->status)17931791 status = init_status (dev, udev);
+6-6
drivers/net/vrf.c
···664664 skb->protocol = htons(ETH_P_IPV6);665665 skb->dev = dev;666666667667- rcu_read_lock_bh();667667+ rcu_read_lock();668668 nexthop = rt6_nexthop((struct rt6_info *)dst, &ipv6_hdr(skb)->daddr);669669 neigh = __ipv6_neigh_lookup_noref(dst->dev, nexthop);670670 if (unlikely(!neigh))···672672 if (!IS_ERR(neigh)) {673673 sock_confirm_neigh(skb, neigh);674674 ret = neigh_output(neigh, skb, false);675675- rcu_read_unlock_bh();675675+ rcu_read_unlock();676676 return ret;677677 }678678- rcu_read_unlock_bh();678678+ rcu_read_unlock();679679680680 IP6_INC_STATS(dev_net(dst->dev),681681 ip6_dst_idev(dst), IPSTATS_MIB_OUTNOROUTES);···889889 }890890 }891891892892- rcu_read_lock_bh();892892+ rcu_read_lock();893893894894 neigh = ip_neigh_for_gw(rt, skb, &is_v6gw);895895 if (!IS_ERR(neigh)) {···898898 sock_confirm_neigh(skb, neigh);899899 /* if crossing protocols, can not use the cached header */900900 ret = neigh_output(neigh, skb, is_v6gw);901901- rcu_read_unlock_bh();901901+ rcu_read_unlock();902902 return ret;903903 }904904905905- rcu_read_unlock_bh();905905+ rcu_read_unlock();906906 vrf_tx_error(skb->dev, skb);907907 return -EINVAL;908908}
+1-1
drivers/of/Kconfig
···55555656config OF_EARLY_FLATTREE5757 bool5858- select DMA_DECLARE_COHERENT if HAS_DMA5858+ select DMA_DECLARE_COHERENT if HAS_DMA && HAS_IOMEM5959 select OF_FLATTREE60606161config OF_PROMTREE
+1-1
drivers/of/platform.c
···552552 if (!of_get_property(node, "linux,opened", NULL) ||553553 !of_get_property(node, "linux,boot-display", NULL))554554 continue;555555- dev = of_platform_device_create(node, "of-display.0", NULL);555555+ dev = of_platform_device_create(node, "of-display", NULL);556556 of_node_put(node);557557 if (WARN_ON(!dev))558558 return -ENOMEM;
+3
drivers/regulator/da9063-regulator.c
···778778 const struct notification_limit *uv_l = &constr->under_voltage_limits;779779 const struct notification_limit *ov_l = &constr->over_voltage_limits;780780781781+ if (!config->init_data) /* No config in DT, pointers will be invalid */782782+ return 0;783783+781784 /* make sure that only one severity is used to clarify if unchanged, enabled or disabled */782785 if ((!!uv_l->prot + !!uv_l->err + !!uv_l->warn) > 1) {783786 dev_err(config->dev, "%s: at most one voltage monitoring severity allowed!\n",
+23-10
drivers/s390/crypto/zcrypt_msgtype6.c
···11011101 struct ica_xcRB *xcrb,11021102 struct ap_message *ap_msg)11031103{11041104- int rc;11051104 struct response_type *rtype = ap_msg->private;11061105 struct {11071106 struct type6_hdr hdr;11081107 struct CPRBX cprbx;11091108 /* ... more data blocks ... */11101109 } __packed * msg = ap_msg->msg;11101110+ unsigned int max_payload_size;11111111+ int rc, delta;1111111211121112- /*11131113- * Set the queue's reply buffer length minus 128 byte padding11141114- * as reply limit for the card firmware.11151115- */11161116- msg->hdr.fromcardlen1 = min_t(unsigned int, msg->hdr.fromcardlen1,11171117- zq->reply.bufsize - 128);11181118- if (msg->hdr.fromcardlen2)11191119- msg->hdr.fromcardlen2 =11201120- zq->reply.bufsize - msg->hdr.fromcardlen1 - 128;11131113+ /* calculate maximum payload for this card and msg type */11141114+ max_payload_size = zq->reply.bufsize - sizeof(struct type86_fmt2_msg);11151115+11161116+ /* limit each of the two from fields to the maximum payload size */11171117+ msg->hdr.fromcardlen1 = min(msg->hdr.fromcardlen1, max_payload_size);11181118+ msg->hdr.fromcardlen2 = min(msg->hdr.fromcardlen2, max_payload_size);11191119+11201120+ /* calculate delta if the sum of both exceeds max payload size */11211121+ delta = msg->hdr.fromcardlen1 + msg->hdr.fromcardlen211221122+ - max_payload_size;11231123+ if (delta > 0) {11241124+ /*11251125+ * Sum exceeds maximum payload size, prune fromcardlen111261126+ * (always trust fromcardlen2)11271127+ */11281128+ if (delta > msg->hdr.fromcardlen1) {11291129+ rc = -EINVAL;11301130+ goto out;11311131+ }11321132+ msg->hdr.fromcardlen1 -= delta;11331133+ }1121113411221135 init_completion(&rtype->work);11231136 rc = ap_queue_message(zq->queue, ap_msg);
+6-6
drivers/video/console/sticon.c
···156156 return false;157157}158158159159-static int sticon_set_def_font(int unit, struct console_font *op)159159+static void sticon_set_def_font(int unit)160160{161161 if (font_data[unit] != STI_DEF_FONT) {162162 if (--FNTREFCOUNT(font_data[unit]) == 0) {···165165 }166166 font_data[unit] = STI_DEF_FONT;167167 }168168-169169- return 0;170168}171169172170static int sticon_set_font(struct vc_data *vc, struct console_font *op,···244246 vc->vc_video_erase_char, font_data[vc->vc_num]);245247246248 /* delete old font in case it is a user font */247247- sticon_set_def_font(unit, NULL);249249+ sticon_set_def_font(unit);248250249251 FNTREFCOUNT(cooked_font)++;250252 font_data[unit] = cooked_font;···262264263265static int sticon_font_default(struct vc_data *vc, struct console_font *op, char *name)264266{265265- return sticon_set_def_font(vc->vc_num, op);267267+ sticon_set_def_font(vc->vc_num);268268+269269+ return 0;266270}267271268272static int sticon_font_set(struct vc_data *vc, struct console_font *font,···297297298298 /* free memory used by user font */299299 for (i = 0; i < MAX_NR_CONSOLES; i++)300300- sticon_set_def_font(i, NULL);300300+ sticon_set_def_font(i);301301}302302303303static void sticon_clear(struct vc_data *conp, int sy, int sx, int height,
+28-46
drivers/video/console/vgacon.c
···6565 * Interface used by the world6666 */67676868-static const char *vgacon_startup(void);6969-static void vgacon_init(struct vc_data *c, int init);7070-static void vgacon_deinit(struct vc_data *c);7171-static void vgacon_cursor(struct vc_data *c, int mode);7272-static int vgacon_switch(struct vc_data *c);7373-static int vgacon_blank(struct vc_data *c, int blank, int mode_switch);7474-static void vgacon_scrolldelta(struct vc_data *c, int lines);7568static int vgacon_set_origin(struct vc_data *c);7676-static void vgacon_save_screen(struct vc_data *c);7777-static void vgacon_invert_region(struct vc_data *c, u16 * p, int count);6969+7870static struct uni_pagedict *vgacon_uni_pagedir;7971static int vgacon_refcount;8072···134142 write_vga(12, (c->vc_visible_origin - vga_vram_base) / 2);135143}136144137137-static void vgacon_restore_screen(struct vc_data *c)138138-{139139- if (c->vc_origin != c->vc_visible_origin)140140- vgacon_scrolldelta(c, 0);141141-}142142-143145static void vgacon_scrolldelta(struct vc_data *c, int lines)144146{145147 vc_scrolldelta_helper(c, lines, vga_rolled_over, (void *)vga_vram_base,146148 vga_vram_size);147149 vga_set_mem_top(c);150150+}151151+152152+static void vgacon_restore_screen(struct vc_data *c)153153+{154154+ if (c->vc_origin != c->vc_visible_origin)155155+ vgacon_scrolldelta(c, 0);148156}149157150158static const char *vgacon_startup(void)···437445 }438446}439447440440-static void vgacon_set_cursor_size(int xpos, int from, int to)448448+static void vgacon_set_cursor_size(int from, int to)441449{442450 unsigned long flags;443451 int curs, cure;···470478471479static void vgacon_cursor(struct vc_data *c, int mode)472480{481481+ unsigned int c_height;482482+473483 if (c->vc_mode != KD_TEXT)474484 return;475485476486 vgacon_restore_screen(c);477487488488+ c_height = c->vc_cell_height;489489+478490 switch (mode) {479491 case CM_ERASE:480492 write_vga(14, (c->vc_pos - vga_vram_base) / 2);481493 if (vga_video_type >= VIDEO_TYPE_VGAC)482482- vgacon_set_cursor_size(c->state.x, 31, 30);494494+ vgacon_set_cursor_size(31, 30);483495 else484484- vgacon_set_cursor_size(c->state.x, 31, 31);496496+ vgacon_set_cursor_size(31, 31);485497 break;486498487499 case CM_MOVE:···493497 write_vga(14, (c->vc_pos - vga_vram_base) / 2);494498 switch (CUR_SIZE(c->vc_cursor_type)) {495499 case CUR_UNDERLINE:496496- vgacon_set_cursor_size(c->state.x,497497- c->vc_cell_height -498498- (c->vc_cell_height <499499- 10 ? 2 : 3),500500- c->vc_cell_height -501501- (c->vc_cell_height <502502- 10 ? 1 : 2));500500+ vgacon_set_cursor_size(c_height -501501+ (c_height < 10 ? 2 : 3),502502+ c_height -503503+ (c_height < 10 ? 1 : 2));503504 break;504505 case CUR_TWO_THIRDS:505505- vgacon_set_cursor_size(c->state.x,506506- c->vc_cell_height / 3,507507- c->vc_cell_height -508508- (c->vc_cell_height <509509- 10 ? 1 : 2));506506+ vgacon_set_cursor_size(c_height / 3, c_height -507507+ (c_height < 10 ? 1 : 2));510508 break;511509 case CUR_LOWER_THIRD:512512- vgacon_set_cursor_size(c->state.x,513513- (c->vc_cell_height * 2) / 3,514514- c->vc_cell_height -515515- (c->vc_cell_height <516516- 10 ? 1 : 2));510510+ vgacon_set_cursor_size(c_height * 2 / 3, c_height -511511+ (c_height < 10 ? 1 : 2));517512 break;518513 case CUR_LOWER_HALF:519519- vgacon_set_cursor_size(c->state.x,520520- c->vc_cell_height / 2,521521- c->vc_cell_height -522522- (c->vc_cell_height <523523- 10 ? 1 : 2));514514+ vgacon_set_cursor_size(c_height / 2, c_height -515515+ (c_height < 10 ? 1 : 2));524516 break;525517 case CUR_NONE:526518 if (vga_video_type >= VIDEO_TYPE_VGAC)527527- vgacon_set_cursor_size(c->state.x, 31, 30);519519+ vgacon_set_cursor_size(31, 30);528520 else529529- vgacon_set_cursor_size(c->state.x, 31, 31);521521+ vgacon_set_cursor_size(31, 31);530522 break;531523 default:532532- vgacon_set_cursor_size(c->state.x, 1,533533- c->vc_cell_height);524524+ vgacon_set_cursor_size(1, c_height);534525 break;535526 }536527 break;537528 }538529}539530540540-static int vgacon_doresize(struct vc_data *c,531531+static void vgacon_doresize(struct vc_data *c,541532 unsigned int width, unsigned int height)542533{543534 unsigned long flags;···583600 }584601585602 raw_spin_unlock_irqrestore(&vga_lock, flags);586586- return 0;587603}588604589605static int vgacon_switch(struct vc_data *c)
+3
drivers/video/fbdev/au1200fb.c
···1732173217331733 /* Now hook interrupt too */17341734 irq = platform_get_irq(dev, 0);17351735+ if (irq < 0)17361736+ return irq;17371737+17351738 ret = request_irq(irq, au1200fb_handle_irq,17361739 IRQF_SHARED, "lcd", (void *)dev);17371740 if (ret) {
···16121612 }16131613}1614161416151615-static void fbcon_redraw(struct vc_data *vc, struct fbcon_display *p,16161616- int line, int count, int offset)16151615+static void fbcon_redraw(struct vc_data *vc, int line, int count, int offset)16171616{16181617 unsigned short *d = (unsigned short *)16191618 (vc->vc_origin + vc->vc_size_row * line);···1826182718271828 case SCROLL_REDRAW:18281829 redraw_up:18291829- fbcon_redraw(vc, p, t, b - t - count,18301830+ fbcon_redraw(vc, t, b - t - count,18301831 count * vc->vc_cols);18311832 fbcon_clear(vc, b - count, 0, count, vc->vc_cols);18321833 scr_memsetw((unsigned short *) (vc->vc_origin +···1912191319131914 case SCROLL_REDRAW:19141915 redraw_down:19151915- fbcon_redraw(vc, p, b - 1, b - t - count,19161916+ fbcon_redraw(vc, b - 1, b - t - count,19161917 -count * vc->vc_cols);19171918 fbcon_clear(vc, t, 0, count, vc->vc_cols);19181919 scr_memsetw((unsigned short *) (vc->vc_origin +
+3-1
drivers/video/fbdev/ep93xx-fb.c
···548548 }549549550550 ep93xxfb_set_par(info);551551- clk_prepare_enable(fbi->clk);551551+ err = clk_prepare_enable(fbi->clk);552552+ if (err)553553+ goto failed_check;552554553555 err = register_framebuffer(info);554556 if (err)
···16401640{16411641 struct btrfs_fs_info *fs_info = bg->fs_info;1642164216431643- trace_btrfs_add_unused_block_group(bg);16441643 spin_lock(&fs_info->unused_bgs_lock);16451644 if (list_empty(&bg->bg_list)) {16461645 btrfs_get_block_group(bg);16461646+ trace_btrfs_add_unused_block_group(bg);16471647 list_add_tail(&bg->bg_list, &fs_info->unused_bgs);16481648- } else {16481648+ } else if (!test_bit(BLOCK_GROUP_FLAG_NEW, &bg->runtime_flags)) {16491649 /* Pull out the block group from the reclaim_bgs list. */16501650+ trace_btrfs_add_unused_block_group(bg);16501651 list_move_tail(&bg->bg_list, &fs_info->unused_bgs);16511652 }16521653 spin_unlock(&fs_info->unused_bgs_lock);···2088208720892088 /* Shouldn't have super stripes in sequential zones */20902089 if (zoned && nr) {20902090+ kfree(logical);20912091 btrfs_err(fs_info,20922092 "zoned: block group %llu must not contain super block",20932093 cache->start);···26702668next:26712669 btrfs_delayed_refs_rsv_release(fs_info, 1);26722670 list_del_init(&block_group->bg_list);26712671+ clear_bit(BLOCK_GROUP_FLAG_NEW, &block_group->runtime_flags);26732672 }26742673 btrfs_trans_release_chunk_metadata(trans);26752674}···27092706 cache = btrfs_create_block_group_cache(fs_info, chunk_offset);27102707 if (!cache)27112708 return ERR_PTR(-ENOMEM);27092709+27102710+ /*27112711+ * Mark it as new before adding it to the rbtree of block groups or any27122712+ * list, so that no other task finds it and calls btrfs_mark_bg_unused()27132713+ * before the new flag is set.27142714+ */27152715+ set_bit(BLOCK_GROUP_FLAG_NEW, &cache->runtime_flags);2712271627132717 cache->length = size;27142718 set_free_space_tree_thresholds(cache);
+5
fs/btrfs/block-group.h
···7070 BLOCK_GROUP_FLAG_NEEDS_FREE_SPACE,7171 /* Indicate that the block group is placed on a sequential zone */7272 BLOCK_GROUP_FLAG_SEQUENTIAL_ZONE,7373+ /*7474+ * Indicate that block group is in the list of new block groups of a7575+ * transaction.7676+ */7777+ BLOCK_GROUP_FLAG_NEW,7378};74797580enum btrfs_caching_type {
+52-25
fs/btrfs/inode.c
···34823482void btrfs_add_delayed_iput(struct btrfs_inode *inode)34833483{34843484 struct btrfs_fs_info *fs_info = inode->root->fs_info;34853485+ unsigned long flags;3485348634863487 if (atomic_add_unless(&inode->vfs_inode.i_count, -1, 1))34873488 return;3488348934893490 atomic_inc(&fs_info->nr_delayed_iputs);34903490- spin_lock(&fs_info->delayed_iput_lock);34913491+ /*34923492+ * Need to be irq safe here because we can be called from either an irq34933493+ * context (see bio.c and btrfs_put_ordered_extent()) or a non-irq34943494+ * context.34953495+ */34963496+ spin_lock_irqsave(&fs_info->delayed_iput_lock, flags);34913497 ASSERT(list_empty(&inode->delayed_iput));34923498 list_add_tail(&inode->delayed_iput, &fs_info->delayed_iputs);34933493- spin_unlock(&fs_info->delayed_iput_lock);34993499+ spin_unlock_irqrestore(&fs_info->delayed_iput_lock, flags);34943500 if (!test_bit(BTRFS_FS_CLEANER_RUNNING, &fs_info->flags))34953501 wake_up_process(fs_info->cleaner_kthread);34963502}···35053499 struct btrfs_inode *inode)35063500{35073501 list_del_init(&inode->delayed_iput);35083508- spin_unlock(&fs_info->delayed_iput_lock);35023502+ spin_unlock_irq(&fs_info->delayed_iput_lock);35093503 iput(&inode->vfs_inode);35103504 if (atomic_dec_and_test(&fs_info->nr_delayed_iputs))35113505 wake_up(&fs_info->delayed_iputs_wait);35123512- spin_lock(&fs_info->delayed_iput_lock);35063506+ spin_lock_irq(&fs_info->delayed_iput_lock);35133507}3514350835153509static void btrfs_run_delayed_iput(struct btrfs_fs_info *fs_info,35163510 struct btrfs_inode *inode)35173511{35183512 if (!list_empty(&inode->delayed_iput)) {35193519- spin_lock(&fs_info->delayed_iput_lock);35133513+ spin_lock_irq(&fs_info->delayed_iput_lock);35203514 if (!list_empty(&inode->delayed_iput))35213515 run_delayed_iput_locked(fs_info, inode);35223522- spin_unlock(&fs_info->delayed_iput_lock);35163516+ spin_unlock_irq(&fs_info->delayed_iput_lock);35233517 }35243518}3525351935263520void btrfs_run_delayed_iputs(struct btrfs_fs_info *fs_info)35273521{35283528-35293529- spin_lock(&fs_info->delayed_iput_lock);35223522+ /*35233523+ * btrfs_put_ordered_extent() can run in irq context (see bio.c), which35243524+ * calls btrfs_add_delayed_iput() and that needs to lock35253525+ * fs_info->delayed_iput_lock. So we need to disable irqs here to35263526+ * prevent a deadlock.35273527+ */35283528+ spin_lock_irq(&fs_info->delayed_iput_lock);35303529 while (!list_empty(&fs_info->delayed_iputs)) {35313530 struct btrfs_inode *inode;3532353135333532 inode = list_first_entry(&fs_info->delayed_iputs,35343533 struct btrfs_inode, delayed_iput);35353534 run_delayed_iput_locked(fs_info, inode);35363536- cond_resched_lock(&fs_info->delayed_iput_lock);35353535+ if (need_resched()) {35363536+ spin_unlock_irq(&fs_info->delayed_iput_lock);35373537+ cond_resched();35383538+ spin_lock_irq(&fs_info->delayed_iput_lock);35393539+ }35373540 }35383538- spin_unlock(&fs_info->delayed_iput_lock);35413541+ spin_unlock_irq(&fs_info->delayed_iput_lock);35393542}3540354335413544/*···36743659 found_key.type = BTRFS_INODE_ITEM_KEY;36753660 found_key.offset = 0;36763661 inode = btrfs_iget(fs_info->sb, last_objectid, root);36773677- ret = PTR_ERR_OR_ZERO(inode);36783678- if (ret && ret != -ENOENT)36793679- goto out;36623662+ if (IS_ERR(inode)) {36633663+ ret = PTR_ERR(inode);36643664+ inode = NULL;36653665+ if (ret != -ENOENT)36663666+ goto out;36673667+ }3680366836813681- if (ret == -ENOENT && root == fs_info->tree_root) {36693669+ if (!inode && root == fs_info->tree_root) {36823670 struct btrfs_root *dead_root;36833671 int is_dead_root = 0;36843672···37423724 * deleted but wasn't. The inode number may have been reused,37433725 * but either way, we can delete the orphan item.37443726 */37453745- if (ret == -ENOENT || inode->i_nlink) {37463746- if (!ret) {37273727+ if (!inode || inode->i_nlink) {37283728+ if (inode) {37473729 ret = btrfs_drop_verity_items(BTRFS_I(inode));37483730 iput(inode);37313731+ inode = NULL;37493732 if (ret)37503733 goto out;37513734 }37523735 trans = btrfs_start_transaction(root, 1);37533736 if (IS_ERR(trans)) {37543737 ret = PTR_ERR(trans);37553755- iput(inode);37563738 goto out;37573739 }37583740 btrfs_debug(fs_info, "auto deleting %Lu",···37603742 ret = btrfs_del_orphan_item(trans, root,37613743 found_key.objectid);37623744 btrfs_end_transaction(trans);37633763- if (ret) {37643764- iput(inode);37453745+ if (ret)37653746 goto out;37663766- }37673747 continue;37683748 }37693749···48634847 ret = -ENOMEM;48644848 goto out;48654849 }48664866- ret = set_page_extent_mapped(page);48674867- if (ret < 0)48684868- goto out_unlock;4869485048704851 if (!PageUptodate(page)) {48714852 ret = btrfs_read_folio(NULL, page_folio(page));···48774864 goto out_unlock;48784865 }48794866 }48674867+48684868+ /*48694869+ * We unlock the page after the io is completed and then re-lock it48704870+ * above. release_folio() could have come in between that and cleared48714871+ * PagePrivate(), but left the page in the mapping. Set the page mapped48724872+ * here to make sure it's properly set for the subpage stuff.48734873+ */48744874+ ret = set_page_extent_mapped(page);48754875+ if (ret < 0)48764876+ goto out_unlock;48774877+48804878 wait_on_page_writeback(page);4881487948824880 lock_extent(io_tree, block_start, block_end, &cached_state);···7873784978747850 ret = btrfs_extract_ordered_extent(bbio, dio_data->ordered);78757851 if (ret) {78767876- bbio->bio.bi_status = errno_to_blk_status(ret);78777877- btrfs_dio_end_io(bbio);78527852+ btrfs_finish_ordered_extent(dio_data->ordered, NULL,78537853+ file_offset, dip->bytes,78547854+ !ret);78557855+ bio->bi_status = errno_to_blk_status(ret);78567856+ iomap_dio_bio_end_io(bio);78787857 return;78797858 }78807859 }
···7171static void index_rbio_pages(struct btrfs_raid_bio *rbio);7272static int alloc_rbio_pages(struct btrfs_raid_bio *rbio);73737474-static int finish_parity_scrub(struct btrfs_raid_bio *rbio, int need_check);7474+static int finish_parity_scrub(struct btrfs_raid_bio *rbio);7575static void scrub_rbio_work_locked(struct work_struct *work);76767777static void free_raid_bio_pointers(struct btrfs_raid_bio *rbio)···24042404 return 0;24052405}2406240624072407-static int finish_parity_scrub(struct btrfs_raid_bio *rbio, int need_check)24072407+static int finish_parity_scrub(struct btrfs_raid_bio *rbio)24082408{24092409 struct btrfs_io_context *bioc = rbio->bioc;24102410 const u32 sectorsize = bioc->fs_info->sectorsize;···24442444 * it.24452445 */24462446 clear_bit(RBIO_CACHE_READY_BIT, &rbio->flags);24472447-24482448- if (!need_check)24492449- goto writeback;2450244724512448 p_sector.page = alloc_page(GFP_NOFS);24522449 if (!p_sector.page)···25132516 q_sector.page = NULL;25142517 }2515251825162516-writeback:25172519 /*25182520 * time to start writing. Make bios for everything from the25192521 * higher layers (the bio_list in our rbio) and our p/q. Ignore···2695269926962700static void scrub_rbio(struct btrfs_raid_bio *rbio)26972701{26982698- bool need_check = false;26992702 int sector_nr;27002703 int ret;27012704···27172722 * We have every sector properly prepared. Can finish the scrub27182723 * and writeback the good content.27192724 */27202720- ret = finish_parity_scrub(rbio, need_check);27252725+ ret = finish_parity_scrub(rbio);27212726 wait_event(rbio->io_wait, atomic_read(&rbio->stripes_pending) == 0);27222727 for (sector_nr = 0; sector_nr < rbio->stripe_nsectors; sector_nr++) {27232728 int found_errors;
+6-11
fs/btrfs/volumes.c
···40784078 return has_single_bit_set(flags);40794079}4080408040814081-static inline int balance_need_close(struct btrfs_fs_info *fs_info)40824082-{40834083- /* cancel requested || normal exit path */40844084- return atomic_read(&fs_info->balance_cancel_req) ||40854085- (atomic_read(&fs_info->balance_pause_req) == 0 &&40864086- atomic_read(&fs_info->balance_cancel_req) == 0);40874087-}40884088-40894081/*40904082 * Validate target profile against allowed profiles and return true if it's OK.40914083 * Otherwise print the error message and return false.···42674275 u64 num_devices;42684276 unsigned seq;42694277 bool reducing_redundancy;42784278+ bool paused = false;42704279 int i;4271428042724281 if (btrfs_fs_closing(fs_info) ||···43984405 if (ret == -ECANCELED && atomic_read(&fs_info->balance_pause_req)) {43994406 btrfs_info(fs_info, "balance: paused");44004407 btrfs_exclop_balance(fs_info, BTRFS_EXCLOP_BALANCE_PAUSED);44084408+ paused = true;44014409 }44024410 /*44034411 * Balance can be canceled by:···44274433 btrfs_update_ioctl_balance_args(fs_info, bargs);44284434 }4429443544304430- if ((ret && ret != -ECANCELED && ret != -ENOSPC) ||44314431- balance_need_close(fs_info)) {44364436+ /* We didn't pause, we can clean everything up. */44374437+ if (!paused) {44324438 reset_balance_state(fs_info);44334439 btrfs_exclop_finish(fs_info);44344440 }···63986404 (op == BTRFS_MAP_READ || !dev_replace_is_ongoing ||63996405 !dev_replace->tgtdev)) {64006406 set_io_stripe(smap, map, stripe_index, stripe_offset, stripe_nr);64016401- *mirror_num_ret = mirror_num;64076407+ if (mirror_num_ret)64086408+ *mirror_num_ret = mirror_num;64026409 *bioc_ret = NULL;64036410 ret = 0;64046411 goto out;
+143-35
fs/ext4/mballoc.c
···10061006 * fls() instead since we need to know the actual length while modifying10071007 * goal length.10081008 */10091009- order = fls(ac->ac_g_ex.fe_len);10091009+ order = fls(ac->ac_g_ex.fe_len) - 1;10101010 min_order = order - sbi->s_mb_best_avail_max_trim_order;10111011 if (min_order < 0)10121012 min_order = 0;10131013-10141014- if (1 << min_order < ac->ac_o_ex.fe_len)10151015- min_order = fls(ac->ac_o_ex.fe_len) + 1;1016101310171014 if (sbi->s_stripe > 0) {10181015 /*···10181021 */10191022 num_stripe_clusters = EXT4_NUM_B2C(sbi, sbi->s_stripe);10201023 if (1 << min_order < num_stripe_clusters)10211021- min_order = fls(num_stripe_clusters);10241024+ /*10251025+ * We consider 1 order less because later we round10261026+ * up the goal len to num_stripe_clusters10271027+ */10281028+ min_order = fls(num_stripe_clusters) - 1;10221029 }10301030+10311031+ if (1 << min_order < ac->ac_o_ex.fe_len)10321032+ min_order = fls(ac->ac_o_ex.fe_len);1023103310241034 for (i = order; i >= min_order; i--) {10251035 int frag_order;···47654761 int order, i;47664762 struct ext4_inode_info *ei = EXT4_I(ac->ac_inode);47674763 struct ext4_locality_group *lg;47684768- struct ext4_prealloc_space *tmp_pa, *cpa = NULL;47694769- ext4_lblk_t tmp_pa_start, tmp_pa_end;47644764+ struct ext4_prealloc_space *tmp_pa = NULL, *cpa = NULL;47654765+ loff_t tmp_pa_end;47704766 struct rb_node *iter;47714767 ext4_fsblk_t goal_block;47724768···47744770 if (!(ac->ac_flags & EXT4_MB_HINT_DATA))47754771 return false;4776477247774777- /* first, try per-file preallocation */47734773+ /*47744774+ * first, try per-file preallocation by searching the inode pa rbtree.47754775+ *47764776+ * Here, we can't do a direct traversal of the tree because47774777+ * ext4_mb_discard_group_preallocation() can paralelly mark the pa47784778+ * deleted and that can cause direct traversal to skip some entries.47794779+ */47784780 read_lock(&ei->i_prealloc_lock);47814781+47824782+ if (RB_EMPTY_ROOT(&ei->i_prealloc_node)) {47834783+ goto try_group_pa;47844784+ }47854785+47864786+ /*47874787+ * Step 1: Find a pa with logical start immediately adjacent to the47884788+ * original logical start. This could be on the left or right.47894789+ *47904790+ * (tmp_pa->pa_lstart never changes so we can skip locking for it).47914791+ */47794792 for (iter = ei->i_prealloc_node.rb_node; iter;47804793 iter = ext4_mb_pa_rb_next_iter(ac->ac_o_ex.fe_logical,47814781- tmp_pa_start, iter)) {47944794+ tmp_pa->pa_lstart, iter)) {47824795 tmp_pa = rb_entry(iter, struct ext4_prealloc_space,47834796 pa_node.inode_node);47974797+ }4784479847854785- /* all fields in this condition don't change,47864786- * so we can skip locking for them */47874787- tmp_pa_start = tmp_pa->pa_lstart;47884788- tmp_pa_end = tmp_pa->pa_lstart + EXT4_C2B(sbi, tmp_pa->pa_len);47994799+ /*48004800+ * Step 2: The adjacent pa might be to the right of logical start, find48014801+ * the left adjacent pa. After this step we'd have a valid tmp_pa whose48024802+ * logical start is towards the left of original request's logical start48034803+ */48044804+ if (tmp_pa->pa_lstart > ac->ac_o_ex.fe_logical) {48054805+ struct rb_node *tmp;48064806+ tmp = rb_prev(&tmp_pa->pa_node.inode_node);4789480747904790- /* original request start doesn't lie in this PA */47914791- if (ac->ac_o_ex.fe_logical < tmp_pa_start ||47924792- ac->ac_o_ex.fe_logical >= tmp_pa_end)47934793- continue;47944794-47954795- /* non-extent files can't have physical blocks past 2^32 */47964796- if (!(ext4_test_inode_flag(ac->ac_inode, EXT4_INODE_EXTENTS)) &&47974797- (tmp_pa->pa_pstart + EXT4_C2B(sbi, tmp_pa->pa_len) >47984798- EXT4_MAX_BLOCK_FILE_PHYS)) {48084808+ if (tmp) {48094809+ tmp_pa = rb_entry(tmp, struct ext4_prealloc_space,48104810+ pa_node.inode_node);48114811+ } else {47994812 /*48004800- * Since PAs don't overlap, we won't find any48014801- * other PA to satisfy this.48134813+ * If there is no adjacent pa to the left then finding48144814+ * an overlapping pa is not possible hence stop searching48154815+ * inode pa tree48164816+ */48174817+ goto try_group_pa;48184818+ }48194819+ }48204820+48214821+ BUG_ON(!(tmp_pa && tmp_pa->pa_lstart <= ac->ac_o_ex.fe_logical));48224822+48234823+ /*48244824+ * Step 3: If the left adjacent pa is deleted, keep moving left to find48254825+ * the first non deleted adjacent pa. After this step we should have a48264826+ * valid tmp_pa which is guaranteed to be non deleted.48274827+ */48284828+ for (iter = &tmp_pa->pa_node.inode_node;; iter = rb_prev(iter)) {48294829+ if (!iter) {48304830+ /*48314831+ * no non deleted left adjacent pa, so stop searching48324832+ * inode pa tree48334833+ */48344834+ goto try_group_pa;48354835+ }48364836+ tmp_pa = rb_entry(iter, struct ext4_prealloc_space,48374837+ pa_node.inode_node);48384838+ spin_lock(&tmp_pa->pa_lock);48394839+ if (tmp_pa->pa_deleted == 0) {48404840+ /*48414841+ * We will keep holding the pa_lock from48424842+ * this point on because we don't want group discard48434843+ * to delete this pa underneath us. Since group48444844+ * discard is anyways an ENOSPC operation it48454845+ * should be okay for it to wait a few more cycles.48024846 */48034847 break;48044804- }48054805-48064806- /* found preallocated blocks, use them */48074807- spin_lock(&tmp_pa->pa_lock);48084808- if (tmp_pa->pa_deleted == 0 && tmp_pa->pa_free &&48094809- likely(ext4_mb_pa_goal_check(ac, tmp_pa))) {48104810- atomic_inc(&tmp_pa->pa_count);48114811- ext4_mb_use_inode_pa(ac, tmp_pa);48484848+ } else {48124849 spin_unlock(&tmp_pa->pa_lock);48134813- read_unlock(&ei->i_prealloc_lock);48144814- return true;48154850 }48164816- spin_unlock(&tmp_pa->pa_lock);48174851 }48524852+48534853+ BUG_ON(!(tmp_pa && tmp_pa->pa_lstart <= ac->ac_o_ex.fe_logical));48544854+ BUG_ON(tmp_pa->pa_deleted == 1);48554855+48564856+ /*48574857+ * Step 4: We now have the non deleted left adjacent pa. Only this48584858+ * pa can possibly satisfy the request hence check if it overlaps48594859+ * original logical start and stop searching if it doesn't.48604860+ */48614861+ tmp_pa_end = (loff_t)tmp_pa->pa_lstart + EXT4_C2B(sbi, tmp_pa->pa_len);48624862+48634863+ if (ac->ac_o_ex.fe_logical >= tmp_pa_end) {48644864+ spin_unlock(&tmp_pa->pa_lock);48654865+ goto try_group_pa;48664866+ }48674867+48684868+ /* non-extent files can't have physical blocks past 2^32 */48694869+ if (!(ext4_test_inode_flag(ac->ac_inode, EXT4_INODE_EXTENTS)) &&48704870+ (tmp_pa->pa_pstart + EXT4_C2B(sbi, tmp_pa->pa_len) >48714871+ EXT4_MAX_BLOCK_FILE_PHYS)) {48724872+ /*48734873+ * Since PAs don't overlap, we won't find any other PA to48744874+ * satisfy this.48754875+ */48764876+ spin_unlock(&tmp_pa->pa_lock);48774877+ goto try_group_pa;48784878+ }48794879+48804880+ if (tmp_pa->pa_free && likely(ext4_mb_pa_goal_check(ac, tmp_pa))) {48814881+ atomic_inc(&tmp_pa->pa_count);48824882+ ext4_mb_use_inode_pa(ac, tmp_pa);48834883+ spin_unlock(&tmp_pa->pa_lock);48844884+ read_unlock(&ei->i_prealloc_lock);48854885+ return true;48864886+ } else {48874887+ /*48884888+ * We found a valid overlapping pa but couldn't use it because48894889+ * it had no free blocks. This should ideally never happen48904890+ * because:48914891+ *48924892+ * 1. When a new inode pa is added to rbtree it must have48934893+ * pa_free > 0 since otherwise we won't actually need48944894+ * preallocation.48954895+ *48964896+ * 2. An inode pa that is in the rbtree can only have it's48974897+ * pa_free become zero when another thread calls:48984898+ * ext4_mb_new_blocks48994899+ * ext4_mb_use_preallocated49004900+ * ext4_mb_use_inode_pa49014901+ *49024902+ * 3. Further, after the above calls make pa_free == 0, we will49034903+ * immediately remove it from the rbtree in:49044904+ * ext4_mb_new_blocks49054905+ * ext4_mb_release_context49064906+ * ext4_mb_put_pa49074907+ *49084908+ * 4. Since the pa_free becoming 0 and pa_free getting removed49094909+ * from tree both happen in ext4_mb_new_blocks, which is always49104910+ * called with i_data_sem held for data allocations, we can be49114911+ * sure that another process will never see a pa in rbtree with49124912+ * pa_free == 0.49134913+ */49144914+ WARN_ON_ONCE(tmp_pa->pa_free == 0);49154915+ }49164916+ spin_unlock(&tmp_pa->pa_lock);49174917+try_group_pa:48184918 read_unlock(&ei->i_prealloc_lock);4819491948204920 /* can we use group allocation? */
+14
fs/ext4/xattr.c
···17821782 memmove(here, (void *)here + size,17831783 (void *)last - (void *)here + sizeof(__u32));17841784 memset(last, 0, size);17851785+17861786+ /*17871787+ * Update i_inline_off - moved ibody region might contain17881788+ * system.data attribute. Handling a failure here won't17891789+ * cause other complications for setting an xattr.17901790+ */17911791+ if (!is_block && ext4_has_inline_data(inode)) {17921792+ ret = ext4_find_inline_data_nolock(inode);17931793+ if (ret) {17941794+ ext4_warning_inode(inode,17951795+ "unable to update i_inline_off");17961796+ goto out;17971797+ }17981798+ }17851799 } else if (s->not_found) {17861800 /* Insert new name. */17871801 size_t size = EXT4_XATTR_LEN(name_len);
+1-3
fs/fuse/dir.c
···258258 spin_unlock(&fi->lock);259259 }260260 kfree(forget);261261- if (ret == -ENOMEM)261261+ if (ret == -ENOMEM || ret == -EINTR)262262 goto out;263263 if (ret || fuse_invalid_attr(&outarg.attr) ||264264 fuse_stale_inode(inode, outarg.generation, &outarg.attr))···395395 goto out_put_forget;396396397397 err = -EIO;398398- if (!outarg->nodeid)399399- goto out_put_forget;400398 if (fuse_invalid_attr(&outarg->attr))401399 goto out_put_forget;402400
···872872 while ((ret = iomap_iter(&iter, ops)) > 0)873873 iter.processed = iomap_write_iter(&iter, i);874874875875- if (unlikely(ret < 0))875875+ if (unlikely(iter.pos == iocb->ki_pos))876876 return ret;877877 ret = iter.pos - iocb->ki_pos;878878- iocb->ki_pos += ret;878878+ iocb->ki_pos = iter.pos;879879 return ret;880880}881881EXPORT_SYMBOL_GPL(iomap_file_buffered_write);
+100-189
fs/jbd2/checkpoint.c
···2727 *2828 * Called with j_list_lock held.2929 */3030-static inline void __buffer_unlink_first(struct journal_head *jh)3030+static inline void __buffer_unlink(struct journal_head *jh)3131{3232 transaction_t *transaction = jh->b_cp_transaction;3333···3838 if (transaction->t_checkpoint_list == jh)3939 transaction->t_checkpoint_list = NULL;4040 }4141-}4242-4343-/*4444- * Unlink a buffer from a transaction checkpoint(io) list.4545- *4646- * Called with j_list_lock held.4747- */4848-static inline void __buffer_unlink(struct journal_head *jh)4949-{5050- transaction_t *transaction = jh->b_cp_transaction;5151-5252- __buffer_unlink_first(jh);5353- if (transaction->t_checkpoint_io_list == jh) {5454- transaction->t_checkpoint_io_list = jh->b_cpnext;5555- if (transaction->t_checkpoint_io_list == jh)5656- transaction->t_checkpoint_io_list = NULL;5757- }5858-}5959-6060-/*6161- * Move a buffer from the checkpoint list to the checkpoint io list6262- *6363- * Called with j_list_lock held6464- */6565-static inline void __buffer_relink_io(struct journal_head *jh)6666-{6767- transaction_t *transaction = jh->b_cp_transaction;6868-6969- __buffer_unlink_first(jh);7070-7171- if (!transaction->t_checkpoint_io_list) {7272- jh->b_cpnext = jh->b_cpprev = jh;7373- } else {7474- jh->b_cpnext = transaction->t_checkpoint_io_list;7575- jh->b_cpprev = transaction->t_checkpoint_io_list->b_cpprev;7676- jh->b_cpprev->b_cpnext = jh;7777- jh->b_cpnext->b_cpprev = jh;7878- }7979- transaction->t_checkpoint_io_list = jh;8041}81428243/*···144183 struct buffer_head *bh = journal->j_chkpt_bhs[i];145184 BUFFER_TRACE(bh, "brelse");146185 __brelse(bh);186186+ journal->j_chkpt_bhs[i] = NULL;147187 }148188 *batch_count = 0;149189}···204242 jh = transaction->t_checkpoint_list;205243 bh = jh2bh(jh);206244207207- if (buffer_locked(bh)) {208208- get_bh(bh);209209- spin_unlock(&journal->j_list_lock);210210- wait_on_buffer(bh);211211- /* the journal_head may have gone by now */212212- BUFFER_TRACE(bh, "brelse");213213- __brelse(bh);214214- goto retry;215215- }216245 if (jh->b_transaction != NULL) {217246 transaction_t *t = jh->b_transaction;218247 tid_t tid = t->t_tid;···238285 spin_lock(&journal->j_list_lock);239286 goto restart;240287 }241241- if (!buffer_dirty(bh)) {288288+ if (!trylock_buffer(bh)) {289289+ /*290290+ * The buffer is locked, it may be writing back, or291291+ * flushing out in the last couple of cycles, or292292+ * re-adding into a new transaction, need to check293293+ * it again until it's unlocked.294294+ */295295+ get_bh(bh);296296+ spin_unlock(&journal->j_list_lock);297297+ wait_on_buffer(bh);298298+ /* the journal_head may have gone by now */299299+ BUFFER_TRACE(bh, "brelse");300300+ __brelse(bh);301301+ goto retry;302302+ } else if (!buffer_dirty(bh)) {303303+ unlock_buffer(bh);242304 BUFFER_TRACE(bh, "remove from checkpoint");243243- if (__jbd2_journal_remove_checkpoint(jh))244244- /* The transaction was released; we're done */305305+ /*306306+ * If the transaction was released or the checkpoint307307+ * list was empty, we're done.308308+ */309309+ if (__jbd2_journal_remove_checkpoint(jh) ||310310+ !transaction->t_checkpoint_list)245311 goto out;246246- continue;312312+ } else {313313+ unlock_buffer(bh);314314+ /*315315+ * We are about to write the buffer, it could be316316+ * raced by some other transaction shrink or buffer317317+ * re-log logic once we release the j_list_lock,318318+ * leave it on the checkpoint list and check status319319+ * again to make sure it's clean.320320+ */321321+ BUFFER_TRACE(bh, "queue");322322+ get_bh(bh);323323+ J_ASSERT_BH(bh, !buffer_jwrite(bh));324324+ journal->j_chkpt_bhs[batch_count++] = bh;325325+ transaction->t_chp_stats.cs_written++;326326+ transaction->t_checkpoint_list = jh->b_cpnext;247327 }248248- /*249249- * Important: we are about to write the buffer, and250250- * possibly block, while still holding the journal251251- * lock. We cannot afford to let the transaction252252- * logic start messing around with this buffer before253253- * we write it to disk, as that would break254254- * recoverability.255255- */256256- BUFFER_TRACE(bh, "queue");257257- get_bh(bh);258258- J_ASSERT_BH(bh, !buffer_jwrite(bh));259259- journal->j_chkpt_bhs[batch_count++] = bh;260260- __buffer_relink_io(jh);261261- transaction->t_chp_stats.cs_written++;328328+262329 if ((batch_count == JBD2_NR_BATCH) ||263263- need_resched() ||264264- spin_needbreak(&journal->j_list_lock))330330+ need_resched() || spin_needbreak(&journal->j_list_lock) ||331331+ jh2bh(transaction->t_checkpoint_list) == journal->j_chkpt_bhs[0])265332 goto unlock_and_flush;266333 }267334···295322 goto restart;296323 }297324298298- /*299299- * Now we issued all of the transaction's buffers, let's deal300300- * with the buffers that are out for I/O.301301- */302302-restart2:303303- /* Did somebody clean up the transaction in the meanwhile? */304304- if (journal->j_checkpoint_transactions != transaction ||305305- transaction->t_tid != this_tid)306306- goto out;307307-308308- while (transaction->t_checkpoint_io_list) {309309- jh = transaction->t_checkpoint_io_list;310310- bh = jh2bh(jh);311311- if (buffer_locked(bh)) {312312- get_bh(bh);313313- spin_unlock(&journal->j_list_lock);314314- wait_on_buffer(bh);315315- /* the journal_head may have gone by now */316316- BUFFER_TRACE(bh, "brelse");317317- __brelse(bh);318318- spin_lock(&journal->j_list_lock);319319- goto restart2;320320- }321321-322322- /*323323- * Now in whatever state the buffer currently is, we324324- * know that it has been written out and so we can325325- * drop it from the list326326- */327327- if (__jbd2_journal_remove_checkpoint(jh))328328- break;329329- }330325out:331326 spin_unlock(&journal->j_list_lock);332327 result = jbd2_cleanup_journal_tail(journal);···350409/* Checkpoint list management */351410352411/*353353- * journal_clean_one_cp_list412412+ * journal_shrink_one_cp_list354413 *355355- * Find all the written-back checkpoint buffers in the given list and356356- * release them. If 'destroy' is set, clean all buffers unconditionally.414414+ * Find all the written-back checkpoint buffers in the given list415415+ * and try to release them. If the whole transaction is released, set416416+ * the 'released' parameter. Return the number of released checkpointed417417+ * buffers.357418 *358419 * Called with j_list_lock held.359359- * Returns 1 if we freed the transaction, 0 otherwise.360420 */361361-static int journal_clean_one_cp_list(struct journal_head *jh, bool destroy)421421+static unsigned long journal_shrink_one_cp_list(struct journal_head *jh,422422+ bool destroy, bool *released)362423{363424 struct journal_head *last_jh;364425 struct journal_head *next_jh = jh;426426+ unsigned long nr_freed = 0;427427+ int ret;365428429429+ *released = false;366430 if (!jh)367431 return 0;368432···376430 jh = next_jh;377431 next_jh = jh->b_cpnext;378432379379- if (!destroy && __cp_buffer_busy(jh))380380- return 0;381381-382382- if (__jbd2_journal_remove_checkpoint(jh))383383- return 1;384384- /*385385- * This function only frees up some memory386386- * if possible so we dont have an obligation387387- * to finish processing. Bail out if preemption388388- * requested:389389- */390390- if (need_resched())391391- return 0;392392- } while (jh != last_jh);393393-394394- return 0;395395-}396396-397397-/*398398- * journal_shrink_one_cp_list399399- *400400- * Find 'nr_to_scan' written-back checkpoint buffers in the given list401401- * and try to release them. If the whole transaction is released, set402402- * the 'released' parameter. Return the number of released checkpointed403403- * buffers.404404- *405405- * Called with j_list_lock held.406406- */407407-static unsigned long journal_shrink_one_cp_list(struct journal_head *jh,408408- unsigned long *nr_to_scan,409409- bool *released)410410-{411411- struct journal_head *last_jh;412412- struct journal_head *next_jh = jh;413413- unsigned long nr_freed = 0;414414- int ret;415415-416416- if (!jh || *nr_to_scan == 0)417417- return 0;418418-419419- last_jh = jh->b_cpprev;420420- do {421421- jh = next_jh;422422- next_jh = jh->b_cpnext;423423-424424- (*nr_to_scan)--;425425- if (__cp_buffer_busy(jh))426426- continue;433433+ if (destroy) {434434+ ret = __jbd2_journal_remove_checkpoint(jh);435435+ } else {436436+ ret = jbd2_journal_try_remove_checkpoint(jh);437437+ if (ret < 0)438438+ continue;439439+ }427440428441 nr_freed++;429429- ret = __jbd2_journal_remove_checkpoint(jh);430442 if (ret) {431443 *released = true;432444 break;···392488393489 if (need_resched())394490 break;395395- } while (jh != last_jh && *nr_to_scan);491491+ } while (jh != last_jh);396492397493 return nr_freed;398494}···410506 unsigned long *nr_to_scan)411507{412508 transaction_t *transaction, *last_transaction, *next_transaction;413413- bool released;509509+ bool __maybe_unused released;414510 tid_t first_tid = 0, last_tid = 0, next_tid = 0;415511 tid_t tid = 0;416512 unsigned long nr_freed = 0;417417- unsigned long nr_scanned = *nr_to_scan;513513+ unsigned long freed;418514419515again:420516 spin_lock(&journal->j_list_lock);···443539 transaction = next_transaction;444540 next_transaction = transaction->t_cpnext;445541 tid = transaction->t_tid;446446- released = false;447542448448- nr_freed += journal_shrink_one_cp_list(transaction->t_checkpoint_list,449449- nr_to_scan, &released);450450- if (*nr_to_scan == 0)451451- break;452452- if (need_resched() || spin_needbreak(&journal->j_list_lock))453453- break;454454- if (released)455455- continue;456456-457457- nr_freed += journal_shrink_one_cp_list(transaction->t_checkpoint_io_list,458458- nr_to_scan, &released);543543+ freed = journal_shrink_one_cp_list(transaction->t_checkpoint_list,544544+ false, &released);545545+ nr_freed += freed;546546+ (*nr_to_scan) -= min(*nr_to_scan, freed);459547 if (*nr_to_scan == 0)460548 break;461549 if (need_resched() || spin_needbreak(&journal->j_list_lock))···468572 if (*nr_to_scan && next_tid)469573 goto again;470574out:471471- nr_scanned -= *nr_to_scan;472575 trace_jbd2_shrink_checkpoint_list(journal, first_tid, tid, last_tid,473473- nr_freed, nr_scanned, next_tid);576576+ nr_freed, next_tid);474577475578 return nr_freed;476579}···485590void __jbd2_journal_clean_checkpoint_list(journal_t *journal, bool destroy)486591{487592 transaction_t *transaction, *last_transaction, *next_transaction;488488- int ret;593593+ bool released;489594490595 transaction = journal->j_checkpoint_transactions;491596 if (!transaction)···496601 do {497602 transaction = next_transaction;498603 next_transaction = transaction->t_cpnext;499499- ret = journal_clean_one_cp_list(transaction->t_checkpoint_list,500500- destroy);604604+ journal_shrink_one_cp_list(transaction->t_checkpoint_list,605605+ destroy, &released);501606 /*502607 * This function only frees up some memory if possible so we503608 * dont have an obligation to finish processing. Bail out if···505610 */506611 if (need_resched())507612 return;508508- if (ret)509509- continue;510510- /*511511- * It is essential that we are as careful as in the case of512512- * t_checkpoint_list with removing the buffer from the list as513513- * we can possibly see not yet submitted buffers on io_list514514- */515515- ret = journal_clean_one_cp_list(transaction->516516- t_checkpoint_io_list, destroy);517517- if (need_resched())518518- return;519613 /*520614 * Stop scanning if we couldn't free the transaction. This521615 * avoids pointless scanning of transactions which still522616 * weren't checkpointed.523617 */524524- if (!ret)618618+ if (!released)525619 return;526620 } while (transaction != last_transaction);527621}···589705 jbd2_journal_put_journal_head(jh);590706591707 /* Is this transaction empty? */592592- if (transaction->t_checkpoint_list || transaction->t_checkpoint_io_list)708708+ if (transaction->t_checkpoint_list)593709 return 0;594710595711 /*···618734 __jbd2_journal_drop_transaction(journal, transaction);619735 jbd2_journal_free_transaction(transaction);620736 return 1;737737+}738738+739739+/*740740+ * Check the checkpoint buffer and try to remove it from the checkpoint741741+ * list if it's clean. Returns -EBUSY if it is not clean, returns 1 if742742+ * it frees the transaction, 0 otherwise.743743+ *744744+ * This function is called with j_list_lock held.745745+ */746746+int jbd2_journal_try_remove_checkpoint(struct journal_head *jh)747747+{748748+ struct buffer_head *bh = jh2bh(jh);749749+750750+ if (!trylock_buffer(bh))751751+ return -EBUSY;752752+ if (buffer_dirty(bh)) {753753+ unlock_buffer(bh);754754+ return -EBUSY;755755+ }756756+ unlock_buffer(bh);757757+758758+ /*759759+ * Buffer is clean and the IO has finished (we held the buffer760760+ * lock) so the checkpoint is done. We can safely remove the761761+ * buffer from this transaction.762762+ */763763+ JBUFFER_TRACE(jh, "remove from checkpoint list");764764+ return __jbd2_journal_remove_checkpoint(jh);621765}622766623767/*···709797 J_ASSERT(transaction->t_forget == NULL);710798 J_ASSERT(transaction->t_shadow_list == NULL);711799 J_ASSERT(transaction->t_checkpoint_list == NULL);712712- J_ASSERT(transaction->t_checkpoint_io_list == NULL);713800 J_ASSERT(atomic_read(&transaction->t_updates) == 0);714801 J_ASSERT(journal->j_committing_transaction != transaction);715802 J_ASSERT(journal->j_running_transaction != transaction);
+1-2
fs/jbd2/commit.c
···11411141 spin_lock(&journal->j_list_lock);11421142 commit_transaction->t_state = T_FINISHED;11431143 /* Check if the transaction can be dropped now that we are finished */11441144- if (commit_transaction->t_checkpoint_list == NULL &&11451145- commit_transaction->t_checkpoint_io_list == NULL) {11441144+ if (commit_transaction->t_checkpoint_list == NULL) {11461145 __jbd2_journal_drop_transaction(journal, commit_transaction);11471146 jbd2_journal_free_transaction(commit_transaction);11481147 }
+8-32
fs/jbd2/transaction.c
···17841784 * Otherwise, if the buffer has been written to disk,17851785 * it is safe to remove the checkpoint and drop it.17861786 */17871787- if (!buffer_dirty(bh)) {17881788- __jbd2_journal_remove_checkpoint(jh);17871787+ if (jbd2_journal_try_remove_checkpoint(jh) >= 0) {17891788 spin_unlock(&journal->j_list_lock);17901789 goto drop;17911790 }···20992100 __brelse(bh);21002101}2101210221022102-/*21032103- * Called from jbd2_journal_try_to_free_buffers().21042104- *21052105- * Called under jh->b_state_lock21062106- */21072107-static void21082108-__journal_try_to_free_buffer(journal_t *journal, struct buffer_head *bh)21092109-{21102110- struct journal_head *jh;21112111-21122112- jh = bh2jh(bh);21132113-21142114- if (buffer_locked(bh) || buffer_dirty(bh))21152115- goto out;21162116-21172117- if (jh->b_next_transaction != NULL || jh->b_transaction != NULL)21182118- goto out;21192119-21202120- spin_lock(&journal->j_list_lock);21212121- if (jh->b_cp_transaction != NULL) {21222122- /* written-back checkpointed metadata buffer */21232123- JBUFFER_TRACE(jh, "remove from checkpoint list");21242124- __jbd2_journal_remove_checkpoint(jh);21252125- }21262126- spin_unlock(&journal->j_list_lock);21272127-out:21282128- return;21292129-}21302130-21312103/**21322104 * jbd2_journal_try_to_free_buffers() - try to free page buffers.21332105 * @journal: journal for operation···21562186 continue;2157218721582188 spin_lock(&jh->b_state_lock);21592159- __journal_try_to_free_buffer(journal, bh);21892189+ if (!jh->b_transaction && !jh->b_next_transaction) {21902190+ spin_lock(&journal->j_list_lock);21912191+ /* Remove written-back checkpointed metadata buffer */21922192+ if (jh->b_cp_transaction != NULL)21932193+ jbd2_journal_try_remove_checkpoint(jh);21942194+ spin_unlock(&journal->j_list_lock);21952195+ }21602196 spin_unlock(&jh->b_state_lock);21612197 jbd2_journal_put_journal_head(jh);21622198 if (buffer_jbd(bh))
+2-2
fs/smb/client/cifsfs.h
···159159#endif /* CONFIG_CIFS_NFSD_EXPORT */160160161161/* when changing internal version - update following two lines at same time */162162-#define SMB3_PRODUCT_BUILD 43163163-#define CIFS_VERSION "2.43"162162+#define SMB3_PRODUCT_BUILD 44163163+#define CIFS_VERSION "2.44"164164#endif /* _CIFSFS_H */
+13-4
fs/smb/client/ioctl.c
···433433 * Dump encryption keys. This is an old ioctl that only434434 * handles AES-128-{CCM,GCM}.435435 */436436- if (pSMBFile == NULL)437437- break;438436 if (!capable(CAP_SYS_ADMIN)) {439437 rc = -EACCES;440438 break;441439 }442440443443- tcon = tlink_tcon(pSMBFile->tlink);441441+ cifs_sb = CIFS_SB(inode->i_sb);442442+ tlink = cifs_sb_tlink(cifs_sb);443443+ if (IS_ERR(tlink)) {444444+ rc = PTR_ERR(tlink);445445+ break;446446+ }447447+ tcon = tlink_tcon(tlink);444448 if (!smb3_encryption_required(tcon)) {445449 rc = -EOPNOTSUPP;450450+ cifs_put_tlink(tlink);446451 break;447452 }448453 pkey_inf.cipher_type =···464459 rc = -EFAULT;465460 else466461 rc = 0;462462+ cifs_put_tlink(tlink);467463 break;468464 case CIFS_DUMP_FULL_KEY:469465 /*···476470 rc = -EACCES;477471 break;478472 }479479- tcon = tlink_tcon(pSMBFile->tlink);473473+ cifs_sb = CIFS_SB(inode->i_sb);474474+ tlink = cifs_sb_tlink(cifs_sb);475475+ tcon = tlink_tcon(tlink);480476 rc = cifs_dump_full_key(tcon, (void __user *)arg);477477+ cifs_put_tlink(tlink);481478 break;482479 case CIFS_IOC_NOTIFY:483480 if (!S_ISDIR(inode->i_mode)) {
+66-9
fs/xfs/libxfs/xfs_da_format.h
···591591 uint8_t valuelen; /* actual length of value (no NULL) */592592 uint8_t flags; /* flags bits (see xfs_attr_leaf.h) */593593 uint8_t nameval[]; /* name & value bytes concatenated */594594- } list[1]; /* variable sized array */594594+ } list[]; /* variable sized array */595595};596596597597typedef struct xfs_attr_leaf_map { /* RLE map of free bytes */···620620typedef struct xfs_attr_leaf_name_local {621621 __be16 valuelen; /* number of bytes in value */622622 __u8 namelen; /* length of name bytes */623623- __u8 nameval[1]; /* name/value bytes */623623+ /*624624+ * In Linux 6.5 this flex array was converted from nameval[1] to625625+ * nameval[]. Be very careful here about extra padding at the end;626626+ * see xfs_attr_leaf_entsize_local() for details.627627+ */628628+ __u8 nameval[]; /* name/value bytes */624629} xfs_attr_leaf_name_local_t;625630626631typedef struct xfs_attr_leaf_name_remote {627632 __be32 valueblk; /* block number of value bytes */628633 __be32 valuelen; /* number of bytes in value */629634 __u8 namelen; /* length of name bytes */630630- __u8 name[1]; /* name bytes */635635+ /*636636+ * In Linux 6.5 this flex array was converted from name[1] to name[].637637+ * Be very careful here about extra padding at the end; see638638+ * xfs_attr_leaf_entsize_remote() for details.639639+ */640640+ __u8 name[]; /* name bytes */631641} xfs_attr_leaf_name_remote_t;632642633643typedef struct xfs_attr_leafblock {634644 xfs_attr_leaf_hdr_t hdr; /* constant-structure header block */635635- xfs_attr_leaf_entry_t entries[1]; /* sorted on key, not name */645645+ xfs_attr_leaf_entry_t entries[]; /* sorted on key, not name */636646 /*637647 * The rest of the block contains the following structures after the638648 * leaf entries, growing from the bottom up. The variables are never···674664675665struct xfs_attr3_leafblock {676666 struct xfs_attr3_leaf_hdr hdr;677677- struct xfs_attr_leaf_entry entries[1];667667+ struct xfs_attr_leaf_entry entries[];678668679669 /*680670 * The rest of the block contains the following structures after the···757747 */758748static inline int xfs_attr_leaf_entsize_remote(int nlen)759749{760760- return round_up(sizeof(struct xfs_attr_leaf_name_remote) - 1 +761761- nlen, XFS_ATTR_LEAF_NAME_ALIGN);750750+ /*751751+ * Prior to Linux 6.5, struct xfs_attr_leaf_name_remote ended with752752+ * name[1], which was used as a flexarray. The layout of this struct753753+ * is 9 bytes of fixed-length fields followed by a __u8 flex array at754754+ * offset 9.755755+ *756756+ * On most architectures, struct xfs_attr_leaf_name_remote had two757757+ * bytes of implicit padding at the end of the struct to make the758758+ * struct length 12. After converting name[1] to name[], there are759759+ * three implicit padding bytes and the struct size remains 12.760760+ * However, there are compiler configurations that do not add implicit761761+ * padding at all (m68k) and have been broken for years.762762+ *763763+ * This entsize computation historically added (the xattr name length)764764+ * to (the padded struct length - 1) and rounded that sum up to the765765+ * nearest multiple of 4 (NAME_ALIGN). IOWs, round_up(11 + nlen, 4).766766+ * This is encoded in the ondisk format, so we cannot change this.767767+ *768768+ * Compute the entsize from offsetof of the flexarray and manually769769+ * adding bytes for the implicit padding.770770+ */771771+ const size_t remotesize =772772+ offsetof(struct xfs_attr_leaf_name_remote, name) + 2;773773+774774+ return round_up(remotesize + nlen, XFS_ATTR_LEAF_NAME_ALIGN);762775}763776764777static inline int xfs_attr_leaf_entsize_local(int nlen, int vlen)765778{766766- return round_up(sizeof(struct xfs_attr_leaf_name_local) - 1 +767767- nlen + vlen, XFS_ATTR_LEAF_NAME_ALIGN);779779+ /*780780+ * Prior to Linux 6.5, struct xfs_attr_leaf_name_local ended with781781+ * nameval[1], which was used as a flexarray. The layout of this782782+ * struct is 3 bytes of fixed-length fields followed by a __u8 flex783783+ * array at offset 3.784784+ *785785+ * struct xfs_attr_leaf_name_local had zero bytes of implicit padding786786+ * at the end of the struct to make the struct length 4. On most787787+ * architectures, after converting nameval[1] to nameval[], there is788788+ * one implicit padding byte and the struct size remains 4. However,789789+ * there are compiler configurations that do not add implicit padding790790+ * at all (m68k) and would break.791791+ *792792+ * This entsize computation historically added (the xattr name and793793+ * value length) to (the padded struct length - 1) and rounded that sum794794+ * up to the nearest multiple of 4 (NAME_ALIGN). IOWs, the formula is795795+ * round_up(3 + nlen + vlen, 4). This is encoded in the ondisk format,796796+ * so we cannot change this.797797+ *798798+ * Compute the entsize from offsetof of the flexarray and manually799799+ * adding bytes for the implicit padding.800800+ */801801+ const size_t localsize =802802+ offsetof(struct xfs_attr_leaf_name_local, nameval);803803+804804+ return round_up(localsize + nlen + vlen, XFS_ATTR_LEAF_NAME_ALIGN);768805}769806770807static inline int xfs_attr_leaf_entsize_local_max(int bsize)
+2-2
fs/xfs/libxfs/xfs_fs.h
···592592struct xfs_attrlist {593593 __s32 al_count; /* number of entries in attrlist */594594 __s32 al_more; /* T/F: more attrs (do call again) */595595- __s32 al_offset[1]; /* byte offsets of attrs [var-sized] */595595+ __s32 al_offset[]; /* byte offsets of attrs [var-sized] */596596};597597598598struct xfs_attrlist_ent { /* data from attr_list() */599599 __u32 a_valuelen; /* number bytes in value of attr */600600- char a_name[1]; /* attr name (NULL terminated) */600600+ char a_name[]; /* attr name (NULL terminated) */601601};602602603603typedef struct xfs_fsop_attrlist_handlereq {
···431431432432int vgic_v4_load(struct kvm_vcpu *vcpu);433433void vgic_v4_commit(struct kvm_vcpu *vcpu);434434-int vgic_v4_put(struct kvm_vcpu *vcpu, bool need_db);434434+int vgic_v4_put(struct kvm_vcpu *vcpu);435435436436/* CPU HP callbacks */437437void kvm_vgic_cpu_up(void);
-2
include/linux/blk-mq.h
···397397 */398398 struct blk_mq_tags *sched_tags;399399400400- /** @queued: Number of queued requests. */401401- unsigned long queued;402400 /** @run: Number of dispatched requests. */403401 unsigned long run;404402
+1-6
include/linux/jbd2.h
···614614 struct journal_head *t_checkpoint_list;615615616616 /*617617- * Doubly-linked circular list of all buffers submitted for IO while618618- * checkpointing. [j_list_lock]619619- */620620- struct journal_head *t_checkpoint_io_list;621621-622622- /*623617 * Doubly-linked circular list of metadata buffers being624618 * shadowed by log IO. The IO buffers on the iobuf list and625619 * the shadow buffers on this list match each other one for···14431449void __jbd2_journal_clean_checkpoint_list(journal_t *journal, bool destroy);14441450unsigned long jbd2_journal_shrink_checkpoint_list(journal_t *journal, unsigned long *nr_to_scan);14451451int __jbd2_journal_remove_checkpoint(struct journal_head *);14521452+int jbd2_journal_try_remove_checkpoint(struct journal_head *jh);14461453void jbd2_journal_destroy_checkpoint(journal_t *journal);14471454void __jbd2_journal_insert_checkpoint(struct journal_head *, transaction_t *);14481455
···277277 unsigned short vlan_id;278278};279279280280-/**280280+/*281281 * Returns NULL if the net_device does not belong to any of the bond's slaves282282 *283283 * Caller must hold bond lock for read
+2-1
include/net/cfg802154.h
···170170}171171172172/**173173- * @WPAN_PHY_FLAG_TRANSMIT_POWER: Indicates that transceiver will support173173+ * enum wpan_phy_flags - WPAN PHY state flags174174+ * @WPAN_PHY_FLAG_TXPOWER: Indicates that transceiver will support174175 * transmit power setting.175176 * @WPAN_PHY_FLAG_CCA_ED_LEVEL: Indicates that transceiver will support cca ed176177 * level setting.
+2-2
include/net/codel.h
···145145 * @maxpacket: largest packet we've seen so far146146 * @drop_count: temp count of dropped packets in dequeue()147147 * @drop_len: bytes of dropped packets in dequeue()148148- * ecn_mark: number of packets we ECN marked instead of dropping149149- * ce_mark: number of packets CE marked because sojourn time was above ce_threshold148148+ * @ecn_mark: number of packets we ECN marked instead of dropping149149+ * @ce_mark: number of packets CE marked because sojourn time was above ce_threshold150150 */151151struct codel_stats {152152 u32 maxpacket;
+16-12
include/net/devlink.h
···221221/**222222 * struct devlink_dpipe_header - dpipe header object223223 * @name: header name224224- * @id: index, global/local detrmined by global bit224224+ * @id: index, global/local determined by global bit225225 * @fields: fields226226 * @fields_count: number of fields227227 * @global: indicates if header is shared like most protocol header···241241 * @header_index: header index (packets can have several headers of same242242 * type like in case of tunnels)243243 * @header: header244244- * @fieled_id: field index244244+ * @field_id: field index245245 */246246struct devlink_dpipe_match {247247 enum devlink_dpipe_match_type type;···256256 * @header_index: header index (packets can have several headers of same257257 * type like in case of tunnels)258258 * @header: header259259- * @fieled_id: field index259259+ * @field_id: field index260260 */261261struct devlink_dpipe_action {262262 enum devlink_dpipe_action_type type;···292292 * struct devlink_dpipe_entry - table entry object293293 * @index: index of the entry in the table294294 * @match_values: match values295295- * @matche_values_count: count of matches tuples295295+ * @match_values_count: count of matches tuples296296 * @action_values: actions values297297 * @action_values_count: count of actions values298298 * @counter: value of counter···342342 */343343struct devlink_dpipe_table {344344 void *priv;345345+ /* private: */345346 struct list_head list;347347+ /* public: */346348 const char *name;347349 bool counters_enabled;348350 bool counter_control_extern;···357355358356/**359357 * struct devlink_dpipe_table_ops - dpipe_table ops360360- * @actions_dump - dumps all tables actions361361- * @matches_dump - dumps all tables matches362362- * @entries_dump - dumps all active entries in the table363363- * @counters_set_update - when changing the counter status hardware sync358358+ * @actions_dump: dumps all tables actions359359+ * @matches_dump: dumps all tables matches360360+ * @entries_dump: dumps all active entries in the table361361+ * @counters_set_update: when changing the counter status hardware sync364362 * maybe needed to allocate/free counter related365363 * resources366366- * @size_get - get size364364+ * @size_get: get size367365 */368366struct devlink_dpipe_table_ops {369367 int (*actions_dump)(void *priv, struct sk_buff *skb);···376374377375/**378376 * struct devlink_dpipe_headers - dpipe headers379379- * @headers - header array can be shared (global bit) or driver specific380380- * @headers_count - count of headers377377+ * @headers: header array can be shared (global bit) or driver specific378378+ * @headers_count: count of headers381379 */382380struct devlink_dpipe_headers {383381 struct devlink_dpipe_header **headers;···389387 * @size_min: minimum size which can be set390388 * @size_max: maximum size which can be set391389 * @size_granularity: size granularity392392- * @size_unit: resource's basic unit390390+ * @unit: resource's basic unit393391 */394392struct devlink_resource_size_params {395393 u64 size_min;···459457460458/**461459 * struct devlink_param - devlink configuration parameter data460460+ * @id: devlink parameter id number462461 * @name: name of the parameter463462 * @generic: indicates if the parameter is generic or driver specific464463 * @type: parameter type···635632 * struct devlink_flash_update_params - Flash Update parameters636633 * @fw: pointer to the firmware data to update from637634 * @component: the flash component to update635635+ * @overwrite_mask: which types of flash update are supported (may be %0)638636 *639637 * With the exception of fw, drivers must opt-in to parameters by640638 * setting the appropriate bit in the supported_flash_update_params field in
+1-1
include/net/inet_frag.h
···2929};30303131/**3232- * fragment queue flags3232+ * enum: fragment queue flags3333 *3434 * @INET_FRAG_FIRST_IN: first fragment has arrived3535 * @INET_FRAG_LAST_IN: final fragment has arrived
···269269/**270270 * llc_pdu_decode_da - extracts dest address of input frame271271 * @skb: input skb that destination address must be extracted from it272272- * @sa: pointer to destination address (6 byte array).272272+ * @da: pointer to destination address (6 byte array).273273 *274274 * This function extracts destination address(MAC) of input frame.275275 */···321321322322/**323323 * llc_pdu_init_as_test_cmd - sets PDU as TEST324324- * @skb - Address of the skb to build324324+ * @skb: Address of the skb to build325325 *326326 * Sets a PDU as TEST327327 */···369369/**370370 * llc_pdu_init_as_xid_cmd - sets bytes 3, 4 & 5 of LLC header as XID371371 * @skb: input skb that header must be set into it.372372+ * @svcs_supported: The class of the LLC (I or II)373373+ * @rx_window: The size of the receive window of the LLC372374 *373375 * This function sets third,fourth,fifth and sixth bytes of LLC header as374376 * a XID PDU.
···1717/**1818 * struct pie_params - contains pie parameters1919 * @target: target delay in pschedtime2020- * @tudpate: interval at which drop probability is calculated2020+ * @tupdate: interval at which drop probability is calculated2121 * @limit: total number of packets that can be in the queue2222 * @alpha: parameter to control drop probability2323 * @beta: parameter to control drop probability
+1-1
include/net/rsi_91x.h
···11-/**11+/*22 * Copyright (c) 2017 Redpine Signals Inc.33 *44 * Permission to use, copy, modify, and/or distribute this software for any
+24-7
include/net/tcp.h
···15091509static inline int keepalive_intvl_when(const struct tcp_sock *tp)15101510{15111511 struct net *net = sock_net((struct sock *)tp);15121512+ int val;1512151315131513- return tp->keepalive_intvl ? :15141514- READ_ONCE(net->ipv4.sysctl_tcp_keepalive_intvl);15141514+ /* Paired with WRITE_ONCE() in tcp_sock_set_keepintvl()15151515+ * and do_tcp_setsockopt().15161516+ */15171517+ val = READ_ONCE(tp->keepalive_intvl);15181518+15191519+ return val ? : READ_ONCE(net->ipv4.sysctl_tcp_keepalive_intvl);15151520}1516152115171522static inline int keepalive_time_when(const struct tcp_sock *tp)15181523{15191524 struct net *net = sock_net((struct sock *)tp);15251525+ int val;1520152615211521- return tp->keepalive_time ? :15221522- READ_ONCE(net->ipv4.sysctl_tcp_keepalive_time);15271527+ /* Paired with WRITE_ONCE() in tcp_sock_set_keepidle_locked() */15281528+ val = READ_ONCE(tp->keepalive_time);15291529+15301530+ return val ? : READ_ONCE(net->ipv4.sysctl_tcp_keepalive_time);15231531}1524153215251533static inline int keepalive_probes(const struct tcp_sock *tp)15261534{15271535 struct net *net = sock_net((struct sock *)tp);15361536+ int val;1528153715291529- return tp->keepalive_probes ? :15301530- READ_ONCE(net->ipv4.sysctl_tcp_keepalive_probes);15381538+ /* Paired with WRITE_ONCE() in tcp_sock_set_keepcnt()15391539+ * and do_tcp_setsockopt().15401540+ */15411541+ val = READ_ONCE(tp->keepalive_probes);15421542+15431543+ return val ? : READ_ONCE(net->ipv4.sysctl_tcp_keepalive_probes);15311544}1532154515331546static inline u32 keepalive_time_elapsed(const struct tcp_sock *tp)···20612048static inline u32 tcp_notsent_lowat(const struct tcp_sock *tp)20622049{20632050 struct net *net = sock_net((struct sock *)tp);20642064- return tp->notsent_lowat ?: READ_ONCE(net->ipv4.sysctl_tcp_notsent_lowat);20512051+ u32 val;20522052+20532053+ val = READ_ONCE(tp->notsent_lowat);20542054+20552055+ return val ?: READ_ONCE(net->ipv4.sysctl_tcp_notsent_lowat);20652056}2066205720672058bool tcp_stream_memory_free(const struct sock *sk, int wake);
···19481948 ret = io_issue_sqe(req, issue_flags);19491949 if (ret != -EAGAIN)19501950 break;19511951+19521952+ /*19531953+ * If REQ_F_NOWAIT is set, then don't wait or retry with19541954+ * poll. -EAGAIN is final for that case.19551955+ */19561956+ if (req->flags & REQ_F_NOWAIT)19571957+ break;19581958+19511959 /*19521960 * We can get EAGAIN for iopolled IO even though we're19531961 * forcing a sync submission from here, since we can't···34373429 unsigned long addr, unsigned long len,34383430 unsigned long pgoff, unsigned long flags)34393431{34403440- const unsigned long mmap_end = arch_get_mmap_end(addr, len, flags);34413441- struct vm_unmapped_area_info info;34423432 void *ptr;3443343334443434 /*···34513445 if (IS_ERR(ptr))34523446 return -ENOMEM;3453344734543454- info.flags = VM_UNMAPPED_AREA_TOPDOWN;34553455- info.length = len;34563456- info.low_limit = max(PAGE_SIZE, mmap_min_addr);34573457- info.high_limit = arch_get_mmap_base(addr, current->mm->mmap_base);34583458-#ifdef SHM_COLOUR34593459- info.align_mask = PAGE_MASK & (SHM_COLOUR - 1UL);34603460-#else34613461- info.align_mask = PAGE_MASK & (SHMLBA - 1UL);34623462-#endif34633463- info.align_offset = (unsigned long) ptr;34643464-34653448 /*34663466- * A failed mmap() very likely causes application failure,34673467- * so fall back to the bottom-up function here. This scenario34683468- * can happen with large stack limits and large mmap()34693469- * allocations.34493449+ * Some architectures have strong cache aliasing requirements.34503450+ * For such architectures we need a coherent mapping which aliases34513451+ * kernel memory *and* userspace memory. To achieve that:34523452+ * - use a NULL file pointer to reference physical memory, and34533453+ * - use the kernel virtual address of the shared io_uring context34543454+ * (instead of the userspace-provided address, which has to be 0UL34553455+ * anyway).34563456+ * For architectures without such aliasing requirements, the34573457+ * architecture will return any suitable mapping because addr is 0.34703458 */34713471- addr = vm_unmapped_area(&info);34723472- if (offset_in_page(addr)) {34733473- info.flags = 0;34743474- info.low_limit = TASK_UNMAPPED_BASE;34753475- info.high_limit = mmap_end;34763476- addr = vm_unmapped_area(&info);34773477- }34783478-34793479- return addr;34593459+ filp = NULL;34603460+ flags |= MAP_SHARED;34613461+ pgoff = 0; /* has been translated to ptr above */34623462+#ifdef SHM_COLOUR34633463+ addr = (uintptr_t) ptr;34643464+#else34653465+ addr = 0UL;34663466+#endif34673467+ return current->mm->get_unmapped_area(filp, addr, len, pgoff, flags);34803468}3481346934823470#else /* !CONFIG_MMU */···38703870 ctx->syscall_iopoll = 1;3871387138723872 ctx->compat = in_compat_syscall();38733873- if (!capable(CAP_IPC_LOCK))38733873+ if (!ns_capable_noaudit(&init_user_ns, CAP_IPC_LOCK))38743874 ctx->user = get_uid(current_user());3875387538763876 /*
+25-7
kernel/bpf/verifier.c
···55735573 * Since recursion is prevented by check_cfg() this algorithm55745574 * only needs a local stack of MAX_CALL_FRAMES to remember callsites55755575 */55765576-static int check_max_stack_depth(struct bpf_verifier_env *env)55765576+static int check_max_stack_depth_subprog(struct bpf_verifier_env *env, int idx)55775577{55785578- int depth = 0, frame = 0, idx = 0, i = 0, subprog_end;55795578 struct bpf_subprog_info *subprog = env->subprog_info;55805579 struct bpf_insn *insn = env->prog->insnsi;55805580+ int depth = 0, frame = 0, i, subprog_end;55815581 bool tail_call_reachable = false;55825582 int ret_insn[MAX_CALL_FRAMES];55835583 int ret_prog[MAX_CALL_FRAMES];55845584 int j;5585558555865586+ i = subprog[idx].start;55865587process_func:55875588 /* protect against potential stack overflow that might happen when55885589 * bpf2bpf calls get combined with tailcalls. Limit the caller's stack···56225621continue_func:56235622 subprog_end = subprog[idx + 1].start;56245623 for (; i < subprog_end; i++) {56255625- int next_insn;56245624+ int next_insn, sidx;5626562556275626 if (!bpf_pseudo_call(insn + i) && !bpf_pseudo_func(insn + i))56285627 continue;···5632563156335632 /* find the callee */56345633 next_insn = i + insn[i].imm + 1;56355635- idx = find_subprog(env, next_insn);56365636- if (idx < 0) {56345634+ sidx = find_subprog(env, next_insn);56355635+ if (sidx < 0) {56375636 WARN_ONCE(1, "verifier bug. No program starts at insn %d\n",56385637 next_insn);56395638 return -EFAULT;56405639 }56415641- if (subprog[idx].is_async_cb) {56425642- if (subprog[idx].has_tail_call) {56405640+ if (subprog[sidx].is_async_cb) {56415641+ if (subprog[sidx].has_tail_call) {56435642 verbose(env, "verifier bug. subprog has tail_call and async cb\n");56445643 return -EFAULT;56455644 }···56485647 continue;56495648 }56505649 i = next_insn;56505650+ idx = sidx;5651565156525652 if (subprog[idx].has_tail_call)56535653 tail_call_reachable = true;···56825680 i = ret_insn[frame];56835681 idx = ret_prog[frame];56845682 goto continue_func;56835683+}56845684+56855685+static int check_max_stack_depth(struct bpf_verifier_env *env)56865686+{56875687+ struct bpf_subprog_info *si = env->subprog_info;56885688+ int ret;56895689+56905690+ for (int i = 0; i < env->subprog_cnt; i++) {56915691+ if (!i || si[i].is_async_cb) {56925692+ ret = check_max_stack_depth_subprog(env, i);56935693+ if (ret < 0)56945694+ return ret;56955695+ }56965696+ continue;56975697+ }56985698+ return 0;56855699}5686570056875701#ifndef CONFIG_BPF_JIT_ALWAYS_ON
+5-5
kernel/sys.c
···25352535 else25362536 return -EINVAL;25372537 break;25382538- case PR_GET_AUXV:25392539- if (arg4 || arg5)25402540- return -EINVAL;25412541- error = prctl_get_auxv((void __user *)arg2, arg3);25422542- break;25432538 default:25442539 return -EINVAL;25452540 }···26882693 break;26892694 case PR_SET_VMA:26902695 error = prctl_set_vma(arg2, arg3, arg4, arg5);26962696+ break;26972697+ case PR_GET_AUXV:26982698+ if (arg4 || arg5)26992699+ return -EINVAL;27002700+ error = prctl_get_auxv((void __user *)arg2, arg3);26912701 break;26922702#ifdef CONFIG_KSM26932703 case PR_SET_MEMORY_MERGE:
+13-1
kernel/trace/ring_buffer.c
···536536 unsigned flags;537537 int cpus;538538 atomic_t record_disabled;539539+ atomic_t resizing;539540 cpumask_var_t cpumask;540541541542 struct lock_class_key *reader_lock_key;···2168216721692168 /* prevent another thread from changing buffer sizes */21702169 mutex_lock(&buffer->mutex);21712171-21702170+ atomic_inc(&buffer->resizing);2172217121732172 if (cpu_id == RING_BUFFER_ALL_CPUS) {21742173 /*···23232322 atomic_dec(&buffer->record_disabled);23242323 }2325232423252325+ atomic_dec(&buffer->resizing);23262326 mutex_unlock(&buffer->mutex);23272327 return 0;23282328···23442342 }23452343 }23462344 out_err_unlock:23452345+ atomic_dec(&buffer->resizing);23472346 mutex_unlock(&buffer->mutex);23482347 return err;23492348}···55425539 if (local_read(&cpu_buffer_a->committing))55435540 goto out_dec;55445541 if (local_read(&cpu_buffer_b->committing))55425542+ goto out_dec;55435543+55445544+ /*55455545+ * When resize is in progress, we cannot swap it because55465546+ * it will mess the state of the cpu buffer.55475547+ */55485548+ if (atomic_read(&buffer_a->resizing))55495549+ goto out_dec;55505550+ if (atomic_read(&buffer_b->resizing))55455551 goto out_dec;5546555255475553 buffer_a->buffers[cpu] = cpu_buffer_b;
+2-1
kernel/trace/trace.c
···19281928 * place on this CPU. We fail to record, but we reset19291929 * the max trace buffer (no one writes directly to it)19301930 * and flag that it failed.19311931+ * Another reason is resize is in progress.19311932 */19321933 trace_array_printk_buf(tr->max_buffer.buffer, _THIS_IP_,19331933- "Failed to swap buffers due to commit in progress\n");19341934+ "Failed to swap buffers due to commit or resize in progress\n");19341935 }1935193619361937 WARN_ON_ONCE(ret && ret != -EAGAIN && ret != -EBUSY);
+2-1
kernel/trace/trace_events_hist.c
···66686668 goto out_unreg;6669666966706670 if (has_hist_vars(hist_data) || hist_data->n_var_refs) {66716671- if (save_hist_vars(hist_data))66716671+ ret = save_hist_vars(hist_data);66726672+ if (ret)66726673 goto out_unreg;66736674 }66746675
-4
kernel/trace/tracing_map.h
···272272extern u64 tracing_map_read_var(struct tracing_map_elt *elt, unsigned int i);273273extern u64 tracing_map_read_var_once(struct tracing_map_elt *elt, unsigned int i);274274275275-extern void tracing_map_set_field_descr(struct tracing_map *map,276276- unsigned int i,277277- unsigned int key_offset,278278- tracing_map_cmp_fn_t cmp_fn);279275extern int280276tracing_map_sort_entries(struct tracing_map *map,281277 struct tracing_map_sort_key *sort_keys,
···550550551551static void __sbitmap_queue_wake_up(struct sbitmap_queue *sbq, int nr)552552{553553- int i, wake_index;553553+ int i, wake_index, woken;554554555555 if (!atomic_read(&sbq->ws_active))556556 return;···567567 */568568 wake_index = sbq_index_inc(wake_index);569569570570- /*571571- * It is sufficient to wake up at least one waiter to572572- * guarantee forward progress.573573- */574574- if (waitqueue_active(&ws->wait) &&575575- wake_up_nr(&ws->wait, nr))576576- break;570570+ if (waitqueue_active(&ws->wait)) {571571+ woken = wake_up_nr(&ws->wait, nr);572572+ if (woken == nr)573573+ break;574574+ nr -= woken;575575+ }577576 }578577579578 if (wake_index != atomic_read(&sbq->wake_index))
+4-1
lib/test_maple_tree.c
···18981898 725};18991899 static const unsigned long level2_32[] = { 1747, 2000, 1750, 1755,19001900 1760, 1765};19011901+ unsigned long last_index;1901190219021903 if (MAPLE_32BIT) {19031904 nr_entries = 500;19041905 level2 = level2_32;19061906+ last_index = 0x138e;19051907 } else {19061908 nr_entries = 200;19071909 level2 = level2_64;19101910+ last_index = 0x7d6;19081911 }1909191219101913 for (i = 0; i <= nr_entries; i++)···2014201120152012 val = mas_next(&mas, ULONG_MAX);20162013 MT_BUG_ON(mt, val != NULL);20172017- MT_BUG_ON(mt, mas.index != 0x7d6);20142014+ MT_BUG_ON(mt, mas.index != last_index);20182015 MT_BUG_ON(mt, mas.last != ULONG_MAX);2019201620202017 val = mas_prev(&mas, 0);
···118118 */119119 params->explicit_connect = false;120120121121- list_del_init(¶ms->action);121121+ hci_pend_le_list_del_init(params);122122123123 switch (params->auto_connect) {124124 case HCI_AUTO_CONN_EXPLICIT:···127127 return;128128 case HCI_AUTO_CONN_DIRECT:129129 case HCI_AUTO_CONN_ALWAYS:130130- list_add(¶ms->action, &hdev->pend_le_conns);130130+ hci_pend_le_list_add(params, &hdev->pend_le_conns);131131 break;132132 case HCI_AUTO_CONN_REPORT:133133- list_add(¶ms->action, &hdev->pend_le_reports);133133+ hci_pend_le_list_add(params, &hdev->pend_le_reports);134134 break;135135 default:136136 break;···14261426 if (params->auto_connect == HCI_AUTO_CONN_DISABLED ||14271427 params->auto_connect == HCI_AUTO_CONN_REPORT ||14281428 params->auto_connect == HCI_AUTO_CONN_EXPLICIT) {14291429- list_del_init(¶ms->action);14301430- list_add(¶ms->action, &hdev->pend_le_conns);14291429+ hci_pend_le_list_del_init(params);14301430+ hci_pend_le_list_add(params, &hdev->pend_le_conns);14311431 }1432143214331433 params->explicit_connect = true;···16841684 if (!link) {16851685 hci_conn_drop(acl);16861686 hci_conn_drop(sco);16871687- return NULL;16871687+ return ERR_PTR(-ENOLINK);16881688 }1689168916901690 sco->setting = setting;···22542254 if (!link) {22552255 hci_conn_drop(le);22562256 hci_conn_drop(cis);22572257- return NULL;22572257+ return ERR_PTR(-ENOLINK);22582258 }2259225922602260 /* If LE is already connected and CIS handle is already set proceed to
+34-8
net/bluetooth/hci_core.c
···19721972 struct adv_monitor *monitor)19731973{19741974 int status = 0;19751975+ int handle;1975197619761977 switch (hci_get_adv_monitor_offload_ext(hdev)) {19771978 case HCI_ADV_MONITOR_EXT_NONE: /* also goes here when powered off */···19811980 goto free_monitor;1982198119831982 case HCI_ADV_MONITOR_EXT_MSFT:19831983+ handle = monitor->handle;19841984 status = msft_remove_monitor(hdev, monitor);19851985 bt_dev_dbg(hdev, "%s remove monitor %d msft status %d",19861986- hdev->name, monitor->handle, status);19861986+ hdev->name, handle, status);19871987 break;19881988 }19891989···22512249 return NULL;22522250}2253225122542254-/* This function requires the caller holds hdev->lock */22522252+/* This function requires the caller holds hdev->lock or rcu_read_lock */22552253struct hci_conn_params *hci_pend_le_action_lookup(struct list_head *list,22562254 bdaddr_t *addr, u8 addr_type)22572255{22582256 struct hci_conn_params *param;2259225722602260- list_for_each_entry(param, list, action) {22582258+ rcu_read_lock();22592259+22602260+ list_for_each_entry_rcu(param, list, action) {22612261 if (bacmp(¶m->addr, addr) == 0 &&22622262- param->addr_type == addr_type)22622262+ param->addr_type == addr_type) {22632263+ rcu_read_unlock();22632264 return param;22652265+ }22642266 }2265226722682268+ rcu_read_unlock();22692269+22662270 return NULL;22712271+}22722272+22732273+/* This function requires the caller holds hdev->lock */22742274+void hci_pend_le_list_del_init(struct hci_conn_params *param)22752275+{22762276+ if (list_empty(¶m->action))22772277+ return;22782278+22792279+ list_del_rcu(¶m->action);22802280+ synchronize_rcu();22812281+ INIT_LIST_HEAD(¶m->action);22822282+}22832283+22842284+/* This function requires the caller holds hdev->lock */22852285+void hci_pend_le_list_add(struct hci_conn_params *param,22862286+ struct list_head *list)22872287+{22882288+ list_add_rcu(¶m->action, list);22672289}2268229022692291/* This function requires the caller holds hdev->lock */···23232297 return params;23242298}2325229923262326-static void hci_conn_params_free(struct hci_conn_params *params)23002300+void hci_conn_params_free(struct hci_conn_params *params)23272301{23022302+ hci_pend_le_list_del_init(params);23032303+23282304 if (params->conn) {23292305 hci_conn_drop(params->conn);23302306 hci_conn_put(params->conn);23312307 }2332230823332333- list_del(¶ms->action);23342309 list_del(¶ms->list);23352310 kfree(params);23362311}···23692342 continue;23702343 }2371234423722372- list_del(¶ms->list);23732373- kfree(params);23452345+ hci_conn_params_free(params);23742346 }2375234723762348 BT_DBG("All LE disabled connection parameters were removed");
+9-6
net/bluetooth/hci_event.c
···1564156415651565 params = hci_conn_params_lookup(hdev, &cp->bdaddr, cp->bdaddr_type);15661566 if (params)15671567- params->privacy_mode = cp->mode;15671567+ WRITE_ONCE(params->privacy_mode, cp->mode);1568156815691569 hci_dev_unlock(hdev);15701570···27842784 hci_enable_advertising(hdev);27852785 }2786278627872787+ /* Inform sockets conn is gone before we delete it */27882788+ hci_disconn_cfm(conn, HCI_ERROR_UNSPECIFIED);27892789+27872790 goto done;27882791 }27892792···2807280428082805 case HCI_AUTO_CONN_DIRECT:28092806 case HCI_AUTO_CONN_ALWAYS:28102810- list_del_init(¶ms->action);28112811- list_add(¶ms->action, &hdev->pend_le_conns);28072807+ hci_pend_le_list_del_init(params);28082808+ hci_pend_le_list_add(params, &hdev->pend_le_conns);28122809 break;2813281028142811 default:···3426342334273424 case HCI_AUTO_CONN_DIRECT:34283425 case HCI_AUTO_CONN_ALWAYS:34293429- list_del_init(¶ms->action);34303430- list_add(¶ms->action, &hdev->pend_le_conns);34263426+ hci_pend_le_list_del_init(params);34273427+ hci_pend_le_list_add(params, &hdev->pend_le_conns);34313428 hci_update_passive_scan(hdev);34323429 break;34333430···59655962 params = hci_pend_le_action_lookup(&hdev->pend_le_conns, &conn->dst,59665963 conn->dst_type);59675964 if (params) {59685968- list_del_init(¶ms->action);59655965+ hci_pend_le_list_del_init(params);59695966 if (params->conn) {59705967 hci_conn_drop(params->conn);59715968 hci_conn_put(params->conn);
+108-13
net/bluetooth/hci_sync.c
···21602160 return 0;21612161}2162216221632163+struct conn_params {21642164+ bdaddr_t addr;21652165+ u8 addr_type;21662166+ hci_conn_flags_t flags;21672167+ u8 privacy_mode;21682168+};21692169+21632170/* Adds connection to resolve list if needed.21642171 * Setting params to NULL programs local hdev->irk21652172 */21662173static int hci_le_add_resolve_list_sync(struct hci_dev *hdev,21672167- struct hci_conn_params *params)21742174+ struct conn_params *params)21682175{21692176 struct hci_cp_le_add_to_resolv_list cp;21702177 struct smp_irk *irk;21712178 struct bdaddr_list_with_irk *entry;21792179+ struct hci_conn_params *p;2172218021732181 if (!use_ll_privacy(hdev))21742182 return 0;···22112203 /* Default privacy mode is always Network */22122204 params->privacy_mode = HCI_NETWORK_PRIVACY;2213220522062206+ rcu_read_lock();22072207+ p = hci_pend_le_action_lookup(&hdev->pend_le_conns,22082208+ ¶ms->addr, params->addr_type);22092209+ if (!p)22102210+ p = hci_pend_le_action_lookup(&hdev->pend_le_reports,22112211+ ¶ms->addr, params->addr_type);22122212+ if (p)22132213+ WRITE_ONCE(p->privacy_mode, HCI_NETWORK_PRIVACY);22142214+ rcu_read_unlock();22152215+22142216done:22152217 if (hci_dev_test_flag(hdev, HCI_PRIVACY))22162218 memcpy(cp.local_irk, hdev->irk, 16);···2233221522342216/* Set Device Privacy Mode. */22352217static int hci_le_set_privacy_mode_sync(struct hci_dev *hdev,22362236- struct hci_conn_params *params)22182218+ struct conn_params *params)22372219{22382220 struct hci_cp_le_set_privacy_mode cp;22392221 struct smp_irk *irk;···22582240 bacpy(&cp.bdaddr, &irk->bdaddr);22592241 cp.mode = HCI_DEVICE_PRIVACY;2260224222432243+ /* Note: params->privacy_mode is not updated since it is a copy */22442244+22612245 return __hci_cmd_sync_status(hdev, HCI_OP_LE_SET_PRIVACY_MODE,22622246 sizeof(cp), &cp, HCI_CMD_TIMEOUT);22632247}···22692249 * properly set the privacy mode.22702250 */22712251static int hci_le_add_accept_list_sync(struct hci_dev *hdev,22722272- struct hci_conn_params *params,22522252+ struct conn_params *params,22732253 u8 *num_entries)22742254{22752255 struct hci_cp_le_add_to_accept_list cp;···24672447 return __hci_cmd_sync_sk(hdev, opcode, 0, NULL, 0, HCI_CMD_TIMEOUT, sk);24682448}2469244924502450+static struct conn_params *conn_params_copy(struct list_head *list, size_t *n)24512451+{24522452+ struct hci_conn_params *params;24532453+ struct conn_params *p;24542454+ size_t i;24552455+24562456+ rcu_read_lock();24572457+24582458+ i = 0;24592459+ list_for_each_entry_rcu(params, list, action)24602460+ ++i;24612461+ *n = i;24622462+24632463+ rcu_read_unlock();24642464+24652465+ p = kvcalloc(*n, sizeof(struct conn_params), GFP_KERNEL);24662466+ if (!p)24672467+ return NULL;24682468+24692469+ rcu_read_lock();24702470+24712471+ i = 0;24722472+ list_for_each_entry_rcu(params, list, action) {24732473+ /* Racing adds are handled in next scan update */24742474+ if (i >= *n)24752475+ break;24762476+24772477+ /* No hdev->lock, but: addr, addr_type are immutable.24782478+ * privacy_mode is only written by us or in24792479+ * hci_cc_le_set_privacy_mode that we wait for.24802480+ * We should be idempotent so MGMT updating flags24812481+ * while we are processing is OK.24822482+ */24832483+ bacpy(&p[i].addr, ¶ms->addr);24842484+ p[i].addr_type = params->addr_type;24852485+ p[i].flags = READ_ONCE(params->flags);24862486+ p[i].privacy_mode = READ_ONCE(params->privacy_mode);24872487+ ++i;24882488+ }24892489+24902490+ rcu_read_unlock();24912491+24922492+ *n = i;24932493+ return p;24942494+}24952495+24702496/* Device must not be scanning when updating the accept list.24712497 *24722498 * Update is done using the following sequence:···25322466 */25332467static u8 hci_update_accept_list_sync(struct hci_dev *hdev)25342468{25352535- struct hci_conn_params *params;24692469+ struct conn_params *params;25362470 struct bdaddr_list *b, *t;25372471 u8 num_entries = 0;25382472 bool pend_conn, pend_report;25392473 u8 filter_policy;24742474+ size_t i, n;25402475 int err;2541247625422477 /* Pause advertising if resolving list can be used as controllers···25712504 if (hci_conn_hash_lookup_le(hdev, &b->bdaddr, b->bdaddr_type))25722505 continue;2573250625072507+ /* Pointers not dereferenced, no locks needed */25742508 pend_conn = hci_pend_le_action_lookup(&hdev->pend_le_conns,25752509 &b->bdaddr,25762510 b->bdaddr_type);···26002532 * available accept list entries in the controller, then26012533 * just abort and return filer policy value to not use the26022534 * accept list.25352535+ *25362536+ * The list and params may be mutated while we wait for events,25372537+ * so make a copy and iterate it.26032538 */26042604- list_for_each_entry(params, &hdev->pend_le_conns, action) {26052605- err = hci_le_add_accept_list_sync(hdev, params, &num_entries);26062606- if (err)26072607- goto done;25392539+25402540+ params = conn_params_copy(&hdev->pend_le_conns, &n);25412541+ if (!params) {25422542+ err = -ENOMEM;25432543+ goto done;26082544 }25452545+25462546+ for (i = 0; i < n; ++i) {25472547+ err = hci_le_add_accept_list_sync(hdev, ¶ms[i],25482548+ &num_entries);25492549+ if (err) {25502550+ kvfree(params);25512551+ goto done;25522552+ }25532553+ }25542554+25552555+ kvfree(params);2609255626102557 /* After adding all new pending connections, walk through26112558 * the list of pending reports and also add these to the26122559 * accept list if there is still space. Abort if space runs out.26132560 */26142614- list_for_each_entry(params, &hdev->pend_le_reports, action) {26152615- err = hci_le_add_accept_list_sync(hdev, params, &num_entries);26162616- if (err)26172617- goto done;25612561+25622562+ params = conn_params_copy(&hdev->pend_le_reports, &n);25632563+ if (!params) {25642564+ err = -ENOMEM;25652565+ goto done;26182566 }25672567+25682568+ for (i = 0; i < n; ++i) {25692569+ err = hci_le_add_accept_list_sync(hdev, ¶ms[i],25702570+ &num_entries);25712571+ if (err) {25722572+ kvfree(params);25732573+ goto done;25742574+ }25752575+ }25762576+25772577+ kvfree(params);2619257826202579 /* Use the allowlist unless the following conditions are all true:26212580 * - We are not currently suspending···49324837 struct hci_conn_params *p;4933483849344839 list_for_each_entry(p, &hdev->le_conn_params, list) {48404840+ hci_pend_le_list_del_init(p);49354841 if (p->conn) {49364842 hci_conn_drop(p->conn);49374843 hci_conn_put(p->conn);49384844 p->conn = NULL;49394845 }49404940- list_del_init(&p->action);49414846 }4942484749434848 BT_DBG("All LE pending actions cleared");
+32-23
net/bluetooth/iso.c
···123123{124124 struct iso_conn *conn = hcon->iso_data;125125126126- if (conn)126126+ if (conn) {127127+ if (!conn->hcon)128128+ conn->hcon = hcon;127129 return conn;130130+ }128131129132 conn = kzalloc(sizeof(*conn), GFP_KERNEL);130133 if (!conn)···303300 goto unlock;304301 }305302306306- hci_dev_unlock(hdev);307307- hci_dev_put(hdev);303303+ lock_sock(sk);308304309305 err = iso_chan_add(conn, sk, NULL);310310- if (err)311311- return err;312312-313313- lock_sock(sk);306306+ if (err) {307307+ release_sock(sk);308308+ goto unlock;309309+ }314310315311 /* Update source addr of the socket */316312 bacpy(&iso_pi(sk)->src, &hcon->src);···323321 }324322325323 release_sock(sk);326326- return err;327324328325unlock:329326 hci_dev_unlock(hdev);···390389 goto unlock;391390 }392391393393- hci_dev_unlock(hdev);394394- hci_dev_put(hdev);392392+ lock_sock(sk);395393396394 err = iso_chan_add(conn, sk, NULL);397397- if (err)398398- return err;399399-400400- lock_sock(sk);395395+ if (err) {396396+ release_sock(sk);397397+ goto unlock;398398+ }401399402400 /* Update source addr of the socket */403401 bacpy(&iso_pi(sk)->src, &hcon->src);···413413 }414414415415 release_sock(sk);416416- return err;417416418417unlock:419418 hci_dev_unlock(hdev);···10711072 size_t len)10721073{10731074 struct sock *sk = sock->sk;10741074- struct iso_conn *conn = iso_pi(sk)->conn;10751075 struct sk_buff *skb, **frag;10761076+ size_t mtu;10761077 int err;1077107810781079 BT_DBG("sock %p, sk %p", sock, sk);···10841085 if (msg->msg_flags & MSG_OOB)10851086 return -EOPNOTSUPP;1086108710871087- if (sk->sk_state != BT_CONNECTED)10881088- return -ENOTCONN;10881088+ lock_sock(sk);1089108910901090- skb = bt_skb_sendmsg(sk, msg, len, conn->hcon->hdev->iso_mtu,10911091- HCI_ISO_DATA_HDR_SIZE, 0);10901090+ if (sk->sk_state != BT_CONNECTED) {10911091+ release_sock(sk);10921092+ return -ENOTCONN;10931093+ }10941094+10951095+ mtu = iso_pi(sk)->conn->hcon->hdev->iso_mtu;10961096+10971097+ release_sock(sk);10981098+10991099+ skb = bt_skb_sendmsg(sk, msg, len, mtu, HCI_ISO_DATA_HDR_SIZE, 0);10921100 if (IS_ERR(skb))10931101 return PTR_ERR(skb);10941102···11081102 while (len) {11091103 struct sk_buff *tmp;1110110411111111- tmp = bt_skb_sendmsg(sk, msg, len, conn->hcon->hdev->iso_mtu,11121112- 0, 0);11051105+ tmp = bt_skb_sendmsg(sk, msg, len, mtu, 0, 0);11131106 if (IS_ERR(tmp)) {11141107 kfree_skb(skb);11151108 return PTR_ERR(tmp);···11631158 BT_DBG("sk %p", sk);1164115911651160 if (test_and_clear_bit(BT_SK_DEFER_SETUP, &bt_sk(sk)->flags)) {11611161+ lock_sock(sk);11661162 switch (sk->sk_state) {11671163 case BT_CONNECT2:11681168- lock_sock(sk);11691164 iso_conn_defer_accept(pi->conn->hcon);11701165 sk->sk_state = BT_CONFIG;11711166 release_sock(sk);11721167 return 0;11731168 case BT_CONNECT:11691169+ release_sock(sk);11741170 return iso_connect_cis(sk);11711171+ default:11721172+ release_sock(sk);11731173+ break;11751174 }11761175 }11771176
+12-16
net/bluetooth/mgmt.c
···12971297 /* Needed for AUTO_OFF case where might not "really"12981298 * have been powered off.12991299 */13001300- list_del_init(&p->action);13001300+ hci_pend_le_list_del_init(p);1301130113021302 switch (p->auto_connect) {13031303 case HCI_AUTO_CONN_DIRECT:13041304 case HCI_AUTO_CONN_ALWAYS:13051305- list_add(&p->action, &hdev->pend_le_conns);13051305+ hci_pend_le_list_add(p, &hdev->pend_le_conns);13061306 break;13071307 case HCI_AUTO_CONN_REPORT:13081308- list_add(&p->action, &hdev->pend_le_reports);13081308+ hci_pend_le_list_add(p, &hdev->pend_le_reports);13091309 break;13101310 default:13111311 break;···51695169 goto unlock;51705170 }5171517151725172- params->flags = current_flags;51725172+ WRITE_ONCE(params->flags, current_flags);51735173 status = MGMT_STATUS_SUCCESS;5174517451755175 /* Update passive scan if HCI_CONN_FLAG_DEVICE_PRIVACY···7285728572867286 bt_dev_dbg(hdev, "err %d", err);7287728772887288- memcpy(&rp.addr, &cp->addr.bdaddr, sizeof(rp.addr));72887288+ memcpy(&rp.addr, &cp->addr, sizeof(rp.addr));7289728972907290 status = mgmt_status(err);72917291 if (status == MGMT_STATUS_SUCCESS) {···75807580 if (params->auto_connect == auto_connect)75817581 return 0;7582758275837583- list_del_init(¶ms->action);75837583+ hci_pend_le_list_del_init(params);7584758475857585 switch (auto_connect) {75867586 case HCI_AUTO_CONN_DISABLED:···75897589 * connect to device, keep connecting.75907590 */75917591 if (params->explicit_connect)75927592- list_add(¶ms->action, &hdev->pend_le_conns);75927592+ hci_pend_le_list_add(params, &hdev->pend_le_conns);75937593 break;75947594 case HCI_AUTO_CONN_REPORT:75957595 if (params->explicit_connect)75967596- list_add(¶ms->action, &hdev->pend_le_conns);75967596+ hci_pend_le_list_add(params, &hdev->pend_le_conns);75977597 else75987598- list_add(¶ms->action, &hdev->pend_le_reports);75987598+ hci_pend_le_list_add(params, &hdev->pend_le_reports);75997599 break;76007600 case HCI_AUTO_CONN_DIRECT:76017601 case HCI_AUTO_CONN_ALWAYS:76027602 if (!is_connected(hdev, addr, addr_type))76037603- list_add(¶ms->action, &hdev->pend_le_conns);76037603+ hci_pend_le_list_add(params, &hdev->pend_le_conns);76047604 break;76057605 }76067606···78237823 goto unlock;78247824 }7825782578267826- list_del(¶ms->action);78277827- list_del(¶ms->list);78287828- kfree(params);78267826+ hci_conn_params_free(params);7829782778307828 device_removed(sk, hdev, &cp->addr.bdaddr, cp->addr.type);78317829 } else {···78547856 p->auto_connect = HCI_AUTO_CONN_EXPLICIT;78557857 continue;78567858 }78577857- list_del(&p->action);78587858- list_del(&p->list);78597859- kfree(p);78597859+ hci_conn_params_free(p);78607860 }7861786178627862 bt_dev_dbg(hdev, "All LE connection parameters were removed");
+12-11
net/bluetooth/sco.c
···126126 struct hci_dev *hdev = hcon->hdev;127127 struct sco_conn *conn = hcon->sco_data;128128129129- if (conn)129129+ if (conn) {130130+ if (!conn->hcon)131131+ conn->hcon = hcon;130132 return conn;133133+ }131134132135 conn = kzalloc(sizeof(struct sco_conn), GFP_KERNEL);133136 if (!conn)···271268 goto unlock;272269 }273270274274- hci_dev_unlock(hdev);275275- hci_dev_put(hdev);276276-277271 conn = sco_conn_add(hcon);278272 if (!conn) {279273 hci_conn_drop(hcon);280280- return -ENOMEM;274274+ err = -ENOMEM;275275+ goto unlock;281276 }282277283283- err = sco_chan_add(conn, sk, NULL);284284- if (err)285285- return err;286286-287278 lock_sock(sk);279279+280280+ err = sco_chan_add(conn, sk, NULL);281281+ if (err) {282282+ release_sock(sk);283283+ goto unlock;284284+ }288285289286 /* Update source addr of the socket */290287 bacpy(&sco_pi(sk)->src, &hcon->src);···298295 }299296300297 release_sock(sk);301301-302302- return err;303298304299unlock:305300 hci_dev_unlock(hdev);
···1019101910201020 icsk = inet_csk(sk_listener);10211021 net = sock_net(sk_listener);10221022- max_syn_ack_retries = icsk->icsk_syn_retries ? :10221022+ max_syn_ack_retries = READ_ONCE(icsk->icsk_syn_retries) ? :10231023 READ_ONCE(net->ipv4.sysctl_tcp_synack_retries);10241024 /* Normally all the openreqs are young and become mature10251025 * (i.e. converted to established socket) for first timeout.
+2-15
net/ipv4/inet_hashtables.c
···650650 spin_lock(lock);651651 if (osk) {652652 WARN_ON_ONCE(sk->sk_hash != osk->sk_hash);653653- ret = sk_hashed(osk);654654- if (ret) {655655- /* Before deleting the node, we insert a new one to make656656- * sure that the look-up-sk process would not miss either657657- * of them and that at least one node would exist in ehash658658- * table all the time. Otherwise there's a tiny chance659659- * that lookup process could find nothing in ehash table.660660- */661661- __sk_nulls_add_node_tail_rcu(sk, list);662662- sk_nulls_del_node_init_rcu(osk);663663- }664664- goto unlock;665665- }666666- if (found_dup_sk) {653653+ ret = sk_nulls_del_node_init_rcu(osk);654654+ } else if (found_dup_sk) {667655 *found_dup_sk = inet_ehash_lookup_by_sk(sk, list);668656 if (*found_dup_sk)669657 ret = false;···660672 if (ret)661673 __sk_nulls_add_node_rcu(sk, list);662674663663-unlock:664675 spin_unlock(lock);665676666677 return ret;
···32913291 return -EINVAL;3292329232933293 lock_sock(sk);32943294- inet_csk(sk)->icsk_syn_retries = val;32943294+ WRITE_ONCE(inet_csk(sk)->icsk_syn_retries, val);32953295 release_sock(sk);32963296 return 0;32973297}···33003300void tcp_sock_set_user_timeout(struct sock *sk, u32 val)33013301{33023302 lock_sock(sk);33033303- inet_csk(sk)->icsk_user_timeout = val;33033303+ WRITE_ONCE(inet_csk(sk)->icsk_user_timeout, val);33043304 release_sock(sk);33053305}33063306EXPORT_SYMBOL(tcp_sock_set_user_timeout);···33123312 if (val < 1 || val > MAX_TCP_KEEPIDLE)33133313 return -EINVAL;3314331433153315- tp->keepalive_time = val * HZ;33153315+ /* Paired with WRITE_ONCE() in keepalive_time_when() */33163316+ WRITE_ONCE(tp->keepalive_time, val * HZ);33163317 if (sock_flag(sk, SOCK_KEEPOPEN) &&33173318 !((1 << sk->sk_state) & (TCPF_CLOSE | TCPF_LISTEN))) {33183319 u32 elapsed = keepalive_time_elapsed(tp);···33453344 return -EINVAL;3346334533473346 lock_sock(sk);33483348- tcp_sk(sk)->keepalive_intvl = val * HZ;33473347+ WRITE_ONCE(tcp_sk(sk)->keepalive_intvl, val * HZ);33493348 release_sock(sk);33503349 return 0;33513350}···33573356 return -EINVAL;3358335733593358 lock_sock(sk);33603360- tcp_sk(sk)->keepalive_probes = val;33593359+ /* Paired with READ_ONCE() in keepalive_probes() */33603360+ WRITE_ONCE(tcp_sk(sk)->keepalive_probes, val);33613361 release_sock(sk);33623362 return 0;33633363}···35603558 if (val < 1 || val > MAX_TCP_KEEPINTVL)35613559 err = -EINVAL;35623560 else35633563- tp->keepalive_intvl = val * HZ;35613561+ WRITE_ONCE(tp->keepalive_intvl, val * HZ);35643562 break;35653563 case TCP_KEEPCNT:35663564 if (val < 1 || val > MAX_TCP_KEEPCNT)35673565 err = -EINVAL;35683566 else35693569- tp->keepalive_probes = val;35673567+ WRITE_ONCE(tp->keepalive_probes, val);35703568 break;35713569 case TCP_SYNCNT:35723570 if (val < 1 || val > MAX_TCP_SYNCNT)35733571 err = -EINVAL;35743572 else35753575- icsk->icsk_syn_retries = val;35733573+ WRITE_ONCE(icsk->icsk_syn_retries, val);35763574 break;3577357535783576 case TCP_SAVE_SYN:···3585358335863584 case TCP_LINGER2:35873585 if (val < 0)35883588- tp->linger2 = -1;35863586+ WRITE_ONCE(tp->linger2, -1);35893587 else if (val > TCP_FIN_TIMEOUT_MAX / HZ)35903590- tp->linger2 = TCP_FIN_TIMEOUT_MAX;35883588+ WRITE_ONCE(tp->linger2, TCP_FIN_TIMEOUT_MAX);35913589 else35923592- tp->linger2 = val * HZ;35903590+ WRITE_ONCE(tp->linger2, val * HZ);35933591 break;3594359235953593 case TCP_DEFER_ACCEPT:35963594 /* Translate value in seconds to number of retransmits */35973597- icsk->icsk_accept_queue.rskq_defer_accept =35983598- secs_to_retrans(val, TCP_TIMEOUT_INIT / HZ,35993599- TCP_RTO_MAX / HZ);35953595+ WRITE_ONCE(icsk->icsk_accept_queue.rskq_defer_accept,35963596+ secs_to_retrans(val, TCP_TIMEOUT_INIT / HZ,35973597+ TCP_RTO_MAX / HZ));36003598 break;3601359936023600 case TCP_WINDOW_CLAMP:···36203618 if (val < 0)36213619 err = -EINVAL;36223620 else36233623- icsk->icsk_user_timeout = val;36213621+ WRITE_ONCE(icsk->icsk_user_timeout, val);36243622 break;3625362336263624 case TCP_FASTOPEN:···36583656 if (!tp->repair)36593657 err = -EPERM;36603658 else36613661- tp->tsoffset = val - tcp_time_stamp_raw();36593659+ WRITE_ONCE(tp->tsoffset, val - tcp_time_stamp_raw());36623660 break;36633661 case TCP_REPAIR_WINDOW:36643662 err = tcp_repair_set_window(tp, optval, optlen);36653663 break;36663664 case TCP_NOTSENT_LOWAT:36673667- tp->notsent_lowat = val;36653665+ WRITE_ONCE(tp->notsent_lowat, val);36683666 sk->sk_write_space(sk);36693667 break;36703668 case TCP_INQ:···36763674 case TCP_TX_DELAY:36773675 if (val)36783676 tcp_enable_tx_delay();36793679- tp->tcp_tx_delay = val;36773677+ WRITE_ONCE(tp->tcp_tx_delay, val);36803678 break;36813679 default:36823680 err = -ENOPROTOOPT;···39933991 val = keepalive_probes(tp);39943992 break;39953993 case TCP_SYNCNT:39963996- val = icsk->icsk_syn_retries ? :39943994+ val = READ_ONCE(icsk->icsk_syn_retries) ? :39973995 READ_ONCE(net->ipv4.sysctl_tcp_syn_retries);39983996 break;39993997 case TCP_LINGER2:40004000- val = tp->linger2;39983998+ val = READ_ONCE(tp->linger2);40013999 if (val >= 0)40024000 val = (val ? : READ_ONCE(net->ipv4.sysctl_tcp_fin_timeout)) / HZ;40034001 break;40044002 case TCP_DEFER_ACCEPT:40054005- val = retrans_to_secs(icsk->icsk_accept_queue.rskq_defer_accept,40064006- TCP_TIMEOUT_INIT / HZ, TCP_RTO_MAX / HZ);40034003+ val = READ_ONCE(icsk->icsk_accept_queue.rskq_defer_accept);40044004+ val = retrans_to_secs(val, TCP_TIMEOUT_INIT / HZ,40054005+ TCP_RTO_MAX / HZ);40074006 break;40084007 case TCP_WINDOW_CLAMP:40094008 val = tp->window_clamp;···41414138 break;4142413941434140 case TCP_USER_TIMEOUT:41444144- val = icsk->icsk_user_timeout;41414141+ val = READ_ONCE(icsk->icsk_user_timeout);41454142 break;4146414341474144 case TCP_FASTOPEN:41484148- val = icsk->icsk_accept_queue.fastopenq.max_qlen;41454145+ val = READ_ONCE(icsk->icsk_accept_queue.fastopenq.max_qlen);41494146 break;4150414741514148 case TCP_FASTOPEN_CONNECT:···41574154 break;4158415541594156 case TCP_TX_DELAY:41604160- val = tp->tcp_tx_delay;41574157+ val = READ_ONCE(tp->tcp_tx_delay);41614158 break;4162415941634160 case TCP_TIMESTAMP:41644164- val = tcp_time_stamp_raw() + tp->tsoffset;41614161+ val = tcp_time_stamp_raw() + READ_ONCE(tp->tsoffset);41654162 break;41664163 case TCP_NOTSENT_LOWAT:41674167- val = tp->notsent_lowat;41644164+ val = READ_ONCE(tp->notsent_lowat);41684165 break;41694166 case TCP_INQ:41704167 val = tp->recvmsg_inq;
+4-2
net/ipv4/tcp_fastopen.c
···296296static bool tcp_fastopen_queue_check(struct sock *sk)297297{298298 struct fastopen_queue *fastopenq;299299+ int max_qlen;299300300301 /* Make sure the listener has enabled fastopen, and we don't301302 * exceed the max # of pending TFO requests allowed before trying···309308 * temporarily vs a server not supporting Fast Open at all.310309 */311310 fastopenq = &inet_csk(sk)->icsk_accept_queue.fastopenq;312312- if (fastopenq->max_qlen == 0)311311+ max_qlen = READ_ONCE(fastopenq->max_qlen);312312+ if (max_qlen == 0)313313 return false;314314315315- if (fastopenq->qlen >= fastopenq->max_qlen) {315315+ if (fastopenq->qlen >= max_qlen) {316316 struct request_sock *req1;317317 spin_lock(&fastopenq->lock);318318 req1 = fastopenq->rskq_rst_head;
···528528 newicsk->icsk_ack.lrcvtime = tcp_jiffies32;529529530530 newtp->lsndtime = tcp_jiffies32;531531- newsk->sk_txhash = treq->txhash;531531+ newsk->sk_txhash = READ_ONCE(treq->txhash);532532 newtp->total_retrans = req->num_retrans;533533534534 tcp_init_xmit_timers(newsk);···555555 newtp->max_window = newtp->snd_wnd;556556557557 if (newtp->rx_opt.tstamp_ok) {558558- newtp->rx_opt.ts_recent = req->ts_recent;558558+ newtp->rx_opt.ts_recent = READ_ONCE(req->ts_recent);559559 newtp->rx_opt.ts_recent_stamp = ktime_get_seconds();560560 newtp->tcp_header_len = sizeof(struct tcphdr) + TCPOLEN_TSTAMP_ALIGNED;561561 } else {···619619 tcp_parse_options(sock_net(sk), skb, &tmp_opt, 0, NULL);620620621621 if (tmp_opt.saw_tstamp) {622622- tmp_opt.ts_recent = req->ts_recent;622622+ tmp_opt.ts_recent = READ_ONCE(req->ts_recent);623623 if (tmp_opt.rcv_tsecr)624624 tmp_opt.rcv_tsecr -= tcp_rsk(req)->ts_off;625625 /* We do not store true stamp, but it is not required,···758758759759 /* In sequence, PAWS is OK. */760760761761+ /* TODO: We probably should defer ts_recent change once762762+ * we take ownership of @req.763763+ */761764 if (tmp_opt.saw_tstamp && !after(TCP_SKB_CB(skb)->seq, tcp_rsk(req)->rcv_nxt))762762- req->ts_recent = tmp_opt.rcv_tsval;765765+ WRITE_ONCE(req->ts_recent, tmp_opt.rcv_tsval);763766764767 if (TCP_SKB_CB(skb)->seq == tcp_rsk(req)->rcv_isn) {765768 /* Truncate SYN, it is out of window starting
+3-3
net/ipv4/tcp_output.c
···878878 if (likely(ireq->tstamp_ok)) {879879 opts->options |= OPTION_TS;880880 opts->tsval = tcp_skb_timestamp(skb) + tcp_rsk(req)->ts_off;881881- opts->tsecr = req->ts_recent;881881+ opts->tsecr = READ_ONCE(req->ts_recent);882882 remaining -= TCPOLEN_TSTAMP_ALIGNED;883883 }884884 if (likely(ireq->sack_ok)) {···36603660 rcu_read_lock();36613661 md5 = tcp_rsk(req)->af_specific->req_md5_lookup(sk, req_to_sk(req));36623662#endif36633663- skb_set_hash(skb, tcp_rsk(req)->txhash, PKT_HASH_TYPE_L4);36633663+ skb_set_hash(skb, READ_ONCE(tcp_rsk(req)->txhash), PKT_HASH_TYPE_L4);36643664 /* bpf program will be interested in the tcp_flags */36653665 TCP_SKB_CB(skb)->tcp_flags = TCPHDR_SYN | TCPHDR_ACK;36663666 tcp_header_size = tcp_synack_options(sk, req, mss, skb, &opts, md5,···4210421042114211 /* Paired with WRITE_ONCE() in sock_setsockopt() */42124212 if (READ_ONCE(sk->sk_txrehash) == SOCK_TXREHASH_ENABLED)42134213- tcp_rsk(req)->txhash = net_tx_rndhash();42134213+ WRITE_ONCE(tcp_rsk(req)->txhash, net_tx_rndhash());42144214 res = af_ops->send_synack(sk, NULL, &fl, req, NULL, TCP_SYNACK_NORMAL,42154215 NULL);42164216 if (!res) {
+11-5
net/ipv4/udp_offload.c
···274274 __sum16 check;275275 __be16 newlen;276276277277- if (skb_shinfo(gso_skb)->gso_type & SKB_GSO_FRAGLIST)278278- return __udp_gso_segment_list(gso_skb, features, is_ipv6);279279-280277 mss = skb_shinfo(gso_skb)->gso_size;281278 if (gso_skb->len <= sizeof(*uh) + mss)282279 return ERR_PTR(-EINVAL);280280+281281+ if (skb_gso_ok(gso_skb, features | NETIF_F_GSO_ROBUST)) {282282+ /* Packet is from an untrusted source, reset gso_segs. */283283+ skb_shinfo(gso_skb)->gso_segs = DIV_ROUND_UP(gso_skb->len - sizeof(*uh),284284+ mss);285285+ return NULL;286286+ }287287+288288+ if (skb_shinfo(gso_skb)->gso_type & SKB_GSO_FRAGLIST)289289+ return __udp_gso_segment_list(gso_skb, features, is_ipv6);283290284291 skb_pull(gso_skb, sizeof(*uh));285292···395388 if (!pskb_may_pull(skb, sizeof(struct udphdr)))396389 goto out;397390398398- if (skb_shinfo(skb)->gso_type & SKB_GSO_UDP_L4 &&399399- !skb_gso_ok(skb, features | NETIF_F_GSO_ROBUST))391391+ if (skb_shinfo(skb)->gso_type & SKB_GSO_UDP_L4)400392 return __udp_gso_segment(skb, features, false);401393402394 mss = skb_shinfo(skb)->gso_size;
···163163 void (*sta_handler)(struct sk_buff *skb);164164 void (*sap_handler)(struct llc_sap *sap, struct sk_buff *skb);165165166166- if (!net_eq(dev_net(dev), &init_net))167167- goto drop;168168-169166 /*170167 * When the interface is in promisc. mode, drop all the crap that it171168 * receives, do not try to analyse it.
+11-7
net/llc/llc_sap.c
···294294295295static inline bool llc_dgram_match(const struct llc_sap *sap,296296 const struct llc_addr *laddr,297297- const struct sock *sk)297297+ const struct sock *sk,298298+ const struct net *net)298299{299300 struct llc_sock *llc = llc_sk(sk);300301301302 return sk->sk_type == SOCK_DGRAM &&302302- llc->laddr.lsap == laddr->lsap &&303303- ether_addr_equal(llc->laddr.mac, laddr->mac);303303+ net_eq(sock_net(sk), net) &&304304+ llc->laddr.lsap == laddr->lsap &&305305+ ether_addr_equal(llc->laddr.mac, laddr->mac);304306}305307306308/**307309 * llc_lookup_dgram - Finds dgram socket for the local sap/mac308310 * @sap: SAP309311 * @laddr: address of local LLC (MAC + SAP)312312+ * @net: netns to look up a socket in310313 *311314 * Search socket list of the SAP and finds connection using the local312315 * mac, and local sap. Returns pointer for socket found, %NULL otherwise.313316 */314317static struct sock *llc_lookup_dgram(struct llc_sap *sap,315315- const struct llc_addr *laddr)318318+ const struct llc_addr *laddr,319319+ const struct net *net)316320{317321 struct sock *rc;318322 struct hlist_nulls_node *node;···326322 rcu_read_lock_bh();327323again:328324 sk_nulls_for_each_rcu(rc, node, laddr_hb) {329329- if (llc_dgram_match(sap, laddr, rc)) {325325+ if (llc_dgram_match(sap, laddr, rc, net)) {330326 /* Extra checks required by SLAB_TYPESAFE_BY_RCU */331327 if (unlikely(!refcount_inc_not_zero(&rc->sk_refcnt)))332328 goto again;333329 if (unlikely(llc_sk(rc)->sap != sap ||334334- !llc_dgram_match(sap, laddr, rc))) {330330+ !llc_dgram_match(sap, laddr, rc, net))) {335331 sock_put(rc);336332 continue;337333 }···433429 llc_sap_mcast(sap, &laddr, skb);434430 kfree_skb(skb);435431 } else {436436- struct sock *sk = llc_lookup_dgram(sap, &laddr);432432+ struct sock *sk = llc_lookup_dgram(sap, &laddr, dev_net(skb->dev));437433 if (sk) {438434 llc_sap_rcv(sap, skb, sk);439435 sock_put(sk);
···712712 [TCA_U32_FLAGS] = { .type = NLA_U32 },713713};714714715715+static void u32_unbind_filter(struct tcf_proto *tp, struct tc_u_knode *n,716716+ struct nlattr **tb)717717+{718718+ if (tb[TCA_U32_CLASSID])719719+ tcf_unbind_filter(tp, &n->res);720720+}721721+722722+static void u32_bind_filter(struct tcf_proto *tp, struct tc_u_knode *n,723723+ unsigned long base, struct nlattr **tb)724724+{725725+ if (tb[TCA_U32_CLASSID]) {726726+ n->res.classid = nla_get_u32(tb[TCA_U32_CLASSID]);727727+ tcf_bind_filter(tp, &n->res, base);728728+ }729729+}730730+715731static int u32_set_parms(struct net *net, struct tcf_proto *tp,716716- unsigned long base,717732 struct tc_u_knode *n, struct nlattr **tb,718733 struct nlattr *est, u32 flags, u32 fl_flags,719734 struct netlink_ext_ack *extack)···774759775760 if (ht_old)776761 ht_old->refcnt--;777777- }778778- if (tb[TCA_U32_CLASSID]) {779779- n->res.classid = nla_get_u32(tb[TCA_U32_CLASSID]);780780- tcf_bind_filter(tp, &n->res, base);781762 }782763783764 if (ifindex >= 0)···914903 if (!new)915904 return -ENOMEM;916905917917- err = u32_set_parms(net, tp, base, new, tb,918918- tca[TCA_RATE], flags, new->flags,919919- extack);906906+ err = u32_set_parms(net, tp, new, tb, tca[TCA_RATE],907907+ flags, new->flags, extack);920908921909 if (err) {922910 __u32_destroy_key(new);923911 return err;924912 }925913914914+ u32_bind_filter(tp, new, base, tb);915915+926916 err = u32_replace_hw_knode(tp, new, flags, extack);927917 if (err) {918918+ u32_unbind_filter(tp, new, tb);919919+920920+ if (tb[TCA_U32_LINK]) {921921+ struct tc_u_hnode *ht_old;922922+923923+ ht_old = rtnl_dereference(n->ht_down);924924+ if (ht_old)925925+ ht_old->refcnt++;926926+ }928927 __u32_destroy_key(new);929928 return err;930929 }···10951074 }10961075#endif1097107610981098- err = u32_set_parms(net, tp, base, n, tb, tca[TCA_RATE],10771077+ err = u32_set_parms(net, tp, n, tb, tca[TCA_RATE],10991078 flags, n->flags, extack);10791079+10801080+ u32_bind_filter(tp, n, base, tb);10811081+11001082 if (err == 0) {11011083 struct tc_u_knode __rcu **ins;11021084 struct tc_u_knode *pins;1103108511041086 err = u32_replace_hw_knode(tp, n, flags, extack);11051087 if (err)11061106- goto errhw;10881088+ goto errunbind;1107108911081090 if (!tc_in_hw(n->flags))11091091 n->flags |= TCA_CLS_FLAGS_NOT_IN_HW;···11241100 return 0;11251101 }1126110211271127-errhw:11031103+errunbind:11041104+ u32_unbind_filter(tp, n, tb);11051105+11281106#ifdef CONFIG_CLS_U32_MARK11291107 free_percpu(n->pcpu_success);11301108#endif
+4-1
scripts/Makefile.build
···264264265265rust_allowed_features := new_uninit266266267267+# `--out-dir` is required to avoid temporaries being created by `rustc` in the268268+# current working directory, which may be not accessible in the out-of-tree269269+# modules case.267270rust_common_cmd = \268271 RUST_MODFILE=$(modfile) $(RUSTC_OR_CLIPPY) $(rust_flags) \269272 -Zallow-features=$(rust_allowed_features) \···275272 --extern alloc --extern kernel \276273 --crate-type rlib -L $(objtree)/rust/ \277274 --crate-name $(basename $(notdir $@)) \278278- --emit=dep-info=$(depfile)275275+ --out-dir $(dir $@) --emit=dep-info=$(depfile)279276280277# `--emit=obj`, `--emit=asm` and `--emit=llvm-ir` imply a single codegen unit281278# will be used. We explicitly request `-Ccodegen-units=1` in any case, and
+5-1
scripts/Makefile.host
···8686hostcxx_flags = -Wp,-MMD,$(depfile) \8787 $(KBUILD_HOSTCXXFLAGS) $(HOST_EXTRACXXFLAGS) \8888 $(HOSTCXXFLAGS_$(target-stem).o)8989-hostrust_flags = --emit=dep-info=$(depfile) \8989+9090+# `--out-dir` is required to avoid temporaries being created by `rustc` in the9191+# current working directory, which may be not accessible in the out-of-tree9292+# modules case.9393+hostrust_flags = --out-dir $(dir $@) --emit=dep-info=$(depfile) \9094 $(KBUILD_HOSTRUSTFLAGS) $(HOST_EXTRARUSTFLAGS) \9195 $(HOSTRUSTFLAGS_$(target-stem))9296
+1-1
scripts/clang-tools/gen_compile_commands.py
···1919_DEFAULT_LOG_LEVEL = 'WARNING'20202121_FILENAME_PATTERN = r'^\..*\.cmd$'2222-_LINE_PATTERN = r'^savedcmd_[^ ]*\.o := (.* )([^ ]*\.c) *(;|$)'2222+_LINE_PATTERN = r'^savedcmd_[^ ]*\.o := (.* )([^ ]*\.[cS]) *(;|$)'2323_VALID_LOG_LEVELS = ['DEBUG', 'INFO', 'WARNING', 'ERROR', 'CRITICAL']2424# The tools/ directory adopts a different build system, and produces .cmd2525# files in a different format. Do not support it.
+4-7
scripts/kconfig/gconf.c
···636636{637637 GtkWidget *dialog;638638 const gchar *intro_text =639639- "Welcome to gkc, the GTK+ graphical configuration tool\n"639639+ "Welcome to gconfig, the GTK+ graphical configuration tool.\n"640640 "For each option, a blank box indicates the feature is disabled, a\n"641641 "check indicates it is enabled, and a dot indicates that it is to\n"642642 "be compiled as a module. Clicking on the box will cycle through the three states.\n"···647647 "Although there is no cross reference yet to help you figure out\n"648648 "what other options must be enabled to support the option you\n"649649 "are interested in, you can still view the help of a grayed-out\n"650650- "option.\n"651651- "\n"652652- "Toggling Show Debug Info under the Options menu will show \n"653653- "the dependencies, which you can then match by examining other options.";650650+ "option.";654651655652 dialog = gtk_message_dialog_new(GTK_WINDOW(main_wnd),656653 GTK_DIALOG_DESTROY_WITH_PARENT,···664667{665668 GtkWidget *dialog;666669 const gchar *about_text =667667- "gkc is copyright (c) 2002 Romain Lievin <roms@lpg.ticalc.org>.\n"670670+ "gconfig is copyright (c) 2002 Romain Lievin <roms@lpg.ticalc.org>.\n"668671 "Based on the source code from Roman Zippel.\n";669672670673 dialog = gtk_message_dialog_new(GTK_WINDOW(main_wnd),···682685{683686 GtkWidget *dialog;684687 const gchar *license_text =685685- "gkc is released under the terms of the GNU GPL v2.\n"688688+ "gconfig is released under the terms of the GNU GPL v2.\n"686689 "For more information, please see the source code or\n"687690 "visit http://www.fsf.org/licenses/licenses.html\n";688691
+24-11
security/keys/request_key.c
···401401 set_bit(KEY_FLAG_USER_CONSTRUCT, &key->flags);402402403403 if (dest_keyring) {404404- ret = __key_link_lock(dest_keyring, &ctx->index_key);404404+ ret = __key_link_lock(dest_keyring, &key->index_key);405405 if (ret < 0)406406 goto link_lock_failed;407407- ret = __key_link_begin(dest_keyring, &ctx->index_key, &edit);408408- if (ret < 0)409409- goto link_prealloc_failed;410407 }411408412412- /* attach the key to the destination keyring under lock, but we do need409409+ /*410410+ * Attach the key to the destination keyring under lock, but we do need413411 * to do another check just in case someone beat us to it whilst we414414- * waited for locks */412412+ * waited for locks.413413+ *414414+ * The caller might specify a comparison function which looks for keys415415+ * that do not exactly match but are still equivalent from the caller's416416+ * perspective. The __key_link_begin() operation must be done only after417417+ * an actual key is determined.418418+ */415419 mutex_lock(&key_construction_mutex);416420417421 rcu_read_lock();···424420 if (!IS_ERR(key_ref))425421 goto key_already_present;426422427427- if (dest_keyring)423423+ if (dest_keyring) {424424+ ret = __key_link_begin(dest_keyring, &key->index_key, &edit);425425+ if (ret < 0)426426+ goto link_alloc_failed;428427 __key_link(dest_keyring, key, &edit);428428+ }429429430430 mutex_unlock(&key_construction_mutex);431431 if (dest_keyring)432432- __key_link_end(dest_keyring, &ctx->index_key, edit);432432+ __key_link_end(dest_keyring, &key->index_key, edit);433433 mutex_unlock(&user->cons_lock);434434 *_key = key;435435 kleave(" = 0 [%d]", key_serial(key));···446438 mutex_unlock(&key_construction_mutex);447439 key = key_ref_to_ptr(key_ref);448440 if (dest_keyring) {441441+ ret = __key_link_begin(dest_keyring, &key->index_key, &edit);442442+ if (ret < 0)443443+ goto link_alloc_failed_unlocked;449444 ret = __key_link_check_live_key(dest_keyring, key);450445 if (ret == 0)451446 __key_link(dest_keyring, key, &edit);452452- __key_link_end(dest_keyring, &ctx->index_key, edit);447447+ __key_link_end(dest_keyring, &key->index_key, edit);453448 if (ret < 0)454449 goto link_check_failed;455450 }···467456 kleave(" = %d [linkcheck]", ret);468457 return ret;469458470470-link_prealloc_failed:471471- __key_link_end(dest_keyring, &ctx->index_key, edit);459459+link_alloc_failed:460460+ mutex_unlock(&key_construction_mutex);461461+link_alloc_failed_unlocked:462462+ __key_link_end(dest_keyring, &key->index_key, edit);472463link_lock_failed:473464 mutex_unlock(&user->cons_lock);474465 key_put(key);
+1-1
security/keys/trusted-keys/trusted_tpm2.c
···186186}187187188188/**189189- * tpm_buf_append_auth() - append TPMS_AUTH_COMMAND to the buffer.189189+ * tpm2_buf_append_auth() - append TPMS_AUTH_COMMAND to the buffer.190190 *191191 * @buf: an allocated tpm_buf instance192192 * @session_handle: session handle
+1
sound/core/seq/seq_ports.c
···149149 write_lock_irq(&client->ports_lock);150150 list_for_each_entry(p, &client->ports_list_head, list) {151151 if (p->addr.port == port) {152152+ kfree(new_port);152153 num = -EBUSY;153154 goto unlock;154155 }
···507507 savediv / 2 - 1);508508 }509509510510- if (sai->soc_data->max_register >= FSL_SAI_MCTL) {511511- /* SAI is in master mode at this point, so enable MCLK */512512- regmap_update_bits(sai->regmap, FSL_SAI_MCTL,513513- FSL_SAI_MCTL_MCLK_EN, FSL_SAI_MCTL_MCLK_EN);514514- }515515-516510 return 0;517511}518512···713719 u32 xcsr, count = 100;714720715721 regmap_update_bits(sai->regmap, FSL_SAI_xCSR(tx, ofs),716716- FSL_SAI_CSR_TERE, 0);722722+ FSL_SAI_CSR_TERE | FSL_SAI_CSR_BCE, 0);717723718724 /* TERE will remain set till the end of current frame */719725 do {
+1
sound/soc/fsl/fsl_sai.h
···9191/* SAI Transmit/Receive Control Register */9292#define FSL_SAI_CSR_TERE BIT(31)9393#define FSL_SAI_CSR_SE BIT(30)9494+#define FSL_SAI_CSR_BCE BIT(28)9495#define FSL_SAI_CSR_FR BIT(25)9596#define FSL_SAI_CSR_SR BIT(24)9697#define FSL_SAI_CSR_xF_SHIFT 16
+4-5
sound/soc/sof/ipc3-dtrace.c
···186186 struct snd_sof_dfsentry *dfse = file->private_data;187187 struct sof_ipc_trace_filter_elem *elems = NULL;188188 struct snd_sof_dev *sdev = dfse->sdev;189189- loff_t pos = 0;190189 int num_elems;191190 char *string;192191 int ret;···200201 if (!string)201202 return -ENOMEM;202203203203- /* assert null termination */204204- string[count] = 0;205205- ret = simple_write_to_buffer(string, count, &pos, from, count);206206- if (ret < 0)204204+ if (copy_from_user(string, from, count)) {205205+ ret = -EFAULT;207206 goto error;207207+ }208208+ string[count] = '\0';208209209210 ret = trace_filter_parse(sdev, string, &num_elems, &elems);210211 if (ret < 0)
···817817#define __NR_set_mempolicy_home_node 450818818__SYSCALL(__NR_set_mempolicy_home_node, sys_set_mempolicy_home_node)819819820820+#define __NR_cachestat 451821821+__SYSCALL(__NR_cachestat, sys_cachestat)822822+820823#undef __NR_syscalls821821-#define __NR_syscalls 451824824+#define __NR_syscalls 452822825823826/*824827 * 32 bit systems traditionally used different
+93-2
tools/include/uapi/drm/i915_drm.h
···280280#define I915_PMU_ENGINE_SEMA(class, instance) \281281 __I915_PMU_ENGINE(class, instance, I915_SAMPLE_SEMA)282282283283-#define __I915_PMU_OTHER(x) (__I915_PMU_ENGINE(0xff, 0xff, 0xf) + 1 + (x))283283+/*284284+ * Top 4 bits of every non-engine counter are GT id.285285+ */286286+#define __I915_PMU_GT_SHIFT (60)287287+288288+#define ___I915_PMU_OTHER(gt, x) \289289+ (((__u64)__I915_PMU_ENGINE(0xff, 0xff, 0xf) + 1 + (x)) | \290290+ ((__u64)(gt) << __I915_PMU_GT_SHIFT))291291+292292+#define __I915_PMU_OTHER(x) ___I915_PMU_OTHER(0, x)284293285294#define I915_PMU_ACTUAL_FREQUENCY __I915_PMU_OTHER(0)286295#define I915_PMU_REQUESTED_FREQUENCY __I915_PMU_OTHER(1)···298289#define I915_PMU_SOFTWARE_GT_AWAKE_TIME __I915_PMU_OTHER(4)299290300291#define I915_PMU_LAST /* Deprecated - do not use */ I915_PMU_RC6_RESIDENCY292292+293293+#define __I915_PMU_ACTUAL_FREQUENCY(gt) ___I915_PMU_OTHER(gt, 0)294294+#define __I915_PMU_REQUESTED_FREQUENCY(gt) ___I915_PMU_OTHER(gt, 1)295295+#define __I915_PMU_INTERRUPTS(gt) ___I915_PMU_OTHER(gt, 2)296296+#define __I915_PMU_RC6_RESIDENCY(gt) ___I915_PMU_OTHER(gt, 3)297297+#define __I915_PMU_SOFTWARE_GT_AWAKE_TIME(gt) ___I915_PMU_OTHER(gt, 4)301298302299/* Each region is a minimum of 16k, and there are at most 255 of them.303300 */···674659 * If the IOCTL is successful, the returned parameter will be set to one of the675660 * following values:676661 * * 0 if HuC firmware load is not complete,677677- * * 1 if HuC firmware is authenticated and running.662662+ * * 1 if HuC firmware is loaded and fully authenticated,663663+ * * 2 if HuC firmware is loaded and authenticated for clear media only678664 */679665#define I915_PARAM_HUC_STATUS 42680666···786770 * timestamp frequency, but differs on some platforms.787771 */788772#define I915_PARAM_OA_TIMESTAMP_FREQUENCY 57773773+774774+/*775775+ * Query the status of PXP support in i915.776776+ *777777+ * The query can fail in the following scenarios with the listed error codes:778778+ * -ENODEV = PXP support is not available on the GPU device or in the779779+ * kernel due to missing component drivers or kernel configs.780780+ *781781+ * If the IOCTL is successful, the returned parameter will be set to one of782782+ * the following values:783783+ * 1 = PXP feature is supported and is ready for use.784784+ * 2 = PXP feature is supported but should be ready soon (pending785785+ * initialization of non-i915 system dependencies).786786+ *787787+ * NOTE: When param is supported (positive return values), user space should788788+ * still refer to the GEM PXP context-creation UAPI header specs to be789789+ * aware of possible failure due to system state machine at the time.790790+ */791791+#define I915_PARAM_PXP_STATUS 58789792790793/* Must be kept compact -- no holes and well documented */791794···21312096 *21322097 * -ENODEV: feature not available21332098 * -EPERM: trying to mark a recoverable or not bannable context as protected20992099+ * -ENXIO: A dependency such as a component driver or firmware is not yet21002100+ * loaded so user space may need to attempt again. Depending on the21012101+ * device, this error may be reported if protected context creation is21022102+ * attempted very early after kernel start because the internal timeout21032103+ * waiting for such dependencies is not guaranteed to be larger than21042104+ * required (numbers differ depending on system and kernel config):21052105+ * - ADL/RPL: dependencies may take up to 3 seconds from kernel start21062106+ * while context creation internal timeout is 250 milisecs21072107+ * - MTL: dependencies may take up to 8 seconds from kernel start21082108+ * while context creation internal timeout is 250 milisecs21092109+ * NOTE: such dependencies happen once, so a subsequent call to create a21102110+ * protected context after a prior successful call will not experience21112111+ * such timeouts and will not return -ENXIO (unless the driver is reloaded,21122112+ * or, depending on the device, resumes from a suspended state).21132113+ * -EIO: The firmware did not succeed in creating the protected context.21342114 */21352115#define I915_CONTEXT_PARAM_PROTECTED_CONTENT 0xd21362116/* Must be kept compact -- no holes and well documented */···36803630 *36813631 * For I915_GEM_CREATE_EXT_PROTECTED_CONTENT usage see36823632 * struct drm_i915_gem_create_ext_protected_content.36333633+ *36343634+ * For I915_GEM_CREATE_EXT_SET_PAT usage see36353635+ * struct drm_i915_gem_create_ext_set_pat.36833636 */36843637#define I915_GEM_CREATE_EXT_MEMORY_REGIONS 036853638#define I915_GEM_CREATE_EXT_PROTECTED_CONTENT 136393639+#define I915_GEM_CREATE_EXT_SET_PAT 236863640 __u64 extensions;36873641};36883642···37993745 struct i915_user_extension base;38003746 /** @flags: reserved for future usage, currently MBZ */38013747 __u32 flags;37483748+};37493749+37503750+/**37513751+ * struct drm_i915_gem_create_ext_set_pat - The37523752+ * I915_GEM_CREATE_EXT_SET_PAT extension.37533753+ *37543754+ * If this extension is provided, the specified caching policy (PAT index) is37553755+ * applied to the buffer object.37563756+ *37573757+ * Below is an example on how to create an object with specific caching policy:37583758+ *37593759+ * .. code-block:: C37603760+ *37613761+ * struct drm_i915_gem_create_ext_set_pat set_pat_ext = {37623762+ * .base = { .name = I915_GEM_CREATE_EXT_SET_PAT },37633763+ * .pat_index = 0,37643764+ * };37653765+ * struct drm_i915_gem_create_ext create_ext = {37663766+ * .size = PAGE_SIZE,37673767+ * .extensions = (uintptr_t)&set_pat_ext,37683768+ * };37693769+ *37703770+ * int err = ioctl(fd, DRM_IOCTL_I915_GEM_CREATE_EXT, &create_ext);37713771+ * if (err) ...37723772+ */37733773+struct drm_i915_gem_create_ext_set_pat {37743774+ /** @base: Extension link. See struct i915_user_extension. */37753775+ struct i915_user_extension base;37763776+ /**37773777+ * @pat_index: PAT index to be set37783778+ * PAT index is a bit field in Page Table Entry to control caching37793779+ * behaviors for GPU accesses. The definition of PAT index is37803780+ * platform dependent and can be found in hardware specifications,37813781+ */37823782+ __u32 pat_index;37833783+ /** @rsvd: reserved for future use */37843784+ __u32 rsvd;38023785};3803378638043787/* ID of the protected content session managed by i915 when PXP is active */
+5
tools/include/uapi/linux/fcntl.h
···112112113113#define AT_RECURSIVE 0x8000 /* Apply to the entire subtree */114114115115+/* Flags for name_to_handle_at(2). We reuse AT_ flag space to save bits... */116116+#define AT_HANDLE_FID AT_REMOVEDIR /* file handle is needed to117117+ compare object identity and may not118118+ be usable to open_by_handle_at(2) */119119+115120#endif /* _UAPI_LINUX_FCNTL_H */
+5-1
tools/include/uapi/linux/kvm.h
···11901190#define KVM_CAP_DIRTY_LOG_RING_WITH_BITMAP 22511911191#define KVM_CAP_PMU_EVENT_MASKED_EVENTS 22611921192#define KVM_CAP_COUNTER_OFFSET 22711931193+#define KVM_CAP_ARM_EAGER_SPLIT_CHUNK_SIZE 22811941194+#define KVM_CAP_ARM_SUPPORTED_BLOCK_SIZES 2291193119511941196#ifdef KVM_CAP_IRQ_ROUTING11951197···14441442#define KVM_DEV_TYPE_XIVE KVM_DEV_TYPE_XIVE14451443 KVM_DEV_TYPE_ARM_PV_TIME,14461444#define KVM_DEV_TYPE_ARM_PV_TIME KVM_DEV_TYPE_ARM_PV_TIME14451445+ KVM_DEV_TYPE_RISCV_AIA,14461446+#define KVM_DEV_TYPE_RISCV_AIA KVM_DEV_TYPE_RISCV_AIA14471447 KVM_DEV_TYPE_MAX,14481448};14491449···16171613#define KVM_GET_DEBUGREGS _IOR(KVMIO, 0xa1, struct kvm_debugregs)16181614#define KVM_SET_DEBUGREGS _IOW(KVMIO, 0xa2, struct kvm_debugregs)16191615/*16201620- * vcpu version available with KVM_ENABLE_CAP16161616+ * vcpu version available with KVM_CAP_ENABLE_CAP16211617 * vm version available with KVM_CAP_ENABLE_CAP_VM16221618 */16231619#define KVM_ENABLE_CAP _IOW(KVMIO, 0xa3, struct kvm_enable_cap)
···4545#define VHOST_SET_LOG_BASE _IOW(VHOST_VIRTIO, 0x04, __u64)4646/* Specify an eventfd file descriptor to signal on log write. */4747#define VHOST_SET_LOG_FD _IOW(VHOST_VIRTIO, 0x07, int)4848+/* By default, a device gets one vhost_worker that its virtqueues share. This4949+ * command allows the owner of the device to create an additional vhost_worker5050+ * for the device. It can later be bound to 1 or more of its virtqueues using5151+ * the VHOST_ATTACH_VRING_WORKER command.5252+ *5353+ * This must be called after VHOST_SET_OWNER and the caller must be the owner5454+ * of the device. The new thread will inherit caller's cgroups and namespaces,5555+ * and will share the caller's memory space. The new thread will also be5656+ * counted against the caller's RLIMIT_NPROC value.5757+ *5858+ * The worker's ID used in other commands will be returned in5959+ * vhost_worker_state.6060+ */6161+#define VHOST_NEW_WORKER _IOR(VHOST_VIRTIO, 0x8, struct vhost_worker_state)6262+/* Free a worker created with VHOST_NEW_WORKER if it's not attached to any6363+ * virtqueue. If userspace is not able to call this for workers its created,6464+ * the kernel will free all the device's workers when the device is closed.6565+ */6666+#define VHOST_FREE_WORKER _IOW(VHOST_VIRTIO, 0x9, struct vhost_worker_state)48674968/* Ring setup. */5069/* Set number of descriptors in ring. This parameter can not···8970#define VHOST_VRING_BIG_ENDIAN 19071#define VHOST_SET_VRING_ENDIAN _IOW(VHOST_VIRTIO, 0x13, struct vhost_vring_state)9172#define VHOST_GET_VRING_ENDIAN _IOW(VHOST_VIRTIO, 0x14, struct vhost_vring_state)7373+/* Attach a vhost_worker created with VHOST_NEW_WORKER to one of the device's7474+ * virtqueues.7575+ *7676+ * This will replace the virtqueue's existing worker. If the replaced worker7777+ * is no longer attached to any virtqueues, it can be freed with7878+ * VHOST_FREE_WORKER.7979+ */8080+#define VHOST_ATTACH_VRING_WORKER _IOW(VHOST_VIRTIO, 0x15, \8181+ struct vhost_vring_worker)8282+/* Return the vring worker's ID */8383+#define VHOST_GET_VRING_WORKER _IOWR(VHOST_VIRTIO, 0x16, \8484+ struct vhost_vring_worker)92859386/* The following ioctls use eventfd file descriptors to signal and poll9487 * for events. */
+79-2
tools/include/uapi/sound/asound.h
···274274#define SNDRV_PCM_INFO_DOUBLE 0x00000004 /* Double buffering needed for PCM start/stop */275275#define SNDRV_PCM_INFO_BATCH 0x00000010 /* double buffering */276276#define SNDRV_PCM_INFO_SYNC_APPLPTR 0x00000020 /* need the explicit sync of appl_ptr update */277277+#define SNDRV_PCM_INFO_PERFECT_DRAIN 0x00000040 /* silencing at the end of stream is not required */277278#define SNDRV_PCM_INFO_INTERLEAVED 0x00000100 /* channels are interleaved */278279#define SNDRV_PCM_INFO_NONINTERLEAVED 0x00000200 /* channels are not interleaved */279280#define SNDRV_PCM_INFO_COMPLEX 0x00000400 /* complex frame organization (mmap only) */···384383#define SNDRV_PCM_HW_PARAMS_NORESAMPLE (1<<0) /* avoid rate resampling */385384#define SNDRV_PCM_HW_PARAMS_EXPORT_BUFFER (1<<1) /* export buffer */386385#define SNDRV_PCM_HW_PARAMS_NO_PERIOD_WAKEUP (1<<2) /* disable period wakeups */386386+#define SNDRV_PCM_HW_PARAMS_NO_DRAIN_SILENCE (1<<3) /* suppress drain with the filling387387+ * of the silence samples388388+ */387389388390struct snd_interval {389391 unsigned int min, max;···712708 * Raw MIDI section - /dev/snd/midi??713709 */714710715715-#define SNDRV_RAWMIDI_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 2)711711+#define SNDRV_RAWMIDI_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 4)716712717713enum {718714 SNDRV_RAWMIDI_STREAM_OUTPUT = 0,···723719#define SNDRV_RAWMIDI_INFO_OUTPUT 0x00000001724720#define SNDRV_RAWMIDI_INFO_INPUT 0x00000002725721#define SNDRV_RAWMIDI_INFO_DUPLEX 0x00000004722722+#define SNDRV_RAWMIDI_INFO_UMP 0x00000008726723727724struct snd_rawmidi_info {728725 unsigned int device; /* RO/WR (control): device number */···784779};785780#endif786781782782+/* UMP EP info flags */783783+#define SNDRV_UMP_EP_INFO_STATIC_BLOCKS 0x01784784+785785+/* UMP EP Protocol / JRTS capability bits */786786+#define SNDRV_UMP_EP_INFO_PROTO_MIDI_MASK 0x0300787787+#define SNDRV_UMP_EP_INFO_PROTO_MIDI1 0x0100 /* MIDI 1.0 */788788+#define SNDRV_UMP_EP_INFO_PROTO_MIDI2 0x0200 /* MIDI 2.0 */789789+#define SNDRV_UMP_EP_INFO_PROTO_JRTS_MASK 0x0003790790+#define SNDRV_UMP_EP_INFO_PROTO_JRTS_TX 0x0001 /* JRTS Transmit */791791+#define SNDRV_UMP_EP_INFO_PROTO_JRTS_RX 0x0002 /* JRTS Receive */792792+793793+/* UMP Endpoint information */794794+struct snd_ump_endpoint_info {795795+ int card; /* card number */796796+ int device; /* device number */797797+ unsigned int flags; /* additional info */798798+ unsigned int protocol_caps; /* protocol capabilities */799799+ unsigned int protocol; /* current protocol */800800+ unsigned int num_blocks; /* # of function blocks */801801+ unsigned short version; /* UMP major/minor version */802802+ unsigned short family_id; /* MIDI device family ID */803803+ unsigned short model_id; /* MIDI family model ID */804804+ unsigned int manufacturer_id; /* MIDI manufacturer ID */805805+ unsigned char sw_revision[4]; /* software revision */806806+ unsigned short padding;807807+ unsigned char name[128]; /* endpoint name string */808808+ unsigned char product_id[128]; /* unique product id string */809809+ unsigned char reserved[32];810810+} __packed;811811+812812+/* UMP direction */813813+#define SNDRV_UMP_DIR_INPUT 0x01814814+#define SNDRV_UMP_DIR_OUTPUT 0x02815815+#define SNDRV_UMP_DIR_BIDIRECTION 0x03816816+817817+/* UMP block info flags */818818+#define SNDRV_UMP_BLOCK_IS_MIDI1 (1U << 0) /* MIDI 1.0 port w/o restrict */819819+#define SNDRV_UMP_BLOCK_IS_LOWSPEED (1U << 1) /* 31.25Kbps B/W MIDI1 port */820820+821821+/* UMP block user-interface hint */822822+#define SNDRV_UMP_BLOCK_UI_HINT_UNKNOWN 0x00823823+#define SNDRV_UMP_BLOCK_UI_HINT_RECEIVER 0x01824824+#define SNDRV_UMP_BLOCK_UI_HINT_SENDER 0x02825825+#define SNDRV_UMP_BLOCK_UI_HINT_BOTH 0x03826826+827827+/* UMP groups and blocks */828828+#define SNDRV_UMP_MAX_GROUPS 16829829+#define SNDRV_UMP_MAX_BLOCKS 32830830+831831+/* UMP Block information */832832+struct snd_ump_block_info {833833+ int card; /* card number */834834+ int device; /* device number */835835+ unsigned char block_id; /* block ID (R/W) */836836+ unsigned char direction; /* UMP direction */837837+ unsigned char active; /* Activeness */838838+ unsigned char first_group; /* first group ID */839839+ unsigned char num_groups; /* number of groups */840840+ unsigned char midi_ci_version; /* MIDI-CI support version */841841+ unsigned char sysex8_streams; /* max number of sysex8 streams */842842+ unsigned char ui_hint; /* user interface hint */843843+ unsigned int flags; /* various info flags */844844+ unsigned char name[128]; /* block name string */845845+ unsigned char reserved[32];846846+} __packed;847847+787848#define SNDRV_RAWMIDI_IOCTL_PVERSION _IOR('W', 0x00, int)788849#define SNDRV_RAWMIDI_IOCTL_INFO _IOR('W', 0x01, struct snd_rawmidi_info)789850#define SNDRV_RAWMIDI_IOCTL_USER_PVERSION _IOW('W', 0x02, int)···857786#define SNDRV_RAWMIDI_IOCTL_STATUS _IOWR('W', 0x20, struct snd_rawmidi_status)858787#define SNDRV_RAWMIDI_IOCTL_DROP _IOW('W', 0x30, int)859788#define SNDRV_RAWMIDI_IOCTL_DRAIN _IOW('W', 0x31, int)789789+/* Additional ioctls for UMP rawmidi devices */790790+#define SNDRV_UMP_IOCTL_ENDPOINT_INFO _IOR('W', 0x40, struct snd_ump_endpoint_info)791791+#define SNDRV_UMP_IOCTL_BLOCK_INFO _IOR('W', 0x41, struct snd_ump_block_info)860792861793/*862794 * Timer section - /dev/snd/timer···1035961 * *1036962 ****************************************************************************/103796310381038-#define SNDRV_CTL_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 8)964964+#define SNDRV_CTL_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 9)10399651040966struct snd_ctl_card_info {1041967 int card; /* card number */···11961122#define SNDRV_CTL_IOCTL_RAWMIDI_NEXT_DEVICE _IOWR('U', 0x40, int)11971123#define SNDRV_CTL_IOCTL_RAWMIDI_INFO _IOWR('U', 0x41, struct snd_rawmidi_info)11981124#define SNDRV_CTL_IOCTL_RAWMIDI_PREFER_SUBDEVICE _IOW('U', 0x42, int)11251125+#define SNDRV_CTL_IOCTL_UMP_NEXT_DEVICE _IOWR('U', 0x43, int)11261126+#define SNDRV_CTL_IOCTL_UMP_ENDPOINT_INFO _IOWR('U', 0x44, struct snd_ump_endpoint_info)11271127+#define SNDRV_CTL_IOCTL_UMP_BLOCK_INFO _IOWR('U', 0x45, struct snd_ump_block_info)11991128#define SNDRV_CTL_IOCTL_POWER _IOWR('U', 0xd0, int)12001129#define SNDRV_CTL_IOCTL_POWER_STATE _IOR('U', 0xd1, int)12011130
+12-6
tools/lib/subcmd/help.c
···6868 while (ci < cmds->cnt && ei < excludes->cnt) {6969 cmp = strcmp(cmds->names[ci]->name, excludes->names[ei]->name);7070 if (cmp < 0) {7171- zfree(&cmds->names[cj]);7272- cmds->names[cj++] = cmds->names[ci++];7171+ if (ci == cj) {7272+ ci++;7373+ cj++;7474+ } else {7575+ zfree(&cmds->names[cj]);7676+ cmds->names[cj++] = cmds->names[ci++];7777+ }7378 } else if (cmp == 0) {7479 ci++;7580 ei++;···8277 ei++;8378 }8479 }8585-8686- while (ci < cmds->cnt) {8787- zfree(&cmds->names[cj]);8888- cmds->names[cj++] = cmds->names[ci++];8080+ if (ci != cj) {8181+ while (ci < cmds->cnt) {8282+ zfree(&cmds->names[cj]);8383+ cmds->names[cj++] = cmds->names[ci++];8484+ }8985 }9086 for (ci = cj; ci < cmds->cnt; ci++)9187 zfree(&cmds->names[ci]);
···537537448 common process_mrelease sys_process_mrelease538538449 common futex_waitv sys_futex_waitv539539450 nospu set_mempolicy_home_node sys_set_mempolicy_home_node540540+451 common cachestat sys_cachestat
+1
tools/perf/arch/s390/entry/syscalls/syscall.tbl
···453453448 common process_mrelease sys_process_mrelease sys_process_mrelease454454449 common futex_waitv sys_futex_waitv sys_futex_waitv455455450 common set_mempolicy_home_node sys_set_mempolicy_home_node sys_set_mempolicy_home_node456456+451 common cachestat sys_cachestat sys_cachestat
+1
tools/perf/arch/x86/entry/syscalls/syscall_64.tbl
···372372448 common process_mrelease sys_process_mrelease373373449 common futex_waitv sys_futex_waitv374374450 common set_mempolicy_home_node sys_set_mempolicy_home_node375375+451 common cachestat sys_cachestat375376376377#377378# Due to a historical design error, certain syscalls are numbered differently
···177177#define SCM_RIGHTS 0x01 /* rw: access rights (array of int) */178178#define SCM_CREDENTIALS 0x02 /* rw: struct ucred */179179#define SCM_SECURITY 0x03 /* rw: security label */180180+#define SCM_PIDFD 0x04 /* ro: pidfd (int) */180181181182struct ucred {182183 __u32 pid;···327326 */328327329328#define MSG_ZEROCOPY 0x4000000 /* Use user data in kernel path */329329+#define MSG_SPLICE_PAGES 0x8000000 /* Splice the pages from the iterator in sendmsg() */330330#define MSG_FASTOPEN 0x20000000 /* Send data in TCP SYN */331331#define MSG_CMSG_CLOEXEC 0x40000000 /* Set close_on_exec for file332332 descriptor received through···338336#define MSG_CMSG_COMPAT 0 /* We never have 32 bit fixups */339337#endif340338339339+/* Flags to be cleared on entry by sendmsg and sendmmsg syscalls */340340+#define MSG_INTERNAL_SENDMSG_FLAGS \341341+ (MSG_SPLICE_PAGES | MSG_SENDPAGE_NOPOLICY | MSG_SENDPAGE_DECRYPTED)341342342343/* Setsockoptions(2) level. Thanks to BSD these must match IPPROTO_xxx */343344#define SOL_IP 0
···4242 done43434444# Avoid any output on non arm64 on emit_tests4545-emit_tests: all4545+emit_tests:4646 @for DIR in $(ARM64_SUBTARGETS); do \4747 BUILD_TARGET=$(OUTPUT)/$$DIR; \4848 make OUTPUT=$$BUILD_TARGET -C $$DIR $@; \
···4343 done44444545# Avoid any output on non riscv on emit_tests4646-emit_tests: all4646+emit_tests:4747 @for DIR in $(RISCV_SUBTARGETS); do \4848 BUILD_TARGET=$(OUTPUT)/$$DIR; \4949 $(MAKE) OUTPUT=$$BUILD_TARGET -C $$DIR $@; \