Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   1) /* SPDX-License-Identifier: GPL-2.0 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3)  * Traceprobe fetch helper inlines
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6) static nokprobe_inline void
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7) fetch_store_raw(unsigned long val, struct fetch_insn *code, void *buf)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9) 	switch (code->size) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10) 	case 1:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11) 		*(u8 *)buf = (u8)val;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12) 		break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13) 	case 2:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14) 		*(u16 *)buf = (u16)val;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15) 		break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16) 	case 4:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17) 		*(u32 *)buf = (u32)val;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18) 		break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19) 	case 8:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20) 		//TBD: 32bit signed
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21) 		*(u64 *)buf = (u64)val;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22) 		break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23) 	default:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24) 		*(unsigned long *)buf = val;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28) static nokprobe_inline void
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29) fetch_apply_bitfield(struct fetch_insn *code, void *buf)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31) 	switch (code->basesize) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32) 	case 1:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33) 		*(u8 *)buf <<= code->lshift;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34) 		*(u8 *)buf >>= code->rshift;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35) 		break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36) 	case 2:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37) 		*(u16 *)buf <<= code->lshift;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) 		*(u16 *)buf >>= code->rshift;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39) 		break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40) 	case 4:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41) 		*(u32 *)buf <<= code->lshift;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) 		*(u32 *)buf >>= code->rshift;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) 		break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) 	case 8:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) 		*(u64 *)buf <<= code->lshift;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) 		*(u64 *)buf >>= code->rshift;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) 		break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52)  * These functions must be defined for each callsite.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53)  * Return consumed dynamic data size (>= 0), or error (< 0).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54)  * If dest is NULL, don't store result and return required dynamic data size.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) static int
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) process_fetch_insn(struct fetch_insn *code, struct pt_regs *regs,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) 		   void *dest, void *base);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) static nokprobe_inline int fetch_store_strlen(unsigned long addr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) static nokprobe_inline int
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) fetch_store_string(unsigned long addr, void *dest, void *base);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) static nokprobe_inline int fetch_store_strlen_user(unsigned long addr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) static nokprobe_inline int
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) fetch_store_string_user(unsigned long addr, void *dest, void *base);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) static nokprobe_inline int
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) probe_mem_read(void *dest, void *src, size_t size);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) static nokprobe_inline int
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) probe_mem_read_user(void *dest, void *src, size_t size);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) /* From the 2nd stage, routine is same */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) static nokprobe_inline int
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) process_fetch_insn_bottom(struct fetch_insn *code, unsigned long val,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) 			   void *dest, void *base)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) 	struct fetch_insn *s3 = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) 	int total = 0, ret = 0, i = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) 	u32 loc = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) 	unsigned long lval = val;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) stage2:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) 	/* 2nd stage: dereference memory if needed */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) 	do {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) 		if (code->op == FETCH_OP_DEREF) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) 			lval = val;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) 			ret = probe_mem_read(&val, (void *)val + code->offset,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) 					     sizeof(val));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) 		} else if (code->op == FETCH_OP_UDEREF) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) 			lval = val;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) 			ret = probe_mem_read_user(&val,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) 				 (void *)val + code->offset, sizeof(val));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) 		} else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) 			break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) 		if (ret)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) 			return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) 		code++;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) 	} while (1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) 	s3 = code;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) stage3:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) 	/* 3rd stage: store value to buffer */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) 	if (unlikely(!dest)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) 		if (code->op == FETCH_OP_ST_STRING) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) 			ret = fetch_store_strlen(val + code->offset);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) 			code++;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) 			goto array;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) 		} else if (code->op == FETCH_OP_ST_USTRING) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) 			ret += fetch_store_strlen_user(val + code->offset);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) 			code++;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) 			goto array;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) 		} else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) 			return -EILSEQ;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) 	switch (code->op) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) 	case FETCH_OP_ST_RAW:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) 		fetch_store_raw(val, code, dest);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) 		break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) 	case FETCH_OP_ST_MEM:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) 		probe_mem_read(dest, (void *)val + code->offset, code->size);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) 		break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) 	case FETCH_OP_ST_UMEM:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) 		probe_mem_read_user(dest, (void *)val + code->offset, code->size);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) 		break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) 	case FETCH_OP_ST_STRING:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) 		loc = *(u32 *)dest;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) 		ret = fetch_store_string(val + code->offset, dest, base);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) 		break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) 	case FETCH_OP_ST_USTRING:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) 		loc = *(u32 *)dest;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) 		ret = fetch_store_string_user(val + code->offset, dest, base);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) 		break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) 	default:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) 		return -EILSEQ;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) 	code++;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) 	/* 4th stage: modify stored value if needed */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) 	if (code->op == FETCH_OP_MOD_BF) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) 		fetch_apply_bitfield(code, dest);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) 		code++;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) array:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) 	/* the last stage: Loop on array */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) 	if (code->op == FETCH_OP_LP_ARRAY) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) 		total += ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) 		if (++i < code->param) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) 			code = s3;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) 			if (s3->op != FETCH_OP_ST_STRING &&
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) 			    s3->op != FETCH_OP_ST_USTRING) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) 				dest += s3->size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) 				val += s3->size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) 				goto stage3;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) 			}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) 			code--;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) 			val = lval + sizeof(char *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) 			if (dest) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) 				dest += sizeof(u32);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) 				*(u32 *)dest = update_data_loc(loc, ret);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) 			}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) 			goto stage2;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) 		code++;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) 		ret = total;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) 	return code->op == FETCH_OP_END ? ret : -EILSEQ;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) /* Sum up total data length for dynamic arraies (strings) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) static nokprobe_inline int
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) __get_data_size(struct trace_probe *tp, struct pt_regs *regs)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) 	struct probe_arg *arg;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) 	int i, len, ret = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) 	for (i = 0; i < tp->nr_args; i++) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) 		arg = tp->args + i;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) 		if (unlikely(arg->dynamic)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) 			len = process_fetch_insn(arg->code, regs, NULL, NULL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) 			if (len > 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) 				ret += len;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) 	return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) /* Store the value of each argument */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) static nokprobe_inline void
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) store_trace_args(void *data, struct trace_probe *tp, struct pt_regs *regs,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) 		 int header_size, int maxlen)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) 	struct probe_arg *arg;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) 	void *base = data - header_size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) 	void *dyndata = data + tp->size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) 	u32 *dl;	/* Data location */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) 	int ret, i;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) 	for (i = 0; i < tp->nr_args; i++) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) 		arg = tp->args + i;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) 		dl = data + arg->offset;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) 		/* Point the dynamic data area if needed */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) 		if (unlikely(arg->dynamic))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) 			*dl = make_data_loc(maxlen, dyndata - base);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) 		ret = process_fetch_insn(arg->code, regs, dl, base);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) 		if (unlikely(ret < 0 && arg->dynamic)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) 			*dl = make_data_loc(0, dyndata - base);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) 		} else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) 			dyndata += ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) 			maxlen -= ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) static inline int
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) print_probe_args(struct trace_seq *s, struct probe_arg *args, int nr_args,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) 		 u8 *data, void *field)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) 	void *p;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) 	int i, j;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) 	for (i = 0; i < nr_args; i++) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) 		struct probe_arg *a = args + i;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) 		trace_seq_printf(s, " %s=", a->name);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) 		if (likely(!a->count)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) 			if (!a->type->print(s, data + a->offset, field))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) 				return -ENOMEM;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) 			continue;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) 		trace_seq_putc(s, '{');
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) 		p = data + a->offset;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) 		for (j = 0; j < a->count; j++) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) 			if (!a->type->print(s, p, field))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) 				return -ENOMEM;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) 			trace_seq_putc(s, j == a->count - 1 ? '}' : ',');
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) 			p += a->type->size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) }