···142142 name: ifindex143143 doc: |144144 ifindex of the netdev to which the pool belongs.145145- May be reported as 0 if the page pool was allocated for a netdev145145+ May not be reported if the page pool was allocated for a netdev146146 which got destroyed already (page pools may outlast their netdevs147147 because they wait for all memory to be returned).148148 type: u32···601601 name: page-pool-get602602 doc: |603603 Get / dump information about Page Pools.604604- (Only Page Pools associated with a net_device can be listed.)604604+ Only Page Pools associated by the driver with a net_device605605+ can be listed. ifindex will not be reported if the net_device606606+ no longer exists.605607 attribute-set: page-pool606608 do:607609 request:
···139139 stack_adjust = round_up(stack_adjust, 16);140140 stack_adjust += bpf_stack_adjust;141141142142+ move_reg(ctx, LOONGARCH_GPR_T0, LOONGARCH_GPR_RA);142143 /* Reserve space for the move_imm + jirl instruction */143144 for (i = 0; i < LOONGARCH_LONG_JUMP_NINSNS; i++)144145 emit_insn(ctx, nop);···239238 * Call the next bpf prog and skip the first instruction240239 * of TCC initialization.241240 */242242- emit_insn(ctx, jirl, LOONGARCH_GPR_ZERO, LOONGARCH_GPR_T3, 6);241241+ emit_insn(ctx, jirl, LOONGARCH_GPR_ZERO, LOONGARCH_GPR_T3, 7);243242 }244243}245244···281280 * goto out;282281 */283282 tc_ninsn = insn ? ctx->offset[insn+1] - ctx->offset[insn] : ctx->offset[0];283283+ emit_zext_32(ctx, a2, true);284284+284285 off = offsetof(struct bpf_array, map.max_entries);285286 emit_insn(ctx, ldwu, t1, a1, off);286287 /* bgeu $a2, $t1, jmp_offset */···953950 emit_insn(ctx, ldd, REG_TCC, LOONGARCH_GPR_SP, tcc_ptr_off);954951 }955952953953+ if (insn->src_reg == BPF_PSEUDO_KFUNC_CALL) {954954+ const struct btf_func_model *m;955955+ int i;956956+957957+ m = bpf_jit_find_kfunc_model(ctx->prog, insn);958958+ if (!m)959959+ return -EINVAL;960960+961961+ for (i = 0; i < m->nr_args; i++) {962962+ u8 reg = regmap[BPF_REG_1 + i];963963+ bool sign = m->arg_flags[i] & BTF_FMODEL_SIGNED_ARG;964964+965965+ emit_abi_ext(ctx, reg, m->arg_size[i], sign);966966+ }967967+ }968968+956969 move_addr(ctx, t1, func_addr);957970 emit_insn(ctx, jirl, LOONGARCH_GPR_RA, t1, 0);958971···12841265 return 0;12851266 }1286126712871287- return emit_jump_and_link(&ctx, is_call ? LOONGARCH_GPR_T0 : LOONGARCH_GPR_ZERO, (u64)target);12681268+ return emit_jump_and_link(&ctx, is_call ? LOONGARCH_GPR_RA : LOONGARCH_GPR_ZERO, (u64)target);12881269}1289127012901271static int emit_call(struct jit_ctx *ctx, u64 addr)···13091290{13101291 int ret;13111292 bool is_call;12931293+ unsigned long size = 0;12941294+ unsigned long offset = 0;12951295+ void *image = NULL;12961296+ char namebuf[KSYM_NAME_LEN];13121297 u32 old_insns[LOONGARCH_LONG_JUMP_NINSNS] = {[0 ... 4] = INSN_NOP};13131298 u32 new_insns[LOONGARCH_LONG_JUMP_NINSNS] = {[0 ... 4] = INSN_NOP};1314129913151300 /* Only poking bpf text is supported. Since kernel function entry13161301 * is set up by ftrace, we rely on ftrace to poke kernel functions.13171302 */13181318- if (!is_bpf_text_address((unsigned long)ip))13031303+ if (!__bpf_address_lookup((unsigned long)ip, &size, &offset, namebuf))13191304 return -ENOTSUPP;13051305+13061306+ image = ip - offset;13071307+13081308+ /* zero offset means we're poking bpf prog entry */13091309+ if (offset == 0) {13101310+ /* skip to the nop instruction in bpf prog entry:13111311+ * move t0, ra13121312+ * nop13131313+ */13141314+ ip = image + LOONGARCH_INSN_SIZE;13151315+ }1320131613211317 is_call = old_t == BPF_MOD_CALL;13221318 ret = emit_jump_or_nops(old_addr, ip, old_insns, is_call);···1656162216571623 /* To traced function */16581624 /* Ftrace jump skips 2 NOP instructions */16591659- if (is_kernel_text((unsigned long)orig_call))16251625+ if (is_kernel_text((unsigned long)orig_call) ||16261626+ is_module_text_address((unsigned long)orig_call))16601627 orig_call += LOONGARCH_FENTRY_NBYTES;16611628 /* Direct jump skips 5 NOP instructions */16621629 else if (is_bpf_text_address((unsigned long)orig_call))16631630 orig_call += LOONGARCH_BPF_FENTRY_NBYTES;16641664- /* Module tracing not supported - cause kernel lockups */16651665- else if (is_module_text_address((unsigned long)orig_call))16661666- return -ENOTSUPP;1667163116681632 if (flags & BPF_TRAMP_F_CALL_ORIG) {16691633 move_addr(ctx, LOONGARCH_GPR_A0, (const u64)im);···17541722 emit_insn(ctx, ldd, LOONGARCH_GPR_FP, LOONGARCH_GPR_SP, 0);17551723 emit_insn(ctx, addid, LOONGARCH_GPR_SP, LOONGARCH_GPR_SP, 16);1756172417571757- if (flags & BPF_TRAMP_F_SKIP_FRAME)17251725+ if (flags & BPF_TRAMP_F_SKIP_FRAME) {17581726 /* return to parent function */17591759- emit_insn(ctx, jirl, LOONGARCH_GPR_ZERO, LOONGARCH_GPR_RA, 0);17601760- else17611761- /* return to traced function */17271727+ move_reg(ctx, LOONGARCH_GPR_RA, LOONGARCH_GPR_T0);17621728 emit_insn(ctx, jirl, LOONGARCH_GPR_ZERO, LOONGARCH_GPR_T0, 0);17291729+ } else {17301730+ /* return to traced function */17311731+ move_reg(ctx, LOONGARCH_GPR_T1, LOONGARCH_GPR_RA);17321732+ move_reg(ctx, LOONGARCH_GPR_RA, LOONGARCH_GPR_T0);17331733+ emit_insn(ctx, jirl, LOONGARCH_GPR_ZERO, LOONGARCH_GPR_T1, 0);17341734+ }17631735 }1764173617651737 ret = ctx->idx;
+26
arch/loongarch/net/bpf_jit.h
···8888 emit_insn(ctx, addiw, reg, reg, 0);8989}90909191+/* Emit proper extension according to ABI requirements.9292+ * Note that it requires a value of size `size` already resides in register `reg`.9393+ */9494+static inline void emit_abi_ext(struct jit_ctx *ctx, int reg, u8 size, bool sign)9595+{9696+ /* ABI requires unsigned char/short to be zero-extended */9797+ if (!sign && (size == 1 || size == 2))9898+ return;9999+100100+ switch (size) {101101+ case 1:102102+ emit_insn(ctx, extwb, reg, reg);103103+ break;104104+ case 2:105105+ emit_insn(ctx, extwh, reg, reg);106106+ break;107107+ case 4:108108+ emit_insn(ctx, addiw, reg, reg, 0);109109+ break;110110+ case 8:111111+ break;112112+ default:113113+ pr_warn("bpf_jit: invalid size %d for extension\n", size);114114+ }115115+}116116+91117static inline void move_addr(struct jit_ctx *ctx, enum loongarch_gpr rd, u64 addr)92118{93119 u64 imm_11_0, imm_31_12, imm_51_32, imm_63_52;
+1-1
arch/x86/kernel/cpu/microcode/amd.c
···258258 if (fam == 0x1a) {259259 if (model <= 0x2f ||260260 (0x40 <= model && model <= 0x4f) ||261261- (0x60 <= model && model <= 0x6f))261261+ (0x60 <= model && model <= 0x7f))262262 return true;263263 }264264
···984984 * unused for the root group. Used to know whether there985985 * are groups with more than one active @bfq_entity986986 * (see the comments to the function987987- * bfq_bfqq_may_idle()).987987+ * bfq_better_to_idle()).988988 * @rq_pos_tree: rbtree sorted by next_request position, used when989989 * determining if two or more queues have interleaving990990 * requests (see bfq_find_close_cooperator()).
+1-1
block/blk-mq.c
···37213721 struct blk_mq_hw_ctx, cpuhp_online);37223722 int ret = 0;3723372337243724- if (blk_mq_hctx_has_online_cpu(hctx, cpu))37243724+ if (!hctx->nr_ctx || blk_mq_hctx_has_online_cpu(hctx, cpu))37253725 return 0;3726372637273727 /*
···951951 vma = eb_lookup_vma(eb, eb->exec[i].handle);952952 if (IS_ERR(vma)) {953953 err = PTR_ERR(vma);954954- goto err;954954+ return err;955955 }956956957957 err = eb_validate_vma(eb, &eb->exec[i], vma);958958 if (unlikely(err)) {959959 i915_vma_put(vma);960960- goto err;960960+ return err;961961 }962962963963 err = eb_add_vma(eb, ¤t_batch, i, vma);···966966967967 if (i915_gem_object_is_userptr(vma->obj)) {968968 err = i915_gem_object_userptr_submit_init(vma->obj);969969- if (err) {970970- if (i + 1 < eb->buffer_count) {971971- /*972972- * Execbuffer code expects last vma entry to be NULL,973973- * since we already initialized this entry,974974- * set the next value to NULL or we mess up975975- * cleanup handling.976976- */977977- eb->vma[i + 1].vma = NULL;978978- }979979-969969+ if (err)980970 return err;981981- }982971983972 eb->vma[i].flags |= __EXEC_OBJECT_USERPTR_INIT;984973 eb->args->flags |= __EXEC_USERPTR_USED;···975986 }976987977988 return 0;978978-979979-err:980980- eb->vma[i].vma = NULL;981981- return err;982989}983990984991static int eb_lock_vmas(struct i915_execbuffer *eb)···3360337533613376 eb.exec = exec;33623377 eb.vma = (struct eb_vma *)(exec + args->buffer_count + 1);33633363- eb.vma[0].vma = NULL;33783378+ memset(eb.vma, 0, (args->buffer_count + 1) * sizeof(struct eb_vma));33793379+33643380 eb.batch_pool = NULL;3365338133663382 eb.invalid_flags = __EXEC_OBJECT_UNKNOWN_FLAGS;···35703584 if (err)35713585 return err;3572358635733573- /* Allocate extra slots for use by the command parser */35873587+ /*35883588+ * Allocate extra slots for use by the command parser.35893589+ *35903590+ * Note that this allocation handles two different arrays (the35913591+ * exec2_list array, and the eventual eb.vma array introduced in35923592+ * i915_gem_do_execbuffer()), that reside in virtually contiguous35933593+ * memory. Also note that the allocation intentionally doesn't fill the35943594+ * area with zeros, because the exec2_list part doesn't need to be, as35953595+ * it's immediately overwritten by user data a few lines below.35963596+ * However, the eb.vma part is explicitly zeroed later in35973597+ * i915_gem_do_execbuffer().35983598+ */35743599 exec2_list = kvmalloc_array(count + 2, eb_element_size(),35753600 __GFP_NOWARN | GFP_KERNEL);35763601 if (exec2_list == NULL) {
···286286 * In addition to report data device will supply data length287287 * in the first 2 bytes of the response, so adjust .288288 */289289+ recv_len = min(recv_len, ihid->bufsize - sizeof(__le16));289290 error = i2c_hid_xfer(ihid, ihid->cmdbuf, length,290291 ihid->rawbuf, recv_len + sizeof(__le16));291292 if (error) {
···77config INTEL_THC_HID88 tristate "Intel Touch Host Controller"99 depends on ACPI1010+ select SGL_ALLOC1011 help1112 THC (Touch Host Controller) is the name of the IP block in PCH that1213 interfaces with Touch Devices (ex: touchscreen, touchpad etc.). It
···15931593 if (!max_rx_size)15941594 return -EOPNOTSUPP;1595159515961596- ret = regmap_read(dev->thc_regmap, THC_M_PRT_SW_SEQ_STS_OFFSET, &val);15961596+ ret = regmap_read(dev->thc_regmap, THC_M_PRT_SPI_ICRRD_OPCODE_OFFSET, &val);15971597 if (ret)15981598 return ret;15991599···16621662 if (!delay_us)16631663 return -EOPNOTSUPP;1664166416651665- ret = regmap_read(dev->thc_regmap, THC_M_PRT_SW_SEQ_STS_OFFSET, &val);16651665+ ret = regmap_read(dev->thc_regmap, THC_M_PRT_SPI_ICRRD_OPCODE_OFFSET, &val);16661666 if (ret)16671667 return ret;16681668
···9191 * @dir: Direction of DMA for this config9292 * @prd_tbls: PRD tables for current DMA9393 * @sgls: Array of pointers to scatter-gather lists9494+ * @sgls_nent_pages: Number of pages per scatter-gather list9495 * @sgls_nent: Actual number of entries per scatter-gather list9596 * @prd_tbl_num: Actual number of PRD tables9697 * @max_packet_size: Size of the buffer needed for 1 DMA message (1 PRD table)···108107109108 struct thc_prd_table *prd_tbls;110109 struct scatterlist *sgls[PRD_TABLES_NUM];110110+ u8 sgls_nent_pages[PRD_TABLES_NUM];111111 u8 sgls_nent[PRD_TABLES_NUM];112112 u8 prd_tbl_num;113113
+16-1
drivers/hid/usbhid/hid-core.c
···985985 struct usb_device *dev = interface_to_usbdev (intf);986986 struct hid_descriptor *hdesc;987987 struct hid_class_descriptor *hcdesc;988988+ __u8 fixed_opt_descriptors_size;988989 u32 quirks = 0;989990 unsigned int rsize = 0;990991 char *rdesc;···10161015 (hdesc->bNumDescriptors - 1) * sizeof(*hcdesc)) {10171016 dbg_hid("hid descriptor invalid, bLen=%hhu bNum=%hhu\n",10181017 hdesc->bLength, hdesc->bNumDescriptors);10191019- return -EINVAL;10181018+10191019+ /*10201020+ * Some devices may expose a wrong number of descriptors compared10211021+ * to the provided length.10221022+ * However, we ignore the optional hid class descriptors entirely10231023+ * so we can safely recompute the proper field.10241024+ */10251025+ if (hdesc->bLength >= sizeof(*hdesc)) {10261026+ fixed_opt_descriptors_size = hdesc->bLength - sizeof(*hdesc);10271027+10281028+ hid_warn(intf, "fixing wrong optional hid class descriptors count\n");10291029+ hdesc->bNumDescriptors = fixed_opt_descriptors_size / sizeof(*hcdesc) + 1;10301030+ } else {10311031+ return -EINVAL;10321032+ }10201033 }1021103410221035 hid->version = le16_to_cpu(hdesc->bcdHID);
+10-23
drivers/infiniband/core/addr.c
···8080 .min = sizeof(struct rdma_nla_ls_gid)},8181};82828383-static inline bool ib_nl_is_good_ip_resp(const struct nlmsghdr *nlh)8383+static void ib_nl_process_ip_rsep(const struct nlmsghdr *nlh)8484{8585 struct nlattr *tb[LS_NLA_TYPE_MAX] = {};8686+ union ib_gid gid;8787+ struct addr_req *req;8888+ int found = 0;8689 int ret;87908891 if (nlh->nlmsg_flags & RDMA_NL_LS_F_ERR)8989- return false;9292+ return;90939194 ret = nla_parse_deprecated(tb, LS_NLA_TYPE_MAX - 1, nlmsg_data(nlh),9295 nlmsg_len(nlh), ib_nl_addr_policy, NULL);9396 if (ret)9494- return false;9797+ return;95989696- return true;9797-}9898-9999-static void ib_nl_process_good_ip_rsep(const struct nlmsghdr *nlh)100100-{101101- const struct nlattr *head, *curr;102102- union ib_gid gid;103103- struct addr_req *req;104104- int len, rem;105105- int found = 0;106106-107107- head = (const struct nlattr *)nlmsg_data(nlh);108108- len = nlmsg_len(nlh);109109-110110- nla_for_each_attr(curr, head, len, rem) {111111- if (curr->nla_type == LS_NLA_TYPE_DGID)112112- memcpy(&gid, nla_data(curr), nla_len(curr));113113- }9999+ if (!tb[LS_NLA_TYPE_DGID])100100+ return;101101+ memcpy(&gid, nla_data(tb[LS_NLA_TYPE_DGID]), sizeof(gid));114102115103 spin_lock_bh(&lock);116104 list_for_each_entry(req, &req_list, list) {···125137 !(NETLINK_CB(skb).sk))126138 return -EPERM;127139128128- if (ib_nl_is_good_ip_resp(nlh))129129- ib_nl_process_good_ip_rsep(nlh);140140+ ib_nl_process_ip_rsep(nlh);130141131142 return 0;132143}
···6464 break;6565 default:6666 WARN_ON_ONCE(1);6767+ return;6768 }6969+ /*7070+ * sock_lock_init_class_and_name() calls7171+ * sk_owner_set(sk, THIS_MODULE); in order7272+ * to make sure the referenced global7373+ * variables rxe_recv_slock_key and7474+ * rxe_recv_sk_key are not removed7575+ * before the socket is closed.7676+ *7777+ * However this prevents rxe_net_exit()7878+ * from being called and 'rmmod rdma_rxe'7979+ * is refused because of the references.8080+ *8181+ * For the global sockets in recv_sockets,8282+ * we are sure that rxe_net_exit() will call8383+ * rxe_release_udp_tunnel -> udp_tunnel_sock_release.8484+ *8585+ * So we don't need the additional reference to8686+ * our own (THIS_MODULE).8787+ */8888+ sk_owner_put(sk);8989+ /*9090+ * We also call sk_owner_clear() otherwise9191+ * sk_owner_put(sk) in sk_prot_free will9292+ * fail, which is called via9393+ * sk_free -> __sk_free -> sk_destruct9494+ * and sk_destruct calls __sk_destruct9595+ * directly or via call_rcu()9696+ * so sk_prot_free() might be called9797+ * after rxe_net_exit().9898+ */9999+ sk_owner_clear(sk);68100#endif /* CONFIG_DEBUG_LOCK_ALLOC */69101}70102
+3-1
drivers/infiniband/sw/rxe/rxe_odp.c
···179179 return err;180180181181 need_fault = rxe_check_pagefault(umem_odp, iova, length);182182- if (need_fault)182182+ if (need_fault) {183183+ mutex_unlock(&umem_odp->umem_mutex);183184 return -EFAULT;185185+ }184186 }185187186188 return 0;
···150150151151/**152152 * enum rtrs_msg_flags - RTRS message flags.153153- * @RTRS_NEED_INVAL: Send invalidation in response.153153+ * @RTRS_MSG_NEED_INVAL_F: Send invalidation in response.154154 * @RTRS_MSG_NEW_RKEY_F: Send refreshed rkey in response.155155 */156156enum rtrs_msg_flags {···179179 * @recon_cnt: Reconnections counter180180 * @sess_uuid: UUID of a session (path)181181 * @paths_uuid: UUID of a group of sessions (paths)182182- *182182+ * @first_conn: %1 if the connection request is the first for that session,183183+ * otherwise %0183184 * NOTE: max size 56 bytes, see man rdma_connect().184185 */185186struct rtrs_msg_conn_req {186186- /* Is set to 0 by cma.c in case of AF_IB, do not touch that.187187- * see https://www.spinics.net/lists/linux-rdma/msg22397.html187187+ /**188188+ * @__cma_version: Is set to 0 by cma.c in case of AF_IB, do not touch189189+ * that. See https://www.spinics.net/lists/linux-rdma/msg22397.html188190 */189191 u8 __cma_version;190190- /* On sender side that should be set to 0, or cma_save_ip_info()191191- * extract garbage and will fail.192192+ /**193193+ * @__ip_version: On sender side that should be set to 0, or194194+ * cma_save_ip_info() extract garbage and will fail.192195 */193196 u8 __ip_version;194197 __le16 magic;···202199 uuid_t sess_uuid;203200 uuid_t paths_uuid;204201 u8 first_conn : 1;202202+ /* private: */205203 u8 reserved_bits : 7;206204 u8 reserved[11];207205};···215211 * @queue_depth: max inflight messages (queue-depth) in this session216212 * @max_io_size: max io size server supports217213 * @max_hdr_size: max msg header size server supports214214+ * @flags: RTRS message flags for this message218215 *219216 * NOTE: size is 56 bytes, max possible is 136 bytes, see man rdma_accept().220217 */···227222 __le32 max_io_size;228223 __le32 max_hdr_size;229224 __le32 flags;225225+ /* private: */230226 u8 reserved[36];231227};232228233229/**234234- * struct rtrs_msg_info_req230230+ * struct rtrs_msg_info_req - client additional info request235231 * @type: @RTRS_MSG_INFO_REQ236232 * @pathname: Path name chosen by client237233 */238234struct rtrs_msg_info_req {239235 __le16 type;240236 u8 pathname[NAME_MAX];237237+ /* private: */241238 u8 reserved[15];242239};243240244241/**245245- * struct rtrs_msg_info_rsp242242+ * struct rtrs_msg_info_rsp - server additional info response246243 * @type: @RTRS_MSG_INFO_RSP247244 * @sg_cnt: Number of @desc entries248245 * @desc: RDMA buffers where the client can write to server···252245struct rtrs_msg_info_rsp {253246 __le16 type;254247 __le16 sg_cnt;248248+ /* private: */255249 u8 reserved[4];250250+ /* public: */256251 struct rtrs_sg_desc desc[];257252};258253259254/**260260- * struct rtrs_msg_rkey_rsp255255+ * struct rtrs_msg_rkey_rsp - server refreshed rkey response261256 * @type: @RTRS_MSG_RKEY_RSP262257 * @buf_id: RDMA buf_id of the new rkey263258 * @rkey: new remote key for RDMA buffers id from server···273264/**274265 * struct rtrs_msg_rdma_read - RDMA data transfer request from client275266 * @type: always @RTRS_MSG_READ267267+ * @flags: RTRS message flags (enum rtrs_msg_flags)276268 * @usr_len: length of user payload277269 * @sg_cnt: number of @desc entries278270 * @desc: RDMA buffers where the server can write the result to···287277};288278289279/**290290- * struct_msg_rdma_write - Message transferred to server with RDMA-Write280280+ * struct rtrs_msg_rdma_write - Message transferred to server with RDMA-Write291281 * @type: always @RTRS_MSG_WRITE292282 * @usr_len: length of user payload293283 */···297287};298288299289/**300300- * struct_msg_rdma_hdr - header for read or write request290290+ * struct rtrs_msg_rdma_hdr - header for read or write request301291 * @type: @RTRS_MSG_WRITE | @RTRS_MSG_READ302292 */303293struct rtrs_msg_rdma_hdr {
+15-9
drivers/infiniband/ulp/rtrs/rtrs.h
···24242525/**2626 * enum rtrs_clt_link_ev - Events about connectivity state of a client2727- * @RTRS_CLT_LINK_EV_RECONNECTED Client was reconnected.2828- * @RTRS_CLT_LINK_EV_DISCONNECTED Client was disconnected.2727+ * @RTRS_CLT_LINK_EV_RECONNECTED: Client was reconnected.2828+ * @RTRS_CLT_LINK_EV_DISCONNECTED: Client was disconnected.2929 */3030enum rtrs_clt_link_ev {3131 RTRS_CLT_LINK_EV_RECONNECTED,···3333};34343535/**3636- * Source and destination address of a path to be established3636+ * struct rtrs_addr - Source and destination address of a path to be established3737+ * @src: source address3838+ * @dst: destination address3739 */3840struct rtrs_addr {3941 struct sockaddr_storage *src;···4341};44424543/**4646- * rtrs_clt_ops - it holds the link event callback and private pointer.4444+ * struct rtrs_clt_ops - it holds the link event callback and private pointer.4745 * @priv: User supplied private data.4846 * @link_ev: Event notification callback function for connection state changes4947 * @priv: User supplied data that was passed to rtrs_clt_open()···6967};70687169/**7272- * enum rtrs_clt_con_type() type of ib connection to use with a given7070+ * enum rtrs_clt_con_type - type of ib connection to use with a given7371 * rtrs_permit7474- * @ADMIN_CON - use connection reserved for "service" messages7575- * @IO_CON - use a connection reserved for IO7272+ * @RTRS_ADMIN_CON: use connection reserved for "service" messages7373+ * @RTRS_IO_CON: use a connection reserved for IO7674 */7775enum rtrs_clt_con_type {7876 RTRS_ADMIN_CON,···8785 struct rtrs_permit *permit);88868987/**9090- * rtrs_clt_req_ops - it holds the request confirmation callback8888+ * struct rtrs_clt_req_ops - it holds the request confirmation callback9189 * and a private pointer.9290 * @priv: User supplied private data.9391 * @conf_fn: callback function to be called as confirmation···107105int rtrs_clt_rdma_cq_direct(struct rtrs_clt_sess *clt, unsigned int index);108106109107/**110110- * rtrs_attrs - RTRS session attributes108108+ * struct rtrs_attrs - RTRS session attributes109109+ * @queue_depth: queue_depth saved from rtrs_clt_sess message110110+ * @max_io_size: max_io_size from rtrs_clt_sess message, capped to111111+ * @max_segments * %SZ_4K112112+ * @max_segments: max_segments saved from rtrs_clt_sess message111113 */112114struct rtrs_attrs {113115 u32 queue_depth;
+50-11
drivers/md/md.c
···19991999 mddev->layout = le32_to_cpu(sb->layout);20002000 mddev->raid_disks = le32_to_cpu(sb->raid_disks);20012001 mddev->dev_sectors = le64_to_cpu(sb->size);20022002- mddev->logical_block_size = le32_to_cpu(sb->logical_block_size);20032002 mddev->events = ev1;20042003 mddev->bitmap_info.offset = 0;20052004 mddev->bitmap_info.space = 0;···20132014 memcpy(mddev->uuid, sb->set_uuid, 16);2014201520152016 mddev->max_disks = (4096-256)/2;20172017+20182018+ if (!mddev->logical_block_size)20192019+ mddev->logical_block_size = le32_to_cpu(sb->logical_block_size);2016202020172021 if ((le32_to_cpu(sb->feature_map) & MD_FEATURE_BITMAP_OFFSET) &&20182022 mddev->bitmap_info.file == NULL) {···3884388238853883static int analyze_sbs(struct mddev *mddev)38863884{38873887- int i;38883885 struct md_rdev *rdev, *freshest, *tmp;3889388638903887 freshest = NULL;···39103909 super_types[mddev->major_version].39113910 validate_super(mddev, NULL/*freshest*/, freshest);3912391139133913- i = 0;39143912 rdev_for_each_safe(rdev, tmp, mddev) {39153913 if (mddev->max_disks &&39163916- (rdev->desc_nr >= mddev->max_disks ||39173917- i > mddev->max_disks)) {39143914+ rdev->desc_nr >= mddev->max_disks) {39183915 pr_warn("md: %s: %pg: only %d devices permitted\n",39193916 mdname(mddev), rdev->bdev,39203917 mddev->max_disks);···44064407 if (err < 0)44074408 return err;4408440944094409- err = mddev_lock(mddev);44104410+ err = mddev_suspend_and_lock(mddev);44104411 if (err)44114412 return err;44124413 if (mddev->pers)···44314432 } else44324433 mddev->raid_disks = n;44334434out_unlock:44344434- mddev_unlock(mddev);44354435+ mddev_unlock_and_resume(mddev);44354436 return err ? err : len;44364437}44374438static struct md_sysfs_entry md_raid_disks =···59805981 if (mddev->major_version == 0)59815982 return -EINVAL;5982598359835983- if (mddev->pers)59845984- return -EBUSY;59855985-59865984 err = kstrtouint(buf, 10, &lbs);59875985 if (err < 0)59885986 return -EINVAL;59875987+59885988+ if (mddev->pers) {59895989+ unsigned int curr_lbs;59905990+59915991+ if (mddev->logical_block_size)59925992+ return -EBUSY;59935993+ /*59945994+ * To fix forward compatibility issues, LBS is not59955995+ * configured for arrays from old kernels (<=6.18) by default.59965996+ * If the user confirms no rollback to old kernels,59975997+ * enable LBS by writing current LBS — to prevent data59985998+ * loss from LBS changes.59995999+ */60006000+ curr_lbs = queue_logical_block_size(mddev->gendisk->queue);60016001+ if (lbs != curr_lbs)60026002+ return -EINVAL;60036003+60046004+ mddev->logical_block_size = curr_lbs;60056005+ set_bit(MD_SB_CHANGE_DEVS, &mddev->sb_flags);60066006+ pr_info("%s: logical block size configured successfully, array will not be assembled in old kernels (<= 6.18)\n",60076007+ mdname(mddev));60086008+ return len;60096009+ }5989601059906011 err = mddev_lock(mddev);59916012 if (err)···61826163 mdname(mddev));61836164 return -EINVAL;61846165 }61856185- mddev->logical_block_size = lim->logical_block_size;61666166+61676167+ /* Only 1.x meta needs to set logical block size */61686168+ if (mddev->major_version == 0)61696169+ return 0;61706170+61716171+ /*61726172+ * Fix forward compatibility issue. Only set LBS by default for61736173+ * new arrays, mddev->events == 0 indicates the array was just61746174+ * created. When assembling an array, read LBS from the superblock61756175+ * instead — LBS is 0 in superblocks created by old kernels.61766176+ */61776177+ if (!mddev->events) {61786178+ pr_info("%s: array will not be assembled in old kernels that lack configurable LBS support (<= 6.18)\n",61796179+ mdname(mddev));61806180+ mddev->logical_block_size = lim->logical_block_size;61816181+ }61826182+61836183+ if (!mddev->logical_block_size)61846184+ pr_warn("%s: echo current LBS to md/logical_block_size to prevent data loss issues from LBS changes.\n"61856185+ "\tNote: After setting, array will not be assembled in old kernels (<= 6.18)\n",61866186+ mdname(mddev));6186618761876188 return 0;61886189}
+6-4
drivers/md/raid5.c
···71877187 err = mddev_suspend_and_lock(mddev);71887188 if (err)71897189 return err;71907190+ conf = mddev->private;71917191+ if (!conf) {71927192+ mddev_unlock_and_resume(mddev);71937193+ return -ENODEV;71947194+ }71907195 raid5_quiesce(mddev, true);7191719671927192- conf = mddev->private;71937193- if (!conf)71947194- err = -ENODEV;71957195- else if (new != conf->worker_cnt_per_group) {71977197+ if (new != conf->worker_cnt_per_group) {71967198 old_groups = conf->worker_groups;71977199 if (old_groups)71987200 flush_workqueue(raid5_wq);
-23
drivers/net/dsa/mv88e6xxx/chip.c
···3364336433653365static int mv88e6xxx_setup_port(struct mv88e6xxx_chip *chip, int port)33663366{33673367- struct device_node *phy_handle = NULL;33683367 struct fwnode_handle *ports_fwnode;33693368 struct fwnode_handle *port_fwnode;33703369 struct dsa_switch *ds = chip->ds;33713370 struct mv88e6xxx_port *p;33723372- struct dsa_port *dp;33733373- int tx_amp;33743371 int err;33753372 u16 reg;33763373 u32 val;···35773580 err = chip->info->ops->port_setup_message_port(chip, port);35783581 if (err)35793582 return err;35803580- }35813581-35823582- if (chip->info->ops->serdes_set_tx_amplitude) {35833583- dp = dsa_to_port(ds, port);35843584- if (dp)35853585- phy_handle = of_parse_phandle(dp->dn, "phy-handle", 0);35863586-35873587- if (phy_handle && !of_property_read_u32(phy_handle,35883588- "tx-p2p-microvolt",35893589- &tx_amp))35903590- err = chip->info->ops->serdes_set_tx_amplitude(chip,35913591- port, tx_amp);35923592- if (phy_handle) {35933593- of_node_put(phy_handle);35943594- if (err)35953595- return err;35963596- }35973583 }3598358435993585 /* Port based VLAN map: give each port the same default address···47484768 .serdes_irq_mapping = mv88e6352_serdes_irq_mapping,47494769 .serdes_get_regs_len = mv88e6352_serdes_get_regs_len,47504770 .serdes_get_regs = mv88e6352_serdes_get_regs,47514751- .serdes_set_tx_amplitude = mv88e6352_serdes_set_tx_amplitude,47524771 .gpio_ops = &mv88e6352_gpio_ops,47534772 .phylink_get_caps = mv88e6352_phylink_get_caps,47544773 .pcs_ops = &mv88e6352_pcs_ops,···50235044 .serdes_irq_mapping = mv88e6352_serdes_irq_mapping,50245045 .serdes_get_regs_len = mv88e6352_serdes_get_regs_len,50255046 .serdes_get_regs = mv88e6352_serdes_get_regs,50265026- .serdes_set_tx_amplitude = mv88e6352_serdes_set_tx_amplitude,50275047 .gpio_ops = &mv88e6352_gpio_ops,50285048 .avb_ops = &mv88e6352_avb_ops,50295049 .ptp_ops = &mv88e6352_ptp_ops,···54595481 .serdes_get_stats = mv88e6352_serdes_get_stats,54605482 .serdes_get_regs_len = mv88e6352_serdes_get_regs_len,54615483 .serdes_get_regs = mv88e6352_serdes_get_regs,54625462- .serdes_set_tx_amplitude = mv88e6352_serdes_set_tx_amplitude,54635484 .phylink_get_caps = mv88e6352_phylink_get_caps,54645485 .pcs_ops = &mv88e6352_pcs_ops,54655486};
-4
drivers/net/dsa/mv88e6xxx/chip.h
···642642 void (*serdes_get_regs)(struct mv88e6xxx_chip *chip, int port,643643 void *_p);644644645645- /* SERDES SGMII/Fiber Output Amplitude */646646- int (*serdes_set_tx_amplitude)(struct mv88e6xxx_chip *chip, int port,647647- int val);648648-649645 /* Address Translation Unit operations */650646 int (*atu_get_hash)(struct mv88e6xxx_chip *chip, u8 *hash);651647 int (*atu_set_hash)(struct mv88e6xxx_chip *chip, u8 hash);
-46
drivers/net/dsa/mv88e6xxx/serdes.c
···2525 reg, val);2626}27272828-static int mv88e6352_serdes_write(struct mv88e6xxx_chip *chip, int reg,2929- u16 val)3030-{3131- return mv88e6xxx_phy_page_write(chip, MV88E6352_ADDR_SERDES,3232- MV88E6352_SERDES_PAGE_FIBER,3333- reg, val);3434-}3535-3628static int mv88e6390_serdes_read(struct mv88e6xxx_chip *chip,3729 int lane, int device, int reg, u16 *val)3830{···497505 if (!err)498506 p[i] = reg;499507 }500500-}501501-502502-static const int mv88e6352_serdes_p2p_to_reg[] = {503503- /* Index of value in microvolts corresponds to the register value */504504- 14000, 112000, 210000, 308000, 406000, 504000, 602000, 700000,505505-};506506-507507-int mv88e6352_serdes_set_tx_amplitude(struct mv88e6xxx_chip *chip, int port,508508- int val)509509-{510510- bool found = false;511511- u16 ctrl, reg;512512- int err;513513- int i;514514-515515- err = mv88e6352_g2_scratch_port_has_serdes(chip, port);516516- if (err <= 0)517517- return err;518518-519519- for (i = 0; i < ARRAY_SIZE(mv88e6352_serdes_p2p_to_reg); ++i) {520520- if (mv88e6352_serdes_p2p_to_reg[i] == val) {521521- reg = i;522522- found = true;523523- break;524524- }525525- }526526-527527- if (!found)528528- return -EINVAL;529529-530530- err = mv88e6352_serdes_read(chip, MV88E6352_SERDES_SPEC_CTRL2, &ctrl);531531- if (err)532532- return err;533533-534534- ctrl &= ~MV88E6352_SERDES_OUT_AMP_MASK;535535- ctrl |= reg;536536-537537- return mv88e6352_serdes_write(chip, MV88E6352_SERDES_SPEC_CTRL2, ctrl);538508}
-5
drivers/net/dsa/mv88e6xxx/serdes.h
···2929#define MV88E6352_SERDES_INT_FIBRE_ENERGY BIT(4)3030#define MV88E6352_SERDES_INT_STATUS 0x1331313232-#define MV88E6352_SERDES_SPEC_CTRL2 0x1a3333-#define MV88E6352_SERDES_OUT_AMP_MASK 0x000734323533#define MV88E6341_PORT5_LANE 0x153634···137139void mv88e6352_serdes_get_regs(struct mv88e6xxx_chip *chip, int port, void *_p);138140int mv88e6390_serdes_get_regs_len(struct mv88e6xxx_chip *chip, int port);139141void mv88e6390_serdes_get_regs(struct mv88e6xxx_chip *chip, int port, void *_p);140140-141141-int mv88e6352_serdes_set_tx_amplitude(struct mv88e6xxx_chip *chip, int port,142142- int val);143142144143/* Return the (first) SERDES lane address a port is using, -errno otherwise. */145144static inline int mv88e6xxx_serdes_get_lane(struct mv88e6xxx_chip *chip,
···259259 depends on PCI260260 select NET_DEVLINK261261 select PAGE_POOL262262+ select AUXILIARY_BUS262263 help263264 This driver supports Broadcom ThorUltra 50/100/200/400/800 gigabit264265 Ethernet cards. The module will be called bng_en. To compile this
···284284285285struct idpf_fsteer_fltr {286286 struct list_head list;287287- u32 loc;288288- u32 q_index;287287+ struct ethtool_rx_flow_spec fs;289288};290289291290/**···423424 * @rss_key: RSS hash key424425 * @rss_lut_size: Size of RSS lookup table425426 * @rss_lut: RSS lookup table426426- * @cached_lut: Used to restore previously init RSS lut427427 */428428struct idpf_rss_data {429429 u16 rss_key_size;430430 u8 *rss_key;431431 u16 rss_lut_size;432432 u32 *rss_lut;433433- u32 *cached_lut;434433};435434436435/**···555558 * @max_q: Maximum possible queues556559 * @req_qs_chunks: Queue chunk data for requested queues557560 * @mac_filter_list_lock: Lock to protect mac filters561561+ * @flow_steer_list_lock: Lock to protect fsteer filters558562 * @flags: See enum idpf_vport_config_flags559563 */560564struct idpf_vport_config {···563565 struct idpf_vport_max_q max_q;564566 struct virtchnl2_add_queues *req_qs_chunks;565567 spinlock_t mac_filter_list_lock;568568+ spinlock_t flow_steer_list_lock;566569 DECLARE_BITMAP(flags, IDPF_VPORT_CONFIG_FLAGS_NBITS);567570};568571
+63-29
drivers/net/ethernet/intel/idpf/idpf_ethtool.c
···3737{3838 struct idpf_netdev_priv *np = netdev_priv(netdev);3939 struct idpf_vport_user_config_data *user_config;4040+ struct idpf_vport_config *vport_config;4041 struct idpf_fsteer_fltr *f;4142 struct idpf_vport *vport;4243 unsigned int cnt = 0;···45444645 idpf_vport_ctrl_lock(netdev);4746 vport = idpf_netdev_to_vport(netdev);4848- user_config = &np->adapter->vport_config[np->vport_idx]->user_config;4747+ vport_config = np->adapter->vport_config[np->vport_idx];4848+ user_config = &vport_config->user_config;49495050 switch (cmd->cmd) {5151 case ETHTOOL_GRXCLSRLCNT:···5452 cmd->data = idpf_fsteer_max_rules(vport);5553 break;5654 case ETHTOOL_GRXCLSRULE:5757- err = -EINVAL;5555+ err = -ENOENT;5656+ spin_lock_bh(&vport_config->flow_steer_list_lock);5857 list_for_each_entry(f, &user_config->flow_steer_list, list)5959- if (f->loc == cmd->fs.location) {6060- cmd->fs.ring_cookie = f->q_index;5858+ if (f->fs.location == cmd->fs.location) {5959+ /* Avoid infoleak from padding: zero first,6060+ * then assign fields6161+ */6262+ memset(&cmd->fs, 0, sizeof(cmd->fs));6363+ cmd->fs = f->fs;6164 err = 0;6265 break;6366 }6767+ spin_unlock_bh(&vport_config->flow_steer_list_lock);6468 break;6569 case ETHTOOL_GRXCLSRLALL:6670 cmd->data = idpf_fsteer_max_rules(vport);7171+ spin_lock_bh(&vport_config->flow_steer_list_lock);6772 list_for_each_entry(f, &user_config->flow_steer_list, list) {6873 if (cnt == cmd->rule_cnt) {6974 err = -EMSGSIZE;7075 break;7176 }7272- rule_locs[cnt] = f->loc;7777+ rule_locs[cnt] = f->fs.location;7378 cnt++;7479 }7580 if (!err)7681 cmd->rule_cnt = user_config->num_fsteer_fltrs;8282+ spin_unlock_bh(&vport_config->flow_steer_list_lock);7783 break;7884 default:7985 break;···178168 struct idpf_vport *vport;179169 u32 flow_type, q_index;180170 u16 num_rxq;181181- int err;171171+ int err = 0;182172183173 vport = idpf_netdev_to_vport(netdev);184174 vport_config = vport->adapter->vport_config[np->vport_idx];···203193 rule = kzalloc(struct_size(rule, rule_info, 1), GFP_KERNEL);204194 if (!rule)205195 return -ENOMEM;196196+197197+ fltr = kzalloc(sizeof(*fltr), GFP_KERNEL);198198+ if (!fltr) {199199+ err = -ENOMEM;200200+ goto out_free_rule;201201+ }202202+203203+ /* detect duplicate entry and reject before adding rules */204204+ spin_lock_bh(&vport_config->flow_steer_list_lock);205205+ list_for_each_entry(f, &user_config->flow_steer_list, list) {206206+ if (f->fs.location == fsp->location) {207207+ err = -EEXIST;208208+ break;209209+ }210210+211211+ if (f->fs.location > fsp->location)212212+ break;213213+ parent = f;214214+ }215215+ spin_unlock_bh(&vport_config->flow_steer_list_lock);216216+217217+ if (err)218218+ goto out;206219207220 rule->vport_id = cpu_to_le32(vport->vport_id);208221 rule->count = cpu_to_le32(1);···265232 goto out;266233 }267234268268- fltr = kzalloc(sizeof(*fltr), GFP_KERNEL);269269- if (!fltr) {270270- err = -ENOMEM;271271- goto out;272272- }235235+ /* Save a copy of the user's flow spec so ethtool can later retrieve it */236236+ fltr->fs = *fsp;273237274274- fltr->loc = fsp->location;275275- fltr->q_index = q_index;276276- list_for_each_entry(f, &user_config->flow_steer_list, list) {277277- if (f->loc >= fltr->loc)278278- break;279279- parent = f;280280- }281281-238238+ spin_lock_bh(&vport_config->flow_steer_list_lock);282239 parent ? list_add(&fltr->list, &parent->list) :283240 list_add(&fltr->list, &user_config->flow_steer_list);284241285242 user_config->num_fsteer_fltrs++;243243+ spin_unlock_bh(&vport_config->flow_steer_list_lock);244244+ goto out_free_rule;286245287246out:247247+ kfree(fltr);248248+out_free_rule:288249 kfree(rule);289250 return err;290251}···329302 goto out;330303 }331304305305+ spin_lock_bh(&vport_config->flow_steer_list_lock);332306 list_for_each_entry_safe(f, iter,333307 &user_config->flow_steer_list, list) {334334- if (f->loc == fsp->location) {308308+ if (f->fs.location == fsp->location) {335309 list_del(&f->list);336310 kfree(f);337311 user_config->num_fsteer_fltrs--;338338- goto out;312312+ goto out_unlock;339313 }340314 }341341- err = -EINVAL;315315+ err = -ENOENT;342316317317+out_unlock:318318+ spin_unlock_bh(&vport_config->flow_steer_list_lock);343319out:344320 kfree(rule);345321 return err;···411381 * @netdev: network interface device structure412382 * @rxfh: pointer to param struct (indir, key, hfunc)413383 *414414- * Reads the indirection table directly from the hardware. Always returns 0.384384+ * RSS LUT and Key information are read from driver's cached385385+ * copy. When rxhash is off, rss lut will be displayed as zeros.386386+ *387387+ * Return: 0 on success, -errno otherwise.415388 */416389static int idpf_get_rxfh(struct net_device *netdev,417390 struct ethtool_rxfh_param *rxfh)···422389 struct idpf_netdev_priv *np = netdev_priv(netdev);423390 struct idpf_rss_data *rss_data;424391 struct idpf_adapter *adapter;392392+ struct idpf_vport *vport;393393+ bool rxhash_ena;425394 int err = 0;426395 u16 i;427396428397 idpf_vport_ctrl_lock(netdev);398398+ vport = idpf_netdev_to_vport(netdev);429399430400 adapter = np->adapter;431401···438402 }439403440404 rss_data = &adapter->vport_config[np->vport_idx]->user_config.rss_data;441441- if (!test_bit(IDPF_VPORT_UP, np->state))442442- goto unlock_mutex;443405406406+ rxhash_ena = idpf_is_feature_ena(vport, NETIF_F_RXHASH);444407 rxfh->hfunc = ETH_RSS_HASH_TOP;445408446409 if (rxfh->key)···447412448413 if (rxfh->indir) {449414 for (i = 0; i < rss_data->rss_lut_size; i++)450450- rxfh->indir[i] = rss_data->rss_lut[i];415415+ rxfh->indir[i] = rxhash_ena ? rss_data->rss_lut[i] : 0;451416 }452417453418unlock_mutex:···487452 }488453489454 rss_data = &adapter->vport_config[vport->idx]->user_config.rss_data;490490- if (!test_bit(IDPF_VPORT_UP, np->state))491491- goto unlock_mutex;492455493456 if (rxfh->hfunc != ETH_RSS_HASH_NO_CHANGE &&494457 rxfh->hfunc != ETH_RSS_HASH_TOP) {···502469 rss_data->rss_lut[lut] = rxfh->indir[lut];503470 }504471505505- err = idpf_config_rss(vport);472472+ if (test_bit(IDPF_VPORT_UP, np->state))473473+ err = idpf_config_rss(vport);506474507475unlock_mutex:508476 idpf_vport_ctrl_unlock(netdev);
+1-1
drivers/net/ethernet/intel/idpf/idpf_idc.c
···322322 for (i = 0; i < adapter->num_alloc_vports; i++) {323323 struct idpf_vport *vport = adapter->vports[i];324324325325- if (!vport)325325+ if (!vport || !vport->vdev_info)326326 continue;327327328328 idpf_unplug_aux_dev(vport->vdev_info->adev);
+154-120
drivers/net/ethernet/intel/idpf/idpf_lib.c
···443443}444444445445/**446446+ * idpf_del_all_flow_steer_filters - Delete all flow steer filters in list447447+ * @vport: main vport struct448448+ *449449+ * Takes flow_steer_list_lock spinlock. Deletes all filters450450+ */451451+static void idpf_del_all_flow_steer_filters(struct idpf_vport *vport)452452+{453453+ struct idpf_vport_config *vport_config;454454+ struct idpf_fsteer_fltr *f, *ftmp;455455+456456+ vport_config = vport->adapter->vport_config[vport->idx];457457+458458+ spin_lock_bh(&vport_config->flow_steer_list_lock);459459+ list_for_each_entry_safe(f, ftmp, &vport_config->user_config.flow_steer_list,460460+ list) {461461+ list_del(&f->list);462462+ kfree(f);463463+ }464464+ vport_config->user_config.num_fsteer_fltrs = 0;465465+ spin_unlock_bh(&vport_config->flow_steer_list_lock);466466+}467467+468468+/**446469 * idpf_find_mac_filter - Search filter list for specific mac filter447470 * @vconfig: Vport config structure448471 * @macaddr: The MAC address···752729 return 0;753730}754731732732+static void idpf_detach_and_close(struct idpf_adapter *adapter)733733+{734734+ int max_vports = adapter->max_vports;735735+736736+ for (int i = 0; i < max_vports; i++) {737737+ struct net_device *netdev = adapter->netdevs[i];738738+739739+ /* If the interface is in detached state, that means the740740+ * previous reset was not handled successfully for this741741+ * vport.742742+ */743743+ if (!netif_device_present(netdev))744744+ continue;745745+746746+ /* Hold RTNL to protect racing with callbacks */747747+ rtnl_lock();748748+ netif_device_detach(netdev);749749+ if (netif_running(netdev)) {750750+ set_bit(IDPF_VPORT_UP_REQUESTED,751751+ adapter->vport_config[i]->flags);752752+ dev_close(netdev);753753+ }754754+ rtnl_unlock();755755+ }756756+}757757+758758+static void idpf_attach_and_open(struct idpf_adapter *adapter)759759+{760760+ int max_vports = adapter->max_vports;761761+762762+ for (int i = 0; i < max_vports; i++) {763763+ struct idpf_vport *vport = adapter->vports[i];764764+ struct idpf_vport_config *vport_config;765765+ struct net_device *netdev;766766+767767+ /* In case of a critical error in the init task, the vport768768+ * will be freed. Only continue to restore the netdevs769769+ * if the vport is allocated.770770+ */771771+ if (!vport)772772+ continue;773773+774774+ /* No need for RTNL on attach as this function is called775775+ * following detach and dev_close(). We do take RTNL for776776+ * dev_open() below as it can race with external callbacks777777+ * following the call to netif_device_attach().778778+ */779779+ netdev = adapter->netdevs[i];780780+ netif_device_attach(netdev);781781+ vport_config = adapter->vport_config[vport->idx];782782+ if (test_and_clear_bit(IDPF_VPORT_UP_REQUESTED,783783+ vport_config->flags)) {784784+ rtnl_lock();785785+ dev_open(netdev, NULL);786786+ rtnl_unlock();787787+ }788788+ }789789+}790790+755791/**756792 * idpf_cfg_netdev - Allocate, configure and register a netdev757793 * @vport: main vport structure···1073991 u16 idx = vport->idx;10749921075993 vport_config = adapter->vport_config[vport->idx];10761076- idpf_deinit_rss(vport);994994+ idpf_deinit_rss_lut(vport);1077995 rss_data = &vport_config->user_config.rss_data;1078996 kfree(rss_data->rss_key);1079997 rss_data->rss_key = NULL;···11051023 kfree(adapter->vport_config[idx]->req_qs_chunks);11061024 adapter->vport_config[idx]->req_qs_chunks = NULL;11071025 }10261026+ kfree(vport->rx_ptype_lkup);10271027+ vport->rx_ptype_lkup = NULL;11081028 kfree(vport);11091029 adapter->num_alloc_vports--;11101030}···11251041 idpf_idc_deinit_vport_aux_device(vport->vdev_info);1126104211271043 idpf_deinit_mac_addr(vport);11281128- idpf_vport_stop(vport, true);1129104411301130- if (!test_bit(IDPF_HR_RESET_IN_PROG, adapter->flags))10451045+ if (!test_bit(IDPF_HR_RESET_IN_PROG, adapter->flags)) {10461046+ idpf_vport_stop(vport, true);11311047 idpf_decfg_netdev(vport);11321132- if (test_bit(IDPF_REMOVE_IN_PROG, adapter->flags))10481048+ }10491049+ if (test_bit(IDPF_REMOVE_IN_PROG, adapter->flags)) {11331050 idpf_del_all_mac_filters(vport);10511051+ idpf_del_all_flow_steer_filters(vport);10521052+ }1134105311351054 if (adapter->netdevs[i]) {11361055 struct idpf_netdev_priv *np = netdev_priv(adapter->netdevs[i]);···12261139 u16 idx = adapter->next_vport;12271140 struct idpf_vport *vport;12281141 u16 num_max_q;11421142+ int err;1229114312301144 if (idx == IDPF_NO_FREE_SLOT)12311145 return NULL;···1277118912781190 idpf_vport_init(vport, max_q);1279119112801280- /* This alloc is done separate from the LUT because it's not strictly12811281- * dependent on how many queues we have. If we change number of queues12821282- * and soft reset we'll need a new LUT but the key can remain the same12831283- * for as long as the vport exists.11921192+ /* LUT and key are both initialized here. Key is not strictly dependent11931193+ * on how many queues we have. If we change number of queues and soft11941194+ * reset is initiated, LUT will be freed and a new LUT will be allocated11951195+ * as per the updated number of queues during vport bringup. However,11961196+ * the key remains the same for as long as the vport exists.12841197 */12851198 rss_data = &adapter->vport_config[idx]->user_config.rss_data;12861199 rss_data->rss_key = kzalloc(rss_data->rss_key_size, GFP_KERNEL);···1290120112911202 /* Initialize default rss key */12921203 netdev_rss_key_fill((void *)rss_data->rss_key, rss_data->rss_key_size);12041204+12051205+ /* Initialize default rss LUT */12061206+ err = idpf_init_rss_lut(vport);12071207+ if (err)12081208+ goto free_rss_key;1293120912941210 /* fill vport slot in the adapter struct */12951211 adapter->vports[idx] = vport;···1306121213071213 return vport;1308121412151215+free_rss_key:12161216+ kfree(rss_data->rss_key);13091217free_vector_idxs:13101218 kfree(vport->q_vector_idxs);13111219free_vport:···14841388{14851389 struct idpf_netdev_priv *np = netdev_priv(vport->netdev);14861390 struct idpf_adapter *adapter = vport->adapter;14871487- struct idpf_vport_config *vport_config;14881391 int err;1489139214901393 if (test_bit(IDPF_VPORT_UP, np->state))···15241429 if (err) {15251430 dev_err(&adapter->pdev->dev, "Failed to initialize queue registers for vport %u: %d\n",15261431 vport->vport_id, err);15271527- goto queues_rel;14321432+ goto intr_deinit;15281433 }1529143415301435 err = idpf_rx_bufs_init_all(vport);15311436 if (err) {15321437 dev_err(&adapter->pdev->dev, "Failed to initialize RX buffers for vport %u: %d\n",15331438 vport->vport_id, err);15341534- goto queues_rel;14391439+ goto intr_deinit;15351440 }1536144115371442 idpf_rx_init_buf_tail(vport);···1577148215781483 idpf_restore_features(vport);1579148415801580- vport_config = adapter->vport_config[vport->idx];15811581- if (vport_config->user_config.rss_data.rss_lut)15821582- err = idpf_config_rss(vport);15831583- else15841584- err = idpf_init_rss(vport);14851485+ err = idpf_config_rss(vport);15851486 if (err) {15861586- dev_err(&adapter->pdev->dev, "Failed to initialize RSS for vport %u: %d\n",14871487+ dev_err(&adapter->pdev->dev, "Failed to configure RSS for vport %u: %d\n",15871488 vport->vport_id, err);15881489 goto disable_vport;15891490 }···15881497 if (err) {15891498 dev_err(&adapter->pdev->dev, "Failed to complete interface up for vport %u: %d\n",15901499 vport->vport_id, err);15911591- goto deinit_rss;15001500+ goto disable_vport;15921501 }1593150215941503 if (rtnl)···1596150515971506 return 0;1598150715991599-deinit_rss:16001600- idpf_deinit_rss(vport);16011508disable_vport:16021509 idpf_send_disable_vport_msg(vport);16031510disable_queues:···16331544 struct idpf_vport_config *vport_config;16341545 struct idpf_vport_max_q max_q;16351546 struct idpf_adapter *adapter;16361636- struct idpf_netdev_priv *np;16371547 struct idpf_vport *vport;16381548 u16 num_default_vports;16391549 struct pci_dev *pdev;···16671579 goto unwind_vports;16681580 }1669158115821582+ err = idpf_send_get_rx_ptype_msg(vport);15831583+ if (err)15841584+ goto unwind_vports;15851585+16701586 index = vport->idx;16711587 vport_config = adapter->vport_config[index];1672158816731589 spin_lock_init(&vport_config->mac_filter_list_lock);15901590+ spin_lock_init(&vport_config->flow_steer_list_lock);1674159116751592 INIT_LIST_HEAD(&vport_config->user_config.mac_filter_list);16761593 INIT_LIST_HEAD(&vport_config->user_config.flow_steer_list);···16831590 err = idpf_check_supported_desc_ids(vport);16841591 if (err) {16851592 dev_err(&pdev->dev, "failed to get required descriptor ids\n");16861686- goto cfg_netdev_err;15931593+ goto unwind_vports;16871594 }1688159516891596 if (idpf_cfg_netdev(vport))16901690- goto cfg_netdev_err;16911691-16921692- err = idpf_send_get_rx_ptype_msg(vport);16931693- if (err)16941694- goto handle_err;16951695-16961696- /* Once state is put into DOWN, driver is ready for dev_open */16971697- np = netdev_priv(vport->netdev);16981698- clear_bit(IDPF_VPORT_UP, np->state);16991699- if (test_and_clear_bit(IDPF_VPORT_UP_REQUESTED, vport_config->flags))17001700- idpf_vport_open(vport, true);15971597+ goto unwind_vports;1701159817021599 /* Spawn and return 'idpf_init_task' work queue until all the17031600 * default vports are created···17181635 set_bit(IDPF_VPORT_REG_NETDEV, vport_config->flags);17191636 }1720163717211721- /* As all the required vports are created, clear the reset flag17221722- * unconditionally here in case we were in reset and the link was down.17231723- */16381638+ /* Clear the reset and load bits as all vports are created */17241639 clear_bit(IDPF_HR_RESET_IN_PROG, adapter->flags);16401640+ clear_bit(IDPF_HR_DRV_LOAD, adapter->flags);17251641 /* Start the statistics task now */17261642 queue_delayed_work(adapter->stats_wq, &adapter->stats_task,17271643 msecs_to_jiffies(10 * (pdev->devfn & 0x07)));1728164417291645 return;1730164617311731-handle_err:17321732- idpf_decfg_netdev(vport);17331733-cfg_netdev_err:17341734- idpf_vport_rel(vport);17351735- adapter->vports[index] = NULL;17361647unwind_vports:17371648 if (default_vport) {17381649 for (index = 0; index < adapter->max_vports; index++) {···17341657 idpf_vport_dealloc(adapter->vports[index]);17351658 }17361659 }16601660+ /* Cleanup after vc_core_init, which has no way of knowing the16611661+ * init task failed on driver load.16621662+ */16631663+ if (test_and_clear_bit(IDPF_HR_DRV_LOAD, adapter->flags)) {16641664+ cancel_delayed_work_sync(&adapter->serv_task);16651665+ cancel_delayed_work_sync(&adapter->mbx_task);16661666+ }16671667+ idpf_ptp_release(adapter);16681668+17371669 clear_bit(IDPF_HR_RESET_IN_PROG, adapter->flags);17381670}17391671···18731787}1874178818751789/**18761876- * idpf_set_vport_state - Set the vport state to be after the reset18771877- * @adapter: Driver specific private structure18781878- */18791879-static void idpf_set_vport_state(struct idpf_adapter *adapter)18801880-{18811881- u16 i;18821882-18831883- for (i = 0; i < adapter->max_vports; i++) {18841884- struct idpf_netdev_priv *np;18851885-18861886- if (!adapter->netdevs[i])18871887- continue;18881888-18891889- np = netdev_priv(adapter->netdevs[i]);18901890- if (test_bit(IDPF_VPORT_UP, np->state))18911891- set_bit(IDPF_VPORT_UP_REQUESTED,18921892- adapter->vport_config[i]->flags);18931893- }18941894-}18951895-18961896-/**18971790 * idpf_init_hard_reset - Initiate a hardware reset18981791 * @adapter: Driver specific private structure18991792 *···18801815 * reallocate. Also reinitialize the mailbox. Return 0 on success,18811816 * negative on failure.18821817 */18831883-static int idpf_init_hard_reset(struct idpf_adapter *adapter)18181818+static void idpf_init_hard_reset(struct idpf_adapter *adapter)18841819{18851820 struct idpf_reg_ops *reg_ops = &adapter->dev_ops.reg_ops;18861821 struct device *dev = &adapter->pdev->dev;18871887- struct net_device *netdev;18881822 int err;18891889- u16 i;1890182318241824+ idpf_detach_and_close(adapter);18911825 mutex_lock(&adapter->vport_ctrl_lock);1892182618931827 dev_info(dev, "Device HW Reset initiated\n");1894182818951895- /* Avoid TX hangs on reset */18961896- for (i = 0; i < adapter->max_vports; i++) {18971897- netdev = adapter->netdevs[i];18981898- if (!netdev)18991899- continue;19001900-19011901- netif_carrier_off(netdev);19021902- netif_tx_disable(netdev);19031903- }19041904-19051829 /* Prepare for reset */19061906- if (test_and_clear_bit(IDPF_HR_DRV_LOAD, adapter->flags)) {18301830+ if (test_bit(IDPF_HR_DRV_LOAD, adapter->flags)) {19071831 reg_ops->trigger_reset(adapter, IDPF_HR_DRV_LOAD);19081832 } else if (test_and_clear_bit(IDPF_HR_FUNC_RESET, adapter->flags)) {19091833 bool is_reset = idpf_is_reset_detected(adapter);1910183419111835 idpf_idc_issue_reset_event(adapter->cdev_info);1912183619131913- idpf_set_vport_state(adapter);19141837 idpf_vc_core_deinit(adapter);19151838 if (!is_reset)19161839 reg_ops->trigger_reset(adapter, IDPF_HR_FUNC_RESET);···19451892unlock_mutex:19461893 mutex_unlock(&adapter->vport_ctrl_lock);1947189419481948- /* Wait until all vports are created to init RDMA CORE AUX */19491949- if (!err)19501950- err = idpf_idc_init(adapter);19511951-19521952- return err;18951895+ /* Attempt to restore netdevs and initialize RDMA CORE AUX device,18961896+ * provided vc_core_init succeeded. It is still possible that18971897+ * vports are not allocated at this point if the init task failed.18981898+ */18991899+ if (!err) {19001900+ idpf_attach_and_open(adapter);19011901+ idpf_idc_init(adapter);19021902+ }19531903}1954190419551905/**···20531997 idpf_vport_stop(vport, false);20541998 }2055199920562056- idpf_deinit_rss(vport);20572000 /* We're passing in vport here because we need its wait_queue20582001 * to send a message and it should be getting all the vport20592002 * config data out of the adapter but we need to be careful not···20772022 err = idpf_set_real_num_queues(vport);20782023 if (err)20792024 goto err_open;20252025+20262026+ if (reset_cause == IDPF_SR_Q_CHANGE &&20272027+ !netif_is_rxfh_configured(vport->netdev))20282028+ idpf_fill_dflt_rss_lut(vport);2080202920812030 if (vport_is_up)20822031 err = idpf_vport_open(vport, false);···22252166}2226216722272168/**22282228- * idpf_vport_manage_rss_lut - disable/enable RSS22292229- * @vport: the vport being changed22302230- *22312231- * In the event of disable request for RSS, this function will zero out RSS22322232- * LUT, while in the event of enable request for RSS, it will reconfigure RSS22332233- * LUT with the default LUT configuration.22342234- */22352235-static int idpf_vport_manage_rss_lut(struct idpf_vport *vport)22362236-{22372237- bool ena = idpf_is_feature_ena(vport, NETIF_F_RXHASH);22382238- struct idpf_rss_data *rss_data;22392239- u16 idx = vport->idx;22402240- int lut_size;22412241-22422242- rss_data = &vport->adapter->vport_config[idx]->user_config.rss_data;22432243- lut_size = rss_data->rss_lut_size * sizeof(u32);22442244-22452245- if (ena) {22462246- /* This will contain the default or user configured LUT */22472247- memcpy(rss_data->rss_lut, rss_data->cached_lut, lut_size);22482248- } else {22492249- /* Save a copy of the current LUT to be restored later if22502250- * requested.22512251- */22522252- memcpy(rss_data->cached_lut, rss_data->rss_lut, lut_size);22532253-22542254- /* Zero out the current LUT to disable */22552255- memset(rss_data->rss_lut, 0, lut_size);22562256- }22572257-22582258- return idpf_config_rss(vport);22592259-}22602260-22612261-/**22622169 * idpf_set_features - set the netdev feature flags22632170 * @netdev: ptr to the netdev being adjusted22642171 * @features: the feature set that the stack is suggesting···22492224 }2250222522512226 if (changed & NETIF_F_RXHASH) {22272227+ struct idpf_netdev_priv *np = netdev_priv(netdev);22282228+22522229 netdev->features ^= NETIF_F_RXHASH;22532253- err = idpf_vport_manage_rss_lut(vport);22542254- if (err)22552255- goto unlock_mutex;22302230+22312231+ /* If the interface is not up when changing the rxhash, update22322232+ * to the HW is skipped. The updated LUT will be committed to22332233+ * the HW when the interface is brought up.22342234+ */22352235+ if (test_bit(IDPF_VPORT_UP, np->state)) {22362236+ err = idpf_config_rss(vport);22372237+ if (err)22382238+ goto unlock_mutex;22392239+ }22562240 }2257224122582242 if (changed & NETIF_F_GRO_HW) {
···28042804 * @vport: virtual port data structure28052805 * @get: flag to set or get rss look up table28062806 *28072807+ * When rxhash is disabled, RSS LUT will be configured with zeros. If rxhash28082808+ * is enabled, the LUT values stored in driver's soft copy will be used to setup28092809+ * the HW.28102810+ *28072811 * Returns 0 on success, negative on failure.28082812 */28092813int idpf_send_get_set_rss_lut_msg(struct idpf_vport *vport, bool get)···28182814 struct idpf_rss_data *rss_data;28192815 int buf_size, lut_buf_size;28202816 ssize_t reply_sz;28172817+ bool rxhash_ena;28212818 int i;2822281928232820 rss_data =28242821 &vport->adapter->vport_config[vport->idx]->user_config.rss_data;28222822+ rxhash_ena = idpf_is_feature_ena(vport, NETIF_F_RXHASH);28252823 buf_size = struct_size(rl, lut, rss_data->rss_lut_size);28262824 rl = kzalloc(buf_size, GFP_KERNEL);28272825 if (!rl)···28452839 } else {28462840 rl->lut_entries = cpu_to_le16(rss_data->rss_lut_size);28472841 for (i = 0; i < rss_data->rss_lut_size; i++)28482848- rl->lut[i] = cpu_to_le32(rss_data->rss_lut[i]);28422842+ rl->lut[i] = rxhash_ena ?28432843+ cpu_to_le32(rss_data->rss_lut[i]) : 0;2849284428502845 xn_params.vc_op = VIRTCHNL2_OP_SET_RSS_LUT;28512846 }···35773570 */35783571void idpf_vc_core_deinit(struct idpf_adapter *adapter)35793572{35733573+ struct idpf_hw *hw = &adapter->hw;35803574 bool remove_in_prog;3581357535823576 if (!test_bit(IDPF_VC_CORE_INIT, adapter->flags))···36003592 cancel_delayed_work_sync(&adapter->mbx_task);3601359336023594 idpf_vport_params_buf_rel(adapter);35953595+35963596+ kfree(hw->lan_regs);35973597+ hw->lan_regs = NULL;3603359836043599 kfree(adapter->vports);36053600 adapter->vports = NULL;
···402402static int imx_gpc_probe(struct platform_device *pdev)403403{404404 const struct imx_gpc_dt_data *of_id_data = device_get_match_data(&pdev->dev);405405- struct device_node *pgc_node;405405+ struct device_node *pgc_node __free(device_node)406406+ = of_get_child_by_name(pdev->dev.of_node, "pgc");406407 struct regmap *regmap;407408 void __iomem *base;408409 int ret;409409-410410- pgc_node = of_get_child_by_name(pdev->dev.of_node, "pgc");411410412411 /* bail out if DT too old and doesn't provide the necessary info */413412 if (!of_property_present(pdev->dev.of_node, "#power-domain-cells") &&
+6-15
drivers/pmdomain/mediatek/mtk-pm-domains.c
···984984 }985985}986986987987-static struct device_node *scpsys_get_legacy_regmap(struct device_node *np, const char *pn)988988-{989989- struct device_node *local_node;990990-991991- for_each_child_of_node(np, local_node) {992992- if (of_property_present(local_node, pn))993993- return local_node;994994- }995995-996996- return NULL;997997-}998998-999987static int scpsys_get_bus_protection_legacy(struct device *dev, struct scpsys *scpsys)1000988{1001989 const u8 bp_blocks[3] = {···10051017 * this makes it then possible to allocate the array of bus_prot10061018 * regmaps and convert all to the new style handling.10071019 */10081008- node = scpsys_get_legacy_regmap(np, "mediatek,infracfg");10201020+ of_node_get(np);10211021+ node = of_find_node_with_property(np, "mediatek,infracfg");10091022 if (node) {10101023 regmap[0] = syscon_regmap_lookup_by_phandle(node, "mediatek,infracfg");10111024 of_node_put(node);···10191030 regmap[0] = NULL;10201031 }1021103210221022- node = scpsys_get_legacy_regmap(np, "mediatek,smi");10331033+ of_node_get(np);10341034+ node = of_find_node_with_property(np, "mediatek,smi");10231035 if (node) {10241036 smi_np = of_parse_phandle(node, "mediatek,smi", 0);10251037 of_node_put(node);···10381048 regmap[1] = NULL;10391049 }1040105010411041- node = scpsys_get_legacy_regmap(np, "mediatek,infracfg-nao");10511051+ of_node_get(np);10521052+ node = of_find_node_with_property(np, "mediatek,infracfg-nao");10421053 if (node) {10431054 regmap[2] = syscon_regmap_lookup_by_phandle(node, "mediatek,infracfg-nao");10441055 num_regmaps++;
···152152 return ERR_PTR(-ENOMEM);153153 btrfs_init_delayed_node(node, root, ino);154154155155+ /* Cached in the inode and can be accessed. */156156+ refcount_set(&node->refs, 2);157157+ btrfs_delayed_node_ref_tracker_alloc(node, tracker, GFP_NOFS);158158+ btrfs_delayed_node_ref_tracker_alloc(node, &node->inode_cache_tracker, GFP_NOFS);159159+155160 /* Allocate and reserve the slot, from now it can return a NULL from xa_load(). */156161 ret = xa_reserve(&root->delayed_nodes, ino, GFP_NOFS);157157- if (ret == -ENOMEM) {158158- btrfs_delayed_node_ref_tracker_dir_exit(node);159159- kmem_cache_free(delayed_node_cache, node);160160- return ERR_PTR(-ENOMEM);161161- }162162+ if (ret == -ENOMEM)163163+ goto cleanup;164164+162165 xa_lock(&root->delayed_nodes);163166 ptr = xa_load(&root->delayed_nodes, ino);164167 if (ptr) {165168 /* Somebody inserted it, go back and read it. */166169 xa_unlock(&root->delayed_nodes);167167- btrfs_delayed_node_ref_tracker_dir_exit(node);168168- kmem_cache_free(delayed_node_cache, node);169169- node = NULL;170170- goto again;170170+ goto cleanup;171171 }172172 ptr = __xa_store(&root->delayed_nodes, ino, node, GFP_ATOMIC);173173 ASSERT(xa_err(ptr) != -EINVAL);174174 ASSERT(xa_err(ptr) != -ENOMEM);175175 ASSERT(ptr == NULL);176176-177177- /* Cached in the inode and can be accessed. */178178- refcount_set(&node->refs, 2);179179- btrfs_delayed_node_ref_tracker_alloc(node, tracker, GFP_ATOMIC);180180- btrfs_delayed_node_ref_tracker_alloc(node, &node->inode_cache_tracker, GFP_ATOMIC);181181-182176 btrfs_inode->delayed_node = node;183177 xa_unlock(&root->delayed_nodes);184178185179 return node;180180+cleanup:181181+ btrfs_delayed_node_ref_tracker_free(node, tracker);182182+ btrfs_delayed_node_ref_tracker_free(node, &node->inode_cache_tracker);183183+ btrfs_delayed_node_ref_tracker_dir_exit(node);184184+ kmem_cache_free(delayed_node_cache, node);185185+ if (ret)186186+ return ERR_PTR(ret);187187+ goto again;186188}187189188190/*
+4-4
fs/btrfs/extent_io.c
···17281728 struct btrfs_ordered_extent *ordered;1729172917301730 ordered = btrfs_lookup_first_ordered_range(inode, cur,17311731- folio_end - cur);17311731+ fs_info->sectorsize);17321732 /*17331733 * We have just run delalloc before getting here, so17341734 * there must be an ordered extent.···17421742 btrfs_put_ordered_extent(ordered);1743174317441744 btrfs_mark_ordered_io_finished(inode, folio, cur,17451745- end - cur, true);17451745+ fs_info->sectorsize, true);17461746 /*17471747 * This range is beyond i_size, thus we don't need to17481748 * bother writing back.···17511751 * writeback the sectors with subpage dirty bits,17521752 * causing writeback without ordered extent.17531753 */17541754- btrfs_folio_clear_dirty(fs_info, folio, cur, end - cur);17551755- break;17541754+ btrfs_folio_clear_dirty(fs_info, folio, cur, fs_info->sectorsize);17551755+ continue;17561756 }17571757 ret = submit_one_sector(inode, folio, cur, bio_ctrl, i_size);17581758 if (unlikely(ret < 0)) {
+15-7
fs/btrfs/inode.c
···618618 struct btrfs_drop_extents_args drop_args = { 0 };619619 struct btrfs_root *root = inode->root;620620 struct btrfs_fs_info *fs_info = root->fs_info;621621- struct btrfs_trans_handle *trans;621621+ struct btrfs_trans_handle *trans = NULL;622622 u64 data_len = (compressed_size ?: size);623623 int ret;624624 struct btrfs_path *path;625625626626 path = btrfs_alloc_path();627627- if (!path)628628- return -ENOMEM;627627+ if (!path) {628628+ ret = -ENOMEM;629629+ goto out;630630+ }629631630632 trans = btrfs_join_transaction(root);631633 if (IS_ERR(trans)) {632632- btrfs_free_path(path);633633- return PTR_ERR(trans);634634+ ret = PTR_ERR(trans);635635+ trans = NULL;636636+ goto out;634637 }635638 trans->block_rsv = &inode->block_rsv;636639···677674 * it won't count as data extent, free them directly here.678675 * And at reserve time, it's always aligned to page size, so679676 * just free one page here.677677+ *678678+ * If we fallback to non-inline (ret == 1) due to -ENOSPC, then we need679679+ * to keep the data reservation.680680 */681681- btrfs_qgroup_free_data(inode, NULL, 0, fs_info->sectorsize, NULL);681681+ if (ret <= 0)682682+ btrfs_qgroup_free_data(inode, NULL, 0, fs_info->sectorsize, NULL);682683 btrfs_free_path(path);683683- btrfs_end_transaction(trans);684684+ if (trans)685685+ btrfs_end_transaction(trans);684686 return ret;685687}686688
···520520 * when this is done, it is safe to start a new transaction, but the current521521 * transaction might not be fully on disk.522522 */523523-static void wait_current_trans(struct btrfs_fs_info *fs_info)523523+static void wait_current_trans(struct btrfs_fs_info *fs_info, unsigned int type)524524{525525 struct btrfs_transaction *cur_trans;526526527527 spin_lock(&fs_info->trans_lock);528528 cur_trans = fs_info->running_transaction;529529- if (cur_trans && is_transaction_blocked(cur_trans)) {529529+ if (cur_trans && is_transaction_blocked(cur_trans) &&530530+ (btrfs_blocked_trans_types[cur_trans->state] & type)) {530531 refcount_inc(&cur_trans->use_count);531532 spin_unlock(&fs_info->trans_lock);532533···702701 sb_start_intwrite(fs_info->sb);703702704703 if (may_wait_transaction(fs_info, type))705705- wait_current_trans(fs_info);704704+ wait_current_trans(fs_info, type);706705707706 do {708707 ret = join_transaction(fs_info, type);709708 if (ret == -EBUSY) {710710- wait_current_trans(fs_info);709709+ wait_current_trans(fs_info, type);711710 if (unlikely(type == TRANS_ATTACH ||712711 type == TRANS_JOIN_NOSTART))713712 ret = -ENOENT;···1004100310051004void btrfs_throttle(struct btrfs_fs_info *fs_info)10061005{10071007- wait_current_trans(fs_info);10061006+ wait_current_trans(fs_info, TRANS_START);10081007}1009100810101009bool btrfs_should_end_transaction(struct btrfs_trans_handle *trans)
+2-4
fs/btrfs/tree-log.c
···63416341 * and no keys greater than that, so bail out.63426342 */63436343 break;63446344- } else if ((min_key->type == BTRFS_INODE_REF_KEY ||63456345- min_key->type == BTRFS_INODE_EXTREF_KEY) &&63466346- (inode->generation == trans->transid ||63476347- ctx->logging_conflict_inodes)) {63446344+ } else if (min_key->type == BTRFS_INODE_REF_KEY ||63456345+ min_key->type == BTRFS_INODE_EXTREF_KEY) {63486346 u64 other_ino = 0;63496347 u64 other_parent = 0;63506348
···633633 }634634635635 mode = lock_to_openmode(&lock->fl);636636- error = vfs_test_lock(file->f_file[mode], &lock->fl);636636+ locks_init_lock(&conflock->fl);637637+ /* vfs_test_lock only uses start, end, and owner, but tests flc_file */638638+ conflock->fl.c.flc_file = lock->fl.c.flc_file;639639+ conflock->fl.fl_start = lock->fl.fl_start;640640+ conflock->fl.fl_end = lock->fl.fl_end;641641+ conflock->fl.c.flc_owner = lock->fl.c.flc_owner;642642+ error = vfs_test_lock(file->f_file[mode], &conflock->fl);637643 if (error) {638644 /* We can't currently deal with deferred test requests */639645 if (error == FILE_LOCK_DEFERRED)···649643 goto out;650644 }651645652652- if (lock->fl.c.flc_type == F_UNLCK) {646646+ if (conflock->fl.c.flc_type == F_UNLCK) {653647 ret = nlm_granted;654648 goto out;655649 }656650657651 dprintk("lockd: conflicting lock(ty=%d, %Ld-%Ld)\n",658658- lock->fl.c.flc_type, (long long)lock->fl.fl_start,659659- (long long)lock->fl.fl_end);652652+ conflock->fl.c.flc_type, (long long)conflock->fl.fl_start,653653+ (long long)conflock->fl.fl_end);660654 conflock->caller = "somehost"; /* FIXME */661655 conflock->len = strlen(conflock->caller);662656 conflock->oh.len = 0; /* don't return OH info */663663- conflock->svid = lock->fl.c.flc_pid;664664- conflock->fl.c.flc_type = lock->fl.c.flc_type;665665- conflock->fl.fl_start = lock->fl.fl_start;666666- conflock->fl.fl_end = lock->fl.fl_end;667667- locks_release_private(&lock->fl);657657+ conflock->svid = conflock->fl.c.flc_pid;658658+ locks_release_private(&conflock->fl);668659669660 ret = nlm_lck_denied;670661out:
+1-4
fs/lockd/svcproc.c
···117117 struct nlm_args *argp = rqstp->rq_argp;118118 struct nlm_host *host;119119 struct nlm_file *file;120120- struct nlm_lockowner *test_owner;121120 __be32 rc = rpc_success;122121123122 dprintk("lockd: TEST called\n");···125126 /* Obtain client and file */126127 if ((resp->status = nlmsvc_retrieve_args(rqstp, argp, &host, &file)))127128 return resp->status == nlm_drop_reply ? rpc_drop_reply :rpc_success;128128-129129- test_owner = argp->lock.fl.c.flc_owner;130129131130 /* Now check for conflicting locks */132131 resp->status = cast_status(nlmsvc_testlock(rqstp, file, host,···135138 dprintk("lockd: TEST status %d vers %d\n",136139 ntohl(resp->status), rqstp->rq_vers);137140138138- nlmsvc_put_lockowner(test_owner);141141+ nlmsvc_release_lockowner(&argp->lock);139142 nlmsvc_release_host(host);140143 nlm_release_file(file);141144 return rc;
+10-2
fs/locks.c
···22362236/**22372237 * vfs_test_lock - test file byte range lock22382238 * @filp: The file to test lock for22392239- * @fl: The lock to test; also used to hold result22392239+ * @fl: The byte-range in the file to test; also used to hold result22402240 *22412241+ * On entry, @fl does not contain a lock, but identifies a range (fl_start, fl_end)22422242+ * in the file (c.flc_file), and an owner (c.flc_owner) for whom existing locks22432243+ * should be ignored. c.flc_type and c.flc_flags are ignored.22442244+ * Both fl_lmops and fl_ops in @fl must be NULL.22412245 * Returns -ERRNO on failure. Indicates presence of conflicting lock by22422242- * setting conf->fl_type to something other than F_UNLCK.22462246+ * setting fl->fl_type to something other than F_UNLCK.22472247+ *22482248+ * If vfs_test_lock() does find a lock and return it, the caller must22492249+ * use locks_free_lock() or locks_release_private() on the returned lock.22432250 */22442251int vfs_test_lock(struct file *filp, struct file_lock *fl)22452252{22532253+ WARN_ON_ONCE(fl->fl_ops || fl->fl_lmops);22462254 WARN_ON_ONCE(filp != fl->c.flc_file);22472255 if (filp->f_op->lock)22482256 return filp->f_op->lock(filp, F_GETLK, fl);
···8484/* forward declarations */8585static bool check_for_locks(struct nfs4_file *fp, struct nfs4_lockowner *lowner);8686static void nfs4_free_ol_stateid(struct nfs4_stid *stid);8787-void nfsd4_end_grace(struct nfsd_net *nn);8787+static void nfsd4_end_grace(struct nfsd_net *nn);8888static void _free_cpntf_state_locked(struct nfsd_net *nn, struct nfs4_cpntf_state *cps);8989static void nfsd4_file_hash_remove(struct nfs4_file *fi);9090static void deleg_reaper(struct nfsd_net *nn);···1218121812191219 if (nf)12201220 nfsd_file_put(nf);12211221- if (rnf)12211221+ if (rnf) {12221222+ nfsd_file_put(rnf);12221223 nfs4_file_put_access(fp, NFS4_SHARE_ACCESS_READ);12241224+ }12231225}1224122612251227static void nfsd4_finalize_deleg_timestamps(struct nfs4_delegation *dp, struct file *f)12261228{12271227- struct iattr ia = { .ia_valid = ATTR_ATIME | ATTR_CTIME | ATTR_MTIME };12291229+ struct iattr ia = { .ia_valid = ATTR_ATIME | ATTR_CTIME | ATTR_MTIME | ATTR_DELEG };12281230 struct inode *inode = file_inode(f);12291231 int ret;12301232···1759175717601758/**17611759 * nfsd4_revoke_states - revoke all nfsv4 states associated with given filesystem17621762- * @net: used to identify instance of nfsd (there is one per net namespace)17601760+ * @nn: used to identify instance of nfsd (there is one per net namespace)17631761 * @sb: super_block used to identify target filesystem17641762 *17651763 * All nfs4 states (open, lock, delegation, layout) held by the server instance···17711769 * The clients which own the states will subsequently being notified that the17721770 * states have been "admin-revoked".17731771 */17741774-void nfsd4_revoke_states(struct net *net, struct super_block *sb)17721772+void nfsd4_revoke_states(struct nfsd_net *nn, struct super_block *sb)17751773{17761776- struct nfsd_net *nn = net_generic(net, nfsd_net_id);17771774 unsigned int idhashval;17781775 unsigned int sc_types;1779177617801777 sc_types = SC_TYPE_OPEN | SC_TYPE_LOCK | SC_TYPE_DELEG | SC_TYPE_LAYOUT;1781177817821779 spin_lock(&nn->client_lock);17831783- for (idhashval = 0; idhashval < CLIENT_HASH_MASK; idhashval++) {17801780+ for (idhashval = 0; idhashval < CLIENT_HASH_SIZE; idhashval++) {17841781 struct list_head *head = &nn->conf_id_hashtbl[idhashval];17851782 struct nfs4_client *clp;17861783 retry:···30983097 return -ENXIO;3099309831003099 ret = seq_open(file, &states_seq_ops);31013101- if (ret)31003100+ if (ret) {31013101+ drop_client(clp);31023102 return ret;31033103+ }31033104 s = file->private_data;31043105 s->private = clp;31053106 return 0;···62346231 fp = stp->st_stid.sc_file;62356232 spin_lock(&fp->fi_lock);62366233 __nfs4_file_get_access(fp, NFS4_SHARE_ACCESS_READ);62376237- fp = stp->st_stid.sc_file;62386238- fp->fi_fds[O_RDONLY] = nf;62396239- fp->fi_rdeleg_file = nf;62346234+ if (!fp->fi_fds[O_RDONLY]) {62356235+ fp->fi_fds[O_RDONLY] = nf;62366236+ nf = NULL;62376237+ }62386238+ fp->fi_rdeleg_file = nfsd_file_get(fp->fi_fds[O_RDONLY]);62406239 spin_unlock(&fp->fi_lock);62406240+ if (nf)62416241+ nfsd_file_put(nf);62416242 }62426243 return true;62436244}···65696562 return nfs_ok;65706563}6571656465726572-void65656565+static void65736566nfsd4_end_grace(struct nfsd_net *nn)65746567{65756568 /* do nothing if grace period already ended */···66026595 */66036596}6604659765986598+/**65996599+ * nfsd4_force_end_grace - forcibly end the NFSv4 grace period66006600+ * @nn: network namespace for the server instance to be updated66016601+ *66026602+ * Forces bypass of normal grace period completion, then schedules66036603+ * the laundromat to end the grace period immediately. Does not wait66046604+ * for the grace period to fully terminate before returning.66056605+ *66066606+ * Return values:66076607+ * %true: Grace termination schedule66086608+ * %false: No action was taken66096609+ */66106610+bool nfsd4_force_end_grace(struct nfsd_net *nn)66116611+{66126612+ if (!nn->client_tracking_ops)66136613+ return false;66146614+ spin_lock(&nn->client_lock);66156615+ if (nn->grace_ended || !nn->client_tracking_active) {66166616+ spin_unlock(&nn->client_lock);66176617+ return false;66186618+ }66196619+ WRITE_ONCE(nn->grace_end_forced, true);66206620+ mod_delayed_work(laundry_wq, &nn->laundromat_work, 0);66216621+ spin_unlock(&nn->client_lock);66226622+ return true;66236623+}66246624+66056625/*66066626 * If we've waited a lease period but there are still clients trying to66076627 * reclaim, wait a little longer to give them a chance to finish.···66386604 time64_t double_grace_period_end = nn->boot_time +66396605 2 * nn->nfsd4_lease;6640660666076607+ if (READ_ONCE(nn->grace_end_forced))66086608+ return false;66416609 if (nn->track_reclaim_completes &&66426610 atomic_read(&nn->nr_reclaim_complete) ==66436611 nn->reclaim_str_hashtbl_size)···89608924 nn->unconf_name_tree = RB_ROOT;89618925 nn->boot_time = ktime_get_real_seconds();89628926 nn->grace_ended = false;89278927+ nn->grace_end_forced = false;89288928+ nn->client_tracking_active = false;89638929 nn->nfsd4_manager.block_opens = true;89648930 INIT_LIST_HEAD(&nn->nfsd4_manager.list);89658931 INIT_LIST_HEAD(&nn->client_lru);···90429004 return ret;90439005 locks_start_grace(net, &nn->nfsd4_manager);90449006 nfsd4_client_tracking_init(net);90079007+ /* safe for laundromat to run now */90089008+ spin_lock(&nn->client_lock);90099009+ nn->client_tracking_active = true;90109010+ spin_unlock(&nn->client_lock);90459011 if (nn->track_reclaim_completes && nn->reclaim_str_hashtbl_size == 0)90469012 goto skip_grace;90479013 printk(KERN_INFO "NFSD: starting %lld-second grace period (net %x)\n",···9094905290959053 shrinker_free(nn->nfsd_client_shrinker);90969054 cancel_work_sync(&nn->nfsd_shrinker_work);90559055+ spin_lock(&nn->client_lock);90569056+ nn->client_tracking_active = false;90579057+ spin_unlock(&nn->client_lock);90979058 cancel_delayed_work_sync(&nn->laundromat_work);90989059 locks_end_grace(&nn->nfsd4_manager);90999060
+9-3
fs/nfsd/nfsctl.c
···259259 struct path path;260260 char *fo_path;261261 int error;262262+ struct nfsd_net *nn;262263263264 /* sanity check */264265 if (size == 0)···286285 * 3. Is that directory the root of an exported file system?287286 */288287 error = nlmsvc_unlock_all_by_sb(path.dentry->d_sb);289289- nfsd4_revoke_states(netns(file), path.dentry->d_sb);288288+ mutex_lock(&nfsd_mutex);289289+ nn = net_generic(netns(file), nfsd_net_id);290290+ if (nn->nfsd_serv)291291+ nfsd4_revoke_states(nn, path.dentry->d_sb);292292+ else293293+ error = -EINVAL;294294+ mutex_unlock(&nfsd_mutex);290295291296 path_put(&path);292297 return error;···10891082 case 'Y':10901083 case 'y':10911084 case '1':10921092- if (!nn->nfsd_serv)10851085+ if (!nfsd4_force_end_grace(nn))10931086 return -EBUSY;10941087 trace_nfsd_end_grace(netns(file));10951095- nfsd4_end_grace(nn);10961088 break;10971089 default:10981090 return -EINVAL;
···8899#define NR_PAGES(order) (1U << (order))10101111+struct dma_fence;1112struct drm_pagemap;1213struct drm_pagemap_zdd;1314struct device;···175174 * @pages: Pointer to array of device memory pages (destination)176175 * @pagemap_addr: Pointer to array of DMA information (source)177176 * @npages: Number of pages to copy177177+ * @pre_migrate_fence: dma-fence to wait for before migration start.178178+ * May be NULL.178179 *179180 * Copy pages to device memory. If the order of a @pagemap_addr entry180181 * is greater than 0, the entry is populated but subsequent entries···186183 */187184 int (*copy_to_devmem)(struct page **pages,188185 struct drm_pagemap_addr *pagemap_addr,189189- unsigned long npages);186186+ unsigned long npages,187187+ struct dma_fence *pre_migrate_fence);190188191189 /**192190 * @copy_to_ram: Copy to system RAM (required for migration)193191 * @pages: Pointer to array of device memory pages (source)194192 * @pagemap_addr: Pointer to array of DMA information (destination)195193 * @npages: Number of pages to copy194194+ * @pre_migrate_fence: dma-fence to wait for before migration start.195195+ * May be NULL.196196 *197197 * Copy pages to system RAM. If the order of a @pagemap_addr entry198198 * is greater than 0, the entry is populated but subsequent entries···205199 */206200 int (*copy_to_ram)(struct page **pages,207201 struct drm_pagemap_addr *pagemap_addr,208208- unsigned long npages);202202+ unsigned long npages,203203+ struct dma_fence *pre_migrate_fence);209204};210205211206/**···219212 * @dpagemap: The struct drm_pagemap of the pages this allocation belongs to.220213 * @size: Size of device memory allocation221214 * @timeslice_expiration: Timeslice expiration in jiffies215215+ * @pre_migrate_fence: Fence to wait for or pipeline behind before migration starts.216216+ * (May be NULL).222217 */223218struct drm_pagemap_devmem {224219 struct device *dev;···230221 struct drm_pagemap *dpagemap;231222 size_t size;232223 u64 timeslice_expiration;224224+ struct dma_fence *pre_migrate_fence;233225};234226235227int drm_pagemap_migrate_to_devmem(struct drm_pagemap_devmem *devmem_allocation,···248238void drm_pagemap_devmem_init(struct drm_pagemap_devmem *devmem_allocation,249239 struct device *dev, struct mm_struct *mm,250240 const struct drm_pagemap_devmem_ops *ops,251251- struct drm_pagemap *dpagemap, size_t size);241241+ struct drm_pagemap *dpagemap, size_t size,242242+ struct dma_fence *pre_migrate_fence);252243253244int drm_pagemap_populate_mm(struct drm_pagemap *dpagemap,254245 unsigned long start, unsigned long end,
+33-20
include/kunit/run-in-irq-context.h
···2020 bool task_func_reported_failure;2121 bool hardirq_func_reported_failure;2222 bool softirq_func_reported_failure;2323- unsigned long hardirq_func_calls;2424- unsigned long softirq_func_calls;2323+ atomic_t hardirq_func_calls;2424+ atomic_t softirq_func_calls;2525 struct hrtimer timer;2626 struct work_struct bh_work;2727};···3232 container_of(timer, typeof(*state), timer);33333434 WARN_ON_ONCE(!in_hardirq());3535- state->hardirq_func_calls++;3535+ atomic_inc(&state->hardirq_func_calls);36363737 if (!state->func(state->test_specific_state))3838 state->hardirq_func_reported_failure = true;···4848 container_of(work, typeof(*state), bh_work);49495050 WARN_ON_ONCE(!in_serving_softirq());5151- state->softirq_func_calls++;5151+ atomic_inc(&state->softirq_func_calls);52525353 if (!state->func(state->test_specific_state))5454 state->softirq_func_reported_failure = true;···5959 * hardirq context concurrently, and reports a failure to KUnit if any6060 * invocation of @func in any context returns false. @func is passed6161 * @test_specific_state as its argument. At most 3 invocations of @func will6262- * run concurrently: one in each of task, softirq, and hardirq context.6262+ * run concurrently: one in each of task, softirq, and hardirq context. @func6363+ * will continue running until either @max_iterations calls have been made (so6464+ * long as at least one each runs in task, softirq, and hardirq contexts), or6565+ * one second has passed.6366 *6467 * The main purpose of this interrupt context testing is to validate fallback6568 * code paths that run in contexts where the normal code path cannot be used,···8885 .test_specific_state = test_specific_state,8986 };9087 unsigned long end_jiffies;8888+ int hardirq_calls, softirq_calls;8989+ bool allctx = false;91909291 /*9392 * Set up a hrtimer (the way we access hardirq context) and a work···9994 CLOCK_MONOTONIC, HRTIMER_MODE_REL_HARD);10095 INIT_WORK_ONSTACK(&state.bh_work, kunit_irq_test_bh_work_func);10196102102- /* Run for up to max_iterations or 1 second, whichever comes first. */9797+ /*9898+ * Run for up to max_iterations (including at least one task, softirq,9999+ * and hardirq), or 1 second, whichever comes first.100100+ */103101 end_jiffies = jiffies + HZ;104102 hrtimer_start(&state.timer, KUNIT_IRQ_TEST_HRTIMER_INTERVAL,105103 HRTIMER_MODE_REL_HARD);106106- for (int i = 0; i < max_iterations && !time_after(jiffies, end_jiffies);107107- i++) {104104+ for (int task_calls = 0, calls = 0;105105+ ((calls < max_iterations) || !allctx) &&106106+ !time_after(jiffies, end_jiffies);107107+ task_calls++) {108108 if (!func(test_specific_state))109109 state.task_func_reported_failure = true;110110+111111+ hardirq_calls = atomic_read(&state.hardirq_func_calls);112112+ softirq_calls = atomic_read(&state.softirq_func_calls);113113+ calls = task_calls + hardirq_calls + softirq_calls;114114+ allctx = (task_calls > 0) && (hardirq_calls > 0) &&115115+ (softirq_calls > 0);110116 }111117112118 /* Cancel the timer and work. */···125109 flush_work(&state.bh_work);126110127111 /* Sanity check: the timer and BH functions should have been run. */128128- KUNIT_EXPECT_GT_MSG(test, state.hardirq_func_calls, 0,112112+ KUNIT_EXPECT_GT_MSG(test, atomic_read(&state.hardirq_func_calls), 0,129113 "Timer function was not called");130130- KUNIT_EXPECT_GT_MSG(test, state.softirq_func_calls, 0,114114+ KUNIT_EXPECT_GT_MSG(test, atomic_read(&state.softirq_func_calls), 0,131115 "BH work function was not called");132116133133- /* Check for incorrect hash values reported from any context. */134134- KUNIT_EXPECT_FALSE_MSG(135135- test, state.task_func_reported_failure,136136- "Incorrect hash values reported from task context");137137- KUNIT_EXPECT_FALSE_MSG(138138- test, state.hardirq_func_reported_failure,139139- "Incorrect hash values reported from hardirq context");140140- KUNIT_EXPECT_FALSE_MSG(141141- test, state.softirq_func_reported_failure,142142- "Incorrect hash values reported from softirq context");117117+ /* Check for failure reported from any context. */118118+ KUNIT_EXPECT_FALSE_MSG(test, state.task_func_reported_failure,119119+ "Failure reported from task context");120120+ KUNIT_EXPECT_FALSE_MSG(test, state.hardirq_func_reported_failure,121121+ "Failure reported from hardirq context");122122+ KUNIT_EXPECT_FALSE_MSG(test, state.softirq_func_reported_failure,123123+ "Failure reported from softirq context");143124}144125145126#endif /* _KUNIT_RUN_IN_IRQ_CONTEXT_H */
+9-8
include/linux/intel_vsec.h
···80808181/**8282 * struct pmt_callbacks - Callback infrastructure for PMT devices8383- * ->read_telem() when specified, called by client driver to access PMT data (instead8484- * of direct copy).8585- * @pdev: PCI device reference for the callback's use8686- * @guid: ID of data to acccss8787- * @data: buffer for the data to be copied8888- * @off: offset into the requested buffer8989- * @count: size of buffer8383+ * @read_telem: when specified, called by client driver to access PMT8484+ * data (instead of direct copy).8585+ * * pdev: PCI device reference for the callback's use8686+ * * guid: ID of data to acccss8787+ * * data: buffer for the data to be copied8888+ * * off: offset into the requested buffer8989+ * * count: size of buffer9090 */9191struct pmt_callbacks {9292 int (*read_telem)(struct pci_dev *pdev, u32 guid, u64 *data, loff_t off, u32 count);···120120};121121122122/**123123- * struct intel_sec_device - Auxbus specific device information123123+ * struct intel_vsec_device - Auxbus specific device information124124 * @auxdev: auxbus device struct for auxbus access125125 * @pcidev: pci device associated with the device126126 * @resource: any resources shared by the parent···128128 * @num_resources: number of resources129129 * @id: xarray id130130 * @priv_data: any private data needed131131+ * @priv_data_size: size of private data area131132 * @quirks: specified quirks132133 * @base_addr: base address of entries (if specified)133134 * @cap_id: the enumerated id of the vsec feature
+7-1
include/linux/io_uring_types.h
···424424 struct user_struct *user;425425 struct mm_struct *mm_account;426426427427+ /*428428+ * List of tctx nodes for this ctx, protected by tctx_lock. For429429+ * cancelation purposes, nests under uring_lock.430430+ */431431+ struct list_head tctx_list;432432+ struct mutex tctx_lock;433433+427434 /* ctx exit and cancelation */428435 struct llist_head fallback_llist;429436 struct delayed_work fallback_work;430437 struct work_struct exit_work;431431- struct list_head tctx_list;432438 struct completion ref_comp;433439434440 /* io-wq management, e.g. thread count */
+2-2
include/linux/irq-entry-common.h
···110110static inline void local_irq_enable_exit_to_user(unsigned long ti_work);111111112112#ifndef local_irq_enable_exit_to_user113113-static inline void local_irq_enable_exit_to_user(unsigned long ti_work)113113+static __always_inline void local_irq_enable_exit_to_user(unsigned long ti_work)114114{115115 local_irq_enable();116116}···125125static inline void local_irq_disable_exit_to_user(void);126126127127#ifndef local_irq_disable_exit_to_user128128-static inline void local_irq_disable_exit_to_user(void)128128+static __always_inline void local_irq_disable_exit_to_user(void)129129{130130 local_irq_disable();131131}
···349349 if (pm_test_level == level) {350350 pr_info("suspend debug: Waiting for %d second(s).\n",351351 pm_test_delay);352352- for (i = 0; i < pm_test_delay && !pm_wakeup_pending(); i++)353353- msleep(1000);354354-352352+ for (i = 0; i < pm_test_delay && !pm_wakeup_pending(); i++) {353353+ if (level > TEST_CORE)354354+ msleep(1000);355355+ else356356+ mdelay(1000);357357+ }355358 return 1;356359 }357360#endif /* !CONFIG_PM_DEBUG */
+7-4
net/bridge/br_vlan_tunnel.c
···189189 IP_TUNNEL_DECLARE_FLAGS(flags) = { };190190 struct metadata_dst *tunnel_dst;191191 __be64 tunnel_id;192192- int err;193192194193 if (!vlan)195194 return 0;···198199 return 0;199200200201 skb_dst_drop(skb);201201- err = skb_vlan_pop(skb);202202- if (err)203203- return err;202202+ /* For 802.1ad (QinQ), skb_vlan_pop() incorrectly moves the C-VLAN203203+ * from payload to hwaccel after clearing S-VLAN. We only need to204204+ * clear the hwaccel S-VLAN; the C-VLAN must stay in payload for205205+ * correct VXLAN encapsulation. This is also correct for 802.1Q206206+ * where no C-VLAN exists in payload.207207+ */208208+ __vlan_hwaccel_clear_tag(skb);204209205210 if (BR_INPUT_SKB_CB(skb)->backup_nhid) {206211 __set_bit(IP_TUNNEL_KEY_BIT, flags);
···38963896int sock_recv_errqueue(struct sock *sk, struct msghdr *msg, int len,38973897 int level, int type)38983898{38993899- struct sock_exterr_skb *serr;38993899+ struct sock_extended_err ee;39003900 struct sk_buff *skb;39013901 int copied, err;39023902···3916391639173917 sock_recv_timestamp(msg, sk, skb);3918391839193919- serr = SKB_EXT_ERR(skb);39203920- put_cmsg(msg, level, type, sizeof(serr->ee), &serr->ee);39193919+ /* We must use a bounce buffer for CONFIG_HARDENED_USERCOPY=y */39203920+ ee = SKB_EXT_ERR(skb)->ee;39213921+ put_cmsg(msg, level, type, sizeof(ee), &ee);3921392239223923 msg->msg_flags |= MSG_ERRQUEUE;39233924 err = copied;
+4-3
net/ipv4/arp.c
···564564565565 skb_reserve(skb, hlen);566566 skb_reset_network_header(skb);567567- arp = skb_put(skb, arp_hdr_len(dev));567567+ skb_put(skb, arp_hdr_len(dev));568568 skb->dev = dev;569569 skb->protocol = htons(ETH_P_ARP);570570 if (!src_hw)···572572 if (!dest_hw)573573 dest_hw = dev->broadcast;574574575575- /*576576- * Fill the device header for the ARP frame575575+ /* Fill the device header for the ARP frame.576576+ * Note: skb->head can be changed.577577 */578578 if (dev_hard_header(skb, dev, ptype, dest_hw, src_hw, skb->len) < 0)579579 goto out;580580581581+ arp = arp_hdr(skb);581582 /*582583 * Fill out the arp protocol part.583584 *
···9090 /* next (or first) interface */9191 iter->sdata = list_prepare_entry(iter->sdata, &local->interfaces, list);9292 list_for_each_entry_continue(iter->sdata, &local->interfaces, list) {9393+ if (!ieee80211_sdata_running(iter->sdata))9494+ continue;9595+9396 /* AP_VLAN has a chanctx pointer but follows AP */9497 if (iter->sdata->vif.type == NL80211_IFTYPE_AP_VLAN)9598 continue;
+4-3
net/mac80211/sta_info.c
···15331533 }15341534 }1535153515361536+ sinfo = kzalloc(sizeof(*sinfo), GFP_KERNEL);15371537+ if (sinfo)15381538+ sta_set_sinfo(sta, sinfo, true);15391539+15361540 if (sta->uploaded) {15371541 ret = drv_sta_state(local, sdata, sta, IEEE80211_STA_NONE,15381542 IEEE80211_STA_NOTEXIST);···1545154115461542 sta_dbg(sdata, "Removed STA %pM\n", sta->sta.addr);1547154315481548- sinfo = kzalloc(sizeof(*sinfo), GFP_KERNEL);15491549- if (sinfo)15501550- sta_set_sinfo(sta, sinfo, true);15511544 cfg80211_del_sta_sinfo(sdata->dev, sta->sta.addr, sinfo, GFP_KERNEL);15521545 kfree(sinfo);15531546
···8989 if (pf == NFPROTO_UNSPEC) {9090 for (i = NFPROTO_UNSPEC; i < NFPROTO_NUMPROTO; i++) {9191 if (rcu_access_pointer(loggers[i][logger->type])) {9292- ret = -EEXIST;9292+ ret = -EBUSY;9393 goto unlock;9494 }9595 }···9797 rcu_assign_pointer(loggers[i][logger->type], logger);9898 } else {9999 if (rcu_access_pointer(loggers[pf][logger->type])) {100100- ret = -EEXIST;100100+ ret = -EBUSY;101101 goto unlock;102102 }103103 rcu_assign_pointer(loggers[pf][logger->type], logger);
···17641764int xt_register_template(const struct xt_table *table,17651765 int (*table_init)(struct net *net))17661766{17671767- int ret = -EEXIST, af = table->af;17671767+ int ret = -EBUSY, af = table->af;17681768 struct xt_template *t;1769176917701770 mutex_lock(&xt[af].mutex);
+2
net/sched/act_api.c
···940940 int ret;941941942942 idr_for_each_entry_ul(idr, p, tmp, id) {943943+ if (IS_ERR(p))944944+ continue;943945 if (tc_act_in_hw(p) && !mutex_taken) {944946 rtnl_lock();945947 mutex_taken = true;
+13-13
net/sched/act_mirred.c
···266266 goto err_cant_do;267267 }268268269269- /* we could easily avoid the clone only if called by ingress and clsact;270270- * since we can't easily detect the clsact caller, skip clone only for271271- * ingress - that covers the TC S/W datapath.272272- */273273- at_ingress = skb_at_tc_ingress(skb);274274- dont_clone = skb_at_tc_ingress(skb) && is_redirect &&275275- tcf_mirred_can_reinsert(retval);276276- if (!dont_clone) {277277- skb_to_send = skb_clone(skb, GFP_ATOMIC);278278- if (!skb_to_send)279279- goto err_cant_do;280280- }281281-282269 want_ingress = tcf_mirred_act_wants_ingress(m_eaction);283270271271+ at_ingress = skb_at_tc_ingress(skb);284272 if (dev == skb->dev && want_ingress == at_ingress) {285273 pr_notice_once("tc mirred: Loop (%s:%s --> %s:%s)\n",286274 netdev_name(skb->dev),···276288 netdev_name(dev),277289 want_ingress ? "ingress" : "egress");278290 goto err_cant_do;291291+ }292292+293293+ /* we could easily avoid the clone only if called by ingress and clsact;294294+ * since we can't easily detect the clsact caller, skip clone only for295295+ * ingress - that covers the TC S/W datapath.296296+ */297297+ dont_clone = skb_at_tc_ingress(skb) && is_redirect &&298298+ tcf_mirred_can_reinsert(retval);299299+ if (!dont_clone) {300300+ skb_to_send = skb_clone(skb, GFP_ATOMIC);301301+ if (!skb_to_send)302302+ goto err_cant_do;279303 }280304281305 /* All mirred/redirected skbs should clear previous ct info */
+1-1
net/sched/sch_qfq.c
···1481148114821482 for (i = 0; i < q->clhash.hashsize; i++) {14831483 hlist_for_each_entry(cl, &q->clhash.hash[i], common.hnode) {14841484- if (cl->qdisc->q.qlen > 0)14841484+ if (cl_is_active(cl))14851485 qfq_deactivate_class(q, cl);1486148614871487 qdisc_reset(cl->qdisc);
+3-5
net/unix/af_unix.c
···29042904 unsigned int last_len;29052905 struct unix_sock *u;29062906 int copied = 0;29072907- bool do_cmsg;29082907 int err = 0;29092908 long timeo;29102909 int target;···2929293029302931 u = unix_sk(sk);2931293229322932- do_cmsg = READ_ONCE(u->recvmsg_inq);29332933- if (do_cmsg)29342934- msg->msg_get_inq = 1;29352933redo:29362934 /* Lock the socket to prevent queue disordering29372935 * while sleeps in memcpy_tomsg···3086309030873091 mutex_unlock(&u->iolock);30883092 if (msg) {30933093+ bool do_cmsg = READ_ONCE(u->recvmsg_inq);30943094+30893095 scm_recv_unix(sock, msg, &scm, flags);3090309630913091- if (msg->msg_get_inq && (copied ?: err) >= 0) {30973097+ if ((do_cmsg | msg->msg_get_inq) && (copied ?: err) >= 0) {30923098 msg->msg_inq = READ_ONCE(u->inq_len);30933099 if (do_cmsg)30943100 put_cmsg(msg, SOL_SOCKET, SCM_INQ,
···111111 sub = acpi_get_subsystem_id(ACPI_HANDLE(physdev));112112 if (IS_ERR(sub)) {113113 /* No subsys id in older tas2563 projects. */114114- if (!strncmp(hid, "INT8866", sizeof("INT8866")))114114+ if (!strncmp(hid, "INT8866", sizeof("INT8866"))) {115115+ p->speaker_id = -1;115116 goto end_2563;117117+ }116118 dev_err(p->dev, "Failed to get SUBSYS ID.\n");117119 ret = PTR_ERR(sub);118120 goto err;
+2-15
sound/soc/codecs/pm4125.c
···15051505 struct device_link *devlink;15061506 int ret;1507150715081508- /* Initialize device pointers to NULL for safe cleanup */15091509- pm4125->rxdev = NULL;15101510- pm4125->txdev = NULL;15111511-15121508 /* Give the soundwire subdevices some more time to settle */15131509 usleep_range(15000, 15010);15141510···1533153715341538 pm4125->sdw_priv[AIF1_CAP] = dev_get_drvdata(pm4125->txdev);15351539 pm4125->sdw_priv[AIF1_CAP]->pm4125 = pm4125;15361536-15371540 pm4125->tx_sdw_dev = dev_to_sdw_dev(pm4125->txdev);15381538- if (!pm4125->tx_sdw_dev) {15391539- dev_err(dev, "could not get txslave with matching of dev\n");15401540- ret = -EINVAL;15411541- goto error_put_tx;15421542- }1543154115441542 /*15451543 * As TX is the main CSR reg interface, which should not be suspended first.···16141624 device_link_remove(dev, pm4125->rxdev);16151625 device_link_remove(pm4125->rxdev, pm4125->txdev);1616162616171617- /* Release device references acquired in bind */16181618- if (pm4125->txdev)16191619- put_device(pm4125->txdev);16201620- if (pm4125->rxdev)16211621- put_device(pm4125->rxdev);16271627+ put_device(pm4125->txdev);16281628+ put_device(pm4125->rxdev);1622162916231630 component_unbind_all(dev, pm4125);16241631}
-5
sound/soc/codecs/wcd937x.c
···27632763 wcd937x->sdw_priv[AIF1_CAP] = dev_get_drvdata(wcd937x->txdev);27642764 wcd937x->sdw_priv[AIF1_CAP]->wcd937x = wcd937x;27652765 wcd937x->tx_sdw_dev = dev_to_sdw_dev(wcd937x->txdev);27662766- if (!wcd937x->tx_sdw_dev) {27672767- dev_err(dev, "could not get txslave with matching of dev\n");27682768- ret = -EINVAL;27692769- goto err_put_txdev;27702770- }2771276627722767 /*27732768 * As TX is the main CSR reg interface, which should not be suspended first.
···502502/* vendor-specific groups and attributes for system fd */503503#define KVM_X86_GRP_SEV 1504504# define KVM_X86_SEV_VMSA_FEATURES 0505505+# define KVM_X86_SNP_POLICY_BITS 1505506506507struct kvm_vmx_nested_state_data {507508 __u8 vmcs12[KVM_STATE_NESTED_VMX_VMCS_SIZE];
+4-2
tools/build/Makefile.feature
···9999 libzstd \100100 disassembler-four-args \101101 disassembler-init-styled \102102- file-handle102102+ file-handle \103103+ libopenssl103104104105# FEATURE_TESTS_BASIC + FEATURE_TESTS_EXTRA is the complete list105106# of all feature tests···148147 lzma \149148 bpf \150149 libaio \151151- libzstd150150+ libzstd \151151+ libopenssl152152153153#154154# Declare group members of a feature to display the logical OR of the detection
···857857__SYSCALL(__NR_file_getattr, sys_file_getattr)858858#define __NR_file_setattr 469859859__SYSCALL(__NR_file_setattr, sys_file_setattr)860860+#define __NR_listns 470861861+__SYSCALL(__NR_listns, sys_listns)860862861863#undef __NR_syscalls862862-#define __NR_syscalls 470864864+#define __NR_syscalls 471863865864866/*865867 * 32 bit systems traditionally used different
+15
tools/include/uapi/drm/drm.h
···906906 */907907#define DRM_CLIENT_CAP_CURSOR_PLANE_HOTSPOT 6908908909909+/**910910+ * DRM_CLIENT_CAP_PLANE_COLOR_PIPELINE911911+ *912912+ * If set to 1 the DRM core will allow setting the COLOR_PIPELINE913913+ * property on a &drm_plane, as well as drm_colorop properties.914914+ *915915+ * Setting of these plane properties will be rejected when this client916916+ * cap is set:917917+ * - COLOR_ENCODING918918+ * - COLOR_RANGE919919+ *920920+ * The client must enable &DRM_CLIENT_CAP_ATOMIC first.921921+ */922922+#define DRM_CLIENT_CAP_PLANE_COLOR_PIPELINE 7923923+909924/* DRM_IOCTL_SET_CLIENT_CAP ioctl argument type */910925struct drm_set_client_cap {911926 __u64 capability;
···701701 endif702702endif703703704704+ifeq ($(feature-libopenssl), 1)705705+ $(call detected,CONFIG_LIBOPENSSL)706706+ CFLAGS += -DHAVE_LIBOPENSSL_SUPPORT707707+endif708708+704709ifndef BUILD_BPF_SKEL705710 # BPF skeletons control a large number of perf features, by default706711 # they are enabled.···721716 BUILD_BPF_SKEL := 0722717 else ifeq ($(filter -DHAVE_LIBBPF_SUPPORT, $(CFLAGS)),)723718 $(warning Warning: Disabled BPF skeletons as libbpf is required)719719+ BUILD_BPF_SKEL := 0720720+ else ifeq ($(filter -DHAVE_LIBOPENSSL_SUPPORT, $(CFLAGS)),)721721+ $(warning Warning: Disabled BPF skeletons as libopenssl is required)724722 BUILD_BPF_SKEL := 0725723 else ifeq ($(call get-executable,$(CLANG)),)726724 $(warning Warning: Disabled BPF skeletons as clang ($(CLANG)) is missing)
+1
tools/perf/arch/arm/entry/syscalls/syscall.tbl
···484484467 common open_tree_attr sys_open_tree_attr485485468 common file_getattr sys_file_getattr486486469 common file_setattr sys_file_setattr487487+470 common listns sys_listns
···560560467 common open_tree_attr sys_open_tree_attr561561468 common file_getattr sys_file_getattr562562469 common file_setattr sys_file_setattr563563+470 common listns sys_listns
+1
tools/perf/arch/s390/entry/syscalls/syscall.tbl
···472472467 common open_tree_attr sys_open_tree_attr sys_open_tree_attr473473468 common file_getattr sys_file_getattr sys_file_getattr474474469 common file_setattr sys_file_setattr sys_file_setattr475475+470 common listns sys_listns sys_listns
+1
tools/perf/arch/sh/entry/syscalls/syscall.tbl
···473473467 common open_tree_attr sys_open_tree_attr474474468 common file_getattr sys_file_getattr475475469 common file_setattr sys_file_setattr476476+470 common listns sys_listns
+1
tools/perf/arch/sparc/entry/syscalls/syscall.tbl
···515515467 common open_tree_attr sys_open_tree_attr516516468 common file_getattr sys_file_getattr517517469 common file_setattr sys_file_setattr518518+470 common listns sys_listns
···394394467 common open_tree_attr sys_open_tree_attr395395468 common file_getattr sys_file_getattr396396469 common file_setattr sys_file_setattr397397+470 common listns sys_listns397398398399#399400# Due to a historical design error, certain syscalls are numbered differently
+1
tools/perf/arch/xtensa/entry/syscalls/syscall.tbl
···440440467 common open_tree_attr sys_open_tree_attr441441468 common file_getattr sys_file_getattr442442469 common file_setattr sys_file_setattr443443+470 common listns sys_listns
+4-2
tools/perf/builtin-buildid-cache.c
···276276{277277 char filename[PATH_MAX];278278 struct build_id bid = { .size = 0, };279279+ int err;279280280281 if (!dso__build_id_filename(dso, filename, sizeof(filename), false))281282 return true;282283283283- if (filename__read_build_id(filename, &bid) == -1) {284284- if (errno == ENOENT)284284+ err = filename__read_build_id(filename, &bid);285285+ if (err < 0) {286286+ if (err == -ENOENT)285287 return false;286288287289 pr_warning("Problems with %s file, consider removing it from the cache\n",
+1-1
tools/perf/tests/shell/kvm.sh
···118118 skip "/dev/kvm not accessible"119119 fi120120121121- if ! perf kvm stat record -a sleep 0.01 >/dev/null 2>&1; then121121+ if ! perf kvm stat record -o /dev/null -a sleep 0.01 >/dev/null 2>&1; then122122 skip "No permission to record kvm events"123123 fi124124
+1-1
tools/perf/tests/shell/top.sh
···11#!/bin/bash22-# perf top tests22+# perf top tests (exclusive)33# SPDX-License-Identifier: GPL-2.04455set -e
+21-3
tools/perf/trace/beauty/include/linux/socket.h
···3232 * 1003.1g requires sa_family_t and that sa_data is char.3333 */34343535+/* Deprecated for in-kernel use. Use struct sockaddr_unsized instead. */3536struct sockaddr {3637 sa_family_t sa_family; /* address family, AF_xxx */3738 char sa_data[14]; /* 14 bytes of protocol address */3939+};4040+4141+/**4242+ * struct sockaddr_unsized - Unspecified size sockaddr for callbacks4343+ * @sa_family: Address family (AF_UNIX, AF_INET, AF_INET6, etc.)4444+ * @sa_data: Flexible array for address data4545+ *4646+ * This structure is designed for callback interfaces where the4747+ * total size is known via the sockaddr_len parameter. Unlike struct4848+ * sockaddr which has a fixed 14-byte sa_data limit or struct4949+ * sockaddr_storage which has a fixed 128-byte sa_data limit, this5050+ * structure can accommodate addresses of any size, but must be used5151+ * carefully.5252+ */5353+struct sockaddr_unsized {5454+ __kernel_sa_family_t sa_family; /* address family, AF_xxx */5555+ char sa_data[]; /* flexible address data */3856};39574058struct linger {···468450 int addrlen);469451extern int __sys_listen(int fd, int backlog);470452extern int __sys_listen_socket(struct socket *sock, int backlog);453453+extern int do_getsockname(struct socket *sock, int peer,454454+ struct sockaddr __user *usockaddr, int __user *usockaddr_len);471455extern int __sys_getsockname(int fd, struct sockaddr __user *usockaddr,472472- int __user *usockaddr_len);473473-extern int __sys_getpeername(int fd, struct sockaddr __user *usockaddr,474474- int __user *usockaddr_len);456456+ int __user *usockaddr_len, int peer);475457extern int __sys_socketpair(int family, int type, int protocol,476458 int __user *usockvec);477459extern int __sys_shutdown_sock(struct socket *sock, int how);
···426426427427 if (!filename)428428 return -EFAULT;429429+430430+ errno = 0;429431 if (!is_regular_file(filename))430430- return -EWOULDBLOCK;432432+ return errno == 0 ? -EWOULDBLOCK : -errno;431433432434 fd = open(filename, O_RDONLY);433435 if (fd < 0)
+3-1
tools/perf/util/symbol-elf.c
···902902903903 if (!filename)904904 return -EFAULT;905905+906906+ errno = 0;905907 if (!is_regular_file(filename))906906- return -EWOULDBLOCK;908908+ return errno == 0 ? -EWOULDBLOCK : -errno;907909908910 err = kmod_path__parse(&m, filename);909911 if (err)
+3-1
tools/perf/util/symbol-minimal.c
···104104105105 if (!filename)106106 return -EFAULT;107107+108108+ errno = 0;107109 if (!is_regular_file(filename))108108- return -EWOULDBLOCK;110110+ return errno == 0 ? -EWOULDBLOCK : -errno;109111110112 fd = open(filename, O_RDONLY);111113 if (fd < 0)
+1
tools/scripts/syscall.tbl
···410410467 common open_tree_attr sys_open_tree_attr411411468 common file_getattr sys_file_getattr412412469 common file_setattr sys_file_setattr413413+470 common listns sys_listns
···5252 ip netns del nssv5353}54545555+is_carrier_up()5656+{5757+ local netns="$1"5858+ local nsim_dev="$2"5959+6060+ test "$(ip netns exec "$netns" \6161+ cat /sys/class/net/"$nsim_dev"/carrier 2>/dev/null)" -eq 16262+}6363+6464+assert_carrier_up()6565+{6666+ local netns="$1"6767+ local nsim_dev="$2"6868+6969+ if ! is_carrier_up "$netns" "$nsim_dev"; then7070+ echo "$nsim_dev's carrier should be UP, but it isn't"7171+ cleanup_ns7272+ exit 17373+ fi7474+}7575+7676+assert_carrier_down()7777+{7878+ local netns="$1"7979+ local nsim_dev="$2"8080+8181+ if is_carrier_up "$netns" "$nsim_dev"; then8282+ echo "$nsim_dev's carrier should be DOWN, but it isn't"8383+ cleanup_ns8484+ exit 18585+ fi8686+}8787+5588###5689### Code start5790###···145112 cleanup_ns146113 exit 1147114fi115115+116116+# netdevsim carrier state consistency checking117117+assert_carrier_up nssv "$NSIM_DEV_1_NAME"118118+assert_carrier_up nscl "$NSIM_DEV_2_NAME"119119+120120+echo "$NSIM_DEV_1_FD:$NSIM_DEV_1_IFIDX" > "$NSIM_DEV_SYS_UNLINK"121121+122122+assert_carrier_down nssv "$NSIM_DEV_1_NAME"123123+assert_carrier_down nscl "$NSIM_DEV_2_NAME"124124+125125+ip netns exec nssv ip link set dev "$NSIM_DEV_1_NAME" down126126+ip netns exec nssv ip link set dev "$NSIM_DEV_1_NAME" up127127+128128+assert_carrier_down nssv "$NSIM_DEV_1_NAME"129129+assert_carrier_down nscl "$NSIM_DEV_2_NAME"130130+131131+echo "$NSIM_DEV_1_FD:$NSIM_DEV_1_IFIDX $NSIM_DEV_2_FD:$NSIM_DEV_2_IFIDX" > $NSIM_DEV_SYS_LINK132132+133133+assert_carrier_up nssv "$NSIM_DEV_1_NAME"134134+assert_carrier_up nscl "$NSIM_DEV_2_NAME"135135+136136+ip netns exec nssv ip link set dev "$NSIM_DEV_1_NAME" down137137+ip netns exec nssv ip link set dev "$NSIM_DEV_1_NAME" up138138+139139+assert_carrier_up nssv "$NSIM_DEV_1_NAME"140140+assert_carrier_up nscl "$NSIM_DEV_2_NAME"148141149142# send/recv packets150143
···9090 fail "Tracing is not off"9191fi92929393-csum1=`md5sum trace`9393+# Cannot rely on names being around as they are only cached, strip them9494+csum1=`cat trace | sed -e 's/^ *[^ ]*\(-[0-9][0-9]*\)/\1/' | md5sum`9495sleep $SLEEP_TIME9595-csum2=`md5sum trace`9696+csum2=`cat trace | sed -e 's/^ *[^ ]*\(-[0-9][0-9]*\)/\1/' | md5sum`96979798if [ "$csum1" != "$csum2" ]; then9899 fail "Tracing file is still changing"
···55# Copyright (c) 2017 Benjamin Tissoires <benjamin.tissoires@gmail.com>66# Copyright (c) 2017 Red Hat, Inc.7788+from packaging.version import Version89import platform910import pytest1011import re···1312import subprocess1413from .base import HIDTestUdevRule1514from pathlib import Path1515+1616+1717+@pytest.fixture(autouse=True)1818+def hidtools_version_check():1919+ HIDTOOLS_VERSION = "0.12"2020+ try:2121+ import hidtools2222+2323+ version = hidtools.__version__ # type: ignore2424+ if Version(version) < Version(HIDTOOLS_VERSION):2525+ pytest.skip(reason=f"have hidtools {version}, require >={HIDTOOLS_VERSION}")2626+ except Exception:2727+ pytest.skip(reason=f"hidtools >={HIDTOOLS_VERSION} required")162817291830# See the comment in HIDTestUdevRule, this doesn't set up but it will clean
···2929 net6_port_net6_port net_port_mac_proto_net"30303131# Reported bugs, also described by TYPE_ variables below3232-BUGS="flush_remove_add reload net_port_proto_match avx2_mismatch doublecreate"3232+BUGS="flush_remove_add reload net_port_proto_match avx2_mismatch doublecreate insert_overlap"33333434# List of possible paths to pktgen script from kernel tree for performance tests3535PKTGEN_SCRIPT_PATHS="···410410411411TYPE_doublecreate="412412display cannot create same element twice413413+type_spec ipv4_addr . ipv4_addr414414+chain_spec ip saddr . ip daddr415415+dst addr4416416+proto icmp417417+418418+race_repeat 0419419+420420+perf_duration 0421421+"422422+423423+TYPE_insert_overlap="424424+display reject overlapping range on add413425type_spec ipv4_addr . ipv4_addr414426chain_spec ip saddr . ip daddr415427dst addr4···19621950 err "Could not flush and re-create element in one transaction"19631951 return 119641952 fi19531953+19541954+ return 019551955+}19561956+19571957+add_fail()19581958+{19591959+ if nft add element inet filter test "$1" 2>/dev/null ; then19601960+ err "Returned success for add ${1} given set:"19611961+ err "$(nft -a list set inet filter test )"19621962+ return 119631963+ fi19641964+19651965+ return 019661966+}19671967+19681968+test_bug_insert_overlap()19691969+{19701970+ local elements="1.2.3.4 . 1.2.4.1"19711971+19721972+ setup veth send_"${proto}" set || return ${ksft_skip}19731973+19741974+ add "{ $elements }" || return 119751975+19761976+ elements="1.2.3.0-1.2.3.4 . 1.2.4.1"19771977+ add_fail "{ $elements }" || return 119781978+19791979+ elements="1.2.3.0-1.2.3.4 . 1.2.4.2"19801980+ add "{ $elements }" || return 119811981+19821982+ elements="1.2.3.4 . 1.2.4.1-1.2.4.2"19831983+ add_fail "{ $elements }" || return 11965198419661985 return 019671986}
···178178_create_ublk_dev() {179179 local dev_id;180180 local cmd=$1181181+ local settle=$2181182182182- shift 1183183+ shift 2183184184185 if [ ! -c /dev/ublk-control ]; then185186 return ${UBLK_SKIP_CODE}···195194 echo "fail to add ublk dev $*"196195 return 255197196 fi198198- udevadm settle197197+198198+ if [ "$settle" = "yes" ]; then199199+ udevadm settle200200+ fi199201200202 if [[ "$dev_id" =~ ^[0-9]+$ ]]; then201203 echo "${dev_id}"···208204}209205210206_add_ublk_dev() {211211- _create_ublk_dev "add" "$@"207207+ _create_ublk_dev "add" "yes" "$@"208208+}209209+210210+_add_ublk_dev_no_settle() {211211+ _create_ublk_dev "add" "no" "$@"212212}213213214214_recover_ublk_dev() {215215 local dev_id216216 local state217217218218- dev_id=$(_create_ublk_dev "recover" "$@")218218+ dev_id=$(_create_ublk_dev "recover" "yes" "$@")219219 for ((j=0;j<20;j++)); do220220 state=$(_get_ublk_dev_state "${dev_id}")221221 [ "$state" == "LIVE" ] && break
+68
tools/testing/selftests/ublk/test_generic_15.sh
···11+#!/bin/bash22+# SPDX-License-Identifier: GPL-2.033+44+. "$(cd "$(dirname "$0")" && pwd)"/test_common.sh55+66+TID="generic_15"77+ERR_CODE=088+99+_test_partition_scan_no_hang()1010+{1111+ local recovery_flag=$11212+ local expected_state=$21313+ local dev_id1414+ local state1515+ local daemon_pid1616+ local start_time1717+ local elapsed1818+1919+ # Create ublk device with fault_inject target and very large delay2020+ # to simulate hang during partition table read2121+ # --delay_us 60000000 = 60 seconds delay2222+ # Use _add_ublk_dev_no_settle to avoid udevadm settle hang waiting2323+ # for partition scan events to complete2424+ if [ "$recovery_flag" = "yes" ]; then2525+ echo "Testing partition scan with recovery support..."2626+ dev_id=$(_add_ublk_dev_no_settle -t fault_inject -q 1 -d 1 --delay_us 60000000 -r 1)2727+ else2828+ echo "Testing partition scan without recovery..."2929+ dev_id=$(_add_ublk_dev_no_settle -t fault_inject -q 1 -d 1 --delay_us 60000000)3030+ fi3131+3232+ _check_add_dev "$TID" $?3333+3434+ # The add command should return quickly because partition scan is async.3535+ # Now sleep briefly to let the async partition scan work start and hit3636+ # the delay in the fault_inject handler.3737+ sleep 13838+3939+ # Kill the ublk daemon while partition scan is potentially blocked4040+ # And check state transitions properly4141+ start_time=${SECONDS}4242+ daemon_pid=$(_get_ublk_daemon_pid "${dev_id}")4343+ state=$(__ublk_kill_daemon "${dev_id}" "${expected_state}")4444+ elapsed=$((SECONDS - start_time))4545+4646+ # Verify the device transitioned to expected state4747+ if [ "$state" != "${expected_state}" ]; then4848+ echo "FAIL: Device state is $state, expected ${expected_state}"4949+ ERR_CODE=2555050+ ${UBLK_PROG} del -n "${dev_id}" > /dev/null 2>&15151+ return5252+ fi5353+ echo "PASS: Device transitioned to ${expected_state} in ${elapsed}s without hanging"5454+5555+ # Clean up the device5656+ ${UBLK_PROG} del -n "${dev_id}" > /dev/null 2>&15757+}5858+5959+_prep_test "partition_scan" "verify async partition scan prevents IO hang"6060+6161+# Test 1: Without recovery support - should transition to DEAD6262+_test_partition_scan_no_hang "no" "DEAD"6363+6464+# Test 2: With recovery support - should transition to QUIESCED6565+_test_partition_scan_no_hang "yes" "QUIESCED"6666+6767+_cleanup_test "partition_scan"6868+_show_result $TID $ERR_CODE