From patchwork Sat Dec 21 01:23:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ihor Solodrai X-Patchwork-Id: 13917575 Received: from mail-4322.protonmail.ch (mail-4322.protonmail.ch [185.70.43.22]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A80651096F; Sat, 21 Dec 2024 01:23:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.70.43.22 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734744210; cv=none; b=OR6osP9BQEyY5gowv870Wnq8dEK6IzVtLuckU1DuOw3IoiQEJg/9EX3TdFI3wvmqeXxPry4FjFPCVqQK0W01fT/LrnvAXPQAjEMyFtL4Wz/xh5g4suO6YgFDLD4571Oqdsyazo6QU5wQlQXPtnX1+BBP6tnGL7H4lzhK7ErXCgM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734744210; c=relaxed/simple; bh=tvjV7TJKCR7TqQVVHq/jb2EAlkRr16DgKRJp+LHctxA=; h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=VfYZqjb2K6DveRXG1Qx2Xoz2byacddqTCsoiUQJ3tXdDD654OHFuOJsRdpXGNUtqBe4kKF7yYz2TjGO/7k26Xo1739mDQCkaGdEiI8cF7IgFysQsd8l2fQjzcTN9JWPjA/C62TXFA7eLb77JRj9mxgPeuY2etQnT3DWtj1ilzuI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=pm.me; spf=pass smtp.mailfrom=pm.me; dkim=pass (2048-bit key) header.d=pm.me header.i=@pm.me header.b=mRgw+txn; arc=none smtp.client-ip=185.70.43.22 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=pm.me Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pm.me Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=pm.me header.i=@pm.me header.b="mRgw+txn" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pm.me; s=protonmail3; t=1734744206; x=1735003406; bh=5/xuxSQ+gCJi0lxyRPP3+7mgc1ZFRb6x6NXjVLZJPJ0=; h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References: Feedback-ID:From:To:Cc:Date:Subject:Reply-To:Feedback-ID: Message-ID:BIMI-Selector:List-Unsubscribe:List-Unsubscribe-Post; b=mRgw+txn2TKTKokcs5gtL4W8s/VybBOr6TepBaJwO2QLYBHPPX+RNA906EDOub5KG 30moMO+HNeQF9k0LCUFCmoZ385v+dlOnippQIHUUPWbrudpcUo+WyX8j9AxwJ2dA+C 701XR2dN8ePseJ7DztnwzxgEK3xVWgXG7MyiEHUuAgiWRhzh9ECy/x1p4XNA5G2Fnf QBXAwXbsgo7Zd6tD7SRHN82H0ilQPVd0TSqT49LZlIpTNKLL7PnZYuCSTpnSmWy9Gj jQGrTakvexRbA5zfBOVxM2sSxbm4R7Y7UAGs7iOz29NajzeSVxh1GizvlftXkATHJt OBQ8S7QHWmO1Q== Date: Sat, 21 Dec 2024 01:23:23 +0000 To: dwarves@vger.kernel.org From: Ihor Solodrai Cc: acme@kernel.org, alan.maguire@oracle.com, eddyz87@gmail.com, andrii@kernel.org, mykolal@fb.com, bpf@vger.kernel.org Subject: [PATCH dwarves v3 5/8] btf_encoder: remove skip_encoding_inconsistent_proto Message-ID: <20241221012245.243845-6-ihor.solodrai@pm.me> In-Reply-To: <20241221012245.243845-1-ihor.solodrai@pm.me> References: <20241221012245.243845-1-ihor.solodrai@pm.me> Feedback-ID: 27520582:user:proton X-Pm-Message-ID: 838246001f1f428a320655ec19ce978de073ed7f Precedence: bulk X-Mailing-List: bpf@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 This flag is needed only for btf_encoder__add_saved_funcs(), so there is no reason to keep it in each btf_encoder. Link: https://lore.kernel.org/dwarves/e1df45360963d265ea5e0b3634f0a3dae0c9c343.camel@gmail.com/ Signed-off-by: Ihor Solodrai --- btf_encoder.c | 10 ++++------ btf_encoder.h | 4 ++-- pahole.c | 7 +++++-- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/btf_encoder.c b/btf_encoder.c index 566ecfe..90f1b9a 100644 --- a/btf_encoder.c +++ b/btf_encoder.c @@ -128,7 +128,6 @@ struct btf_encoder { force, gen_floats, skip_encoding_decl_tag, - skip_encoding_inconsistent_proto, tag_kfuncs, gen_distilled_base; uint32_t array_index_id; @@ -1327,7 +1326,7 @@ static void btf_encoder__delete_saved_funcs(struct btf_encoder *encoder) } } -int btf_encoder__add_saved_funcs(struct btf_encoder *encoder) +int btf_encoder__add_saved_funcs(bool skip_encoding_inconsistent_proto) { struct btf_encoder_func_state **saved_fns, *s; struct btf_encoder *e = NULL; @@ -1367,7 +1366,7 @@ int btf_encoder__add_saved_funcs(struct btf_encoder *encoder) * just do not _use_ them. Only exclude functions with * unexpected register use or multiple inconsistent prototypes. */ - if (!encoder->skip_encoding_inconsistent_proto || + if (!skip_encoding_inconsistent_proto || (!state->unexpected_reg && !state->inconsistent_proto)) { if (btf_encoder__add_func(state->encoder, state)) { free(saved_fns); @@ -2129,14 +2128,14 @@ out: return err; } -int btf_encoder__encode(struct btf_encoder *encoder) +int btf_encoder__encode(struct btf_encoder *encoder, struct conf_load *conf) { bool should_tag_kfuncs; int err; size_t shndx; /* for single-threaded case, saved funcs are added here */ - btf_encoder__add_saved_funcs(encoder); + btf_encoder__add_saved_funcs(conf->skip_encoding_btf_inconsistent_proto); for (shndx = 1; shndx < encoder->seccnt; shndx++) if (gobuffer__size(&encoder->secinfo[shndx].secinfo)) @@ -2464,7 +2463,6 @@ struct btf_encoder *btf_encoder__new(struct cu *cu, const char *detached_filenam encoder->force = conf_load->btf_encode_force; encoder->gen_floats = conf_load->btf_gen_floats; encoder->skip_encoding_decl_tag = conf_load->skip_encoding_btf_decl_tag; - encoder->skip_encoding_inconsistent_proto = conf_load->skip_encoding_btf_inconsistent_proto; encoder->tag_kfuncs = conf_load->btf_decl_tag_kfuncs; encoder->gen_distilled_base = conf_load->btf_gen_distilled_base; encoder->verbose = verbose; diff --git a/btf_encoder.h b/btf_encoder.h index 9b26162..b95f2f3 100644 --- a/btf_encoder.h +++ b/btf_encoder.h @@ -26,13 +26,13 @@ enum btf_var_option { struct btf_encoder *btf_encoder__new(struct cu *cu, const char *detached_filename, struct btf *base_btf, bool verbose, struct conf_load *conf_load); void btf_encoder__delete(struct btf_encoder *encoder); -int btf_encoder__encode(struct btf_encoder *encoder); +int btf_encoder__encode(struct btf_encoder *encoder, struct conf_load *conf); int btf_encoder__encode_cu(struct btf_encoder *encoder, struct cu *cu, struct conf_load *conf_load); struct btf *btf_encoder__btf(struct btf_encoder *encoder); int btf_encoder__add_encoder(struct btf_encoder *encoder, struct btf_encoder *other); -int btf_encoder__add_saved_funcs(struct btf_encoder *encoder); +int btf_encoder__add_saved_funcs(bool skip_encoding_inconsistent_proto); #endif /* _BTF_ENCODER_H_ */ diff --git a/pahole.c b/pahole.c index a36b732..37d76b1 100644 --- a/pahole.c +++ b/pahole.c @@ -3185,7 +3185,10 @@ static int pahole_threads_collect(struct conf_load *conf, int nr_threads, void * if (error) goto out; - btf_encoder__add_saved_funcs(btf_encoder); + err = btf_encoder__add_saved_funcs(conf_load.skip_encoding_btf_inconsistent_proto); + if (err < 0) + goto out; + for (i = 0; i < nr_threads; i++) { /* * Merge content of the btf instances of worker threads to the btf @@ -3843,7 +3846,7 @@ try_sole_arg_as_class_names: exit(1); } - err = btf_encoder__encode(btf_encoder); + err = btf_encoder__encode(btf_encoder, &conf_load); btf_encoder__delete(btf_encoder); if (err) { fputs("Failed to encode BTF\n", stderr);