From patchwork Thu Jan 16 17:52:08 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Roger_Pau_Monn=C3=A9?= X-Patchwork-Id: 13942111 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 3AD53C0218C for ; Thu, 16 Jan 2025 17:53:07 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.873678.1284669 (Exim 4.92) (envelope-from ) id 1tYU32-0007Qj-H0; Thu, 16 Jan 2025 17:52:52 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 873678.1284669; Thu, 16 Jan 2025 17:52:52 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1tYU32-0007Qc-EK; Thu, 16 Jan 2025 17:52:52 +0000 Received: by outflank-mailman (input) for mailman id 873678; Thu, 16 Jan 2025 17:52:50 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1tYU30-0007C4-Q9 for xen-devel@lists.xenproject.org; Thu, 16 Jan 2025 17:52:50 +0000 Received: from mail-ed1-x52f.google.com (mail-ed1-x52f.google.com [2a00:1450:4864:20::52f]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id b306d240-d432-11ef-99a4-01e77a169b0f; Thu, 16 Jan 2025 18:52:49 +0100 (CET) Received: by mail-ed1-x52f.google.com with SMTP id 4fb4d7f45d1cf-5d3d143376dso1878477a12.3 for ; Thu, 16 Jan 2025 09:52:49 -0800 (PST) Received: from localhost ([84.78.159.3]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5db73683de7sm243751a12.42.2025.01.16.09.52.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Jan 2025 09:52:47 -0800 (PST) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: b306d240-d432-11ef-99a4-01e77a169b0f DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=citrix.com; s=google; t=1737049968; x=1737654768; darn=lists.xenproject.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=U/uapuiccaTxH7EAPivIv8o3YxFQp/soQ4UJlMTsG9c=; b=O/2JNqElh5xNd+RStDT21xcxV487992pG/yzLw+1TeuPYTfB+1uX+uR0ErhdlfzBpI pL80Vn+Q2n7BbBmySPqcC4+0gUfxd0tLtkEqc7GIa+UylBZWqyGaYeyoihW1XzF0bqeE 0R4GWHrPSOoVZBO0RVd1fsRg59z9zDnx7SY+g= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737049968; x=1737654768; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=U/uapuiccaTxH7EAPivIv8o3YxFQp/soQ4UJlMTsG9c=; b=RolzNYnCqX3nHvY/S31qMbbpTwfYYzwmPTTBz9ZSLOtDpapjGJZz5InSIJaLN91aw4 +B23xvTQ4CA9JKoqnrFGR8KoWpMtKwRATU0ZSxTJjRd0KJfNvpxFMnHNfL0HbdNiK+0r rjXHAmUdudj6YrzaHqyTSMsGSjAO9BvsFqvpFe6EuvNfgqBp49ZJ65VlbqKpKeT8SUGx SVtcnaYullke+ZsIAcKJLh5udTnc/yKOSS01a6UJ3LJm5vYaw7R89Zf7Nknp28A/8k6X Yv1dL1WYRNmiEz4LMH+RhXbbdsh2ly4czs+kuTzf7lE6w0MyZOYqNiC9Xmec9yOsFBLv mz5w== X-Gm-Message-State: AOJu0YwFCZ0hVS55RLHMtjwmXMn7mYq66kUqR110eal0x2z68NssQPch 5UMnxHUzthnteDKeHrShRgGsOHIbm8kgXxlR60NiIs/1nhqrricR07bTlW8xvw//YzevIhrb3eE u X-Gm-Gg: ASbGncsG399MMxdUpraho/Zxjk+uy/FbpuJA7TDI7lLd5O2GbyBhbwIIPvM0fbsSSp1 P1wEEhuZlV7LFHtD2Or7Iti5XMerKt51Q3DPWSr27GVxVvWcNaLJ9V9eGA5j7ZQoJBocaqEUYo4 8Klyax8rkqQAviVE89KCgUaSPFKJYUCgH+4NZWpTF+aZ1ofxUlvv9N9jOYRt8kpdkKjHKyTUxKQ wSRV2uNF+g8fVEEIN3xkxaKZNI+1OJ2hEEtf4YD/XLzKxD1/tnun+i3kw4Tfw== X-Google-Smtp-Source: AGHT+IGeIm8rBfa4224KwZC18X4+hgNPmw3wjFS1KC8gS4AtREa/j5SkB6WcvVr/HvK0A4HLRZN3Kg== X-Received: by 2002:a05:6402:40d5:b0:5d9:f21e:ff5 with SMTP id 4fb4d7f45d1cf-5d9f21e18a0mr13175025a12.16.1737049968140; Thu, 16 Jan 2025 09:52:48 -0800 (PST) From: Roger Pau Monne To: xen-devel@lists.xenproject.org Cc: konrad.wilk@oracle.com, ross.lagerwall@citrix.com, Artem Savkov , =?utf-8?q?Roger_Pau_Monn=C3=A9?= Subject: [PATCH 1/7] create-diff-object: ignore .cold.* suffixes in is_bundleable() Date: Thu, 16 Jan 2025 18:52:08 +0100 Message-ID: <20250116175214.83742-2-roger.pau@citrix.com> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20250116175214.83742-1-roger.pau@citrix.com> References: <20250116175214.83742-1-roger.pau@citrix.com> MIME-Version: 1.0 From: Artem Savkov While building a gcc-consprop patch from integration tests gcc8 would place a __timekeeping_inject_sleeptime.constprop.18.cold.27 symbol into .text.unlikely.__timekeeping_inject_sleeptime.constprop.18 section. Because section name doesn't have the '.cold.27' suffix this symbol fails is_bundleable() check while still being bundleable and later exits early in kpatch_rename_mangled_functions() without renaming the corresponding patched function. All of this results in a create-diff-object errror: ERROR: timekeeping.o: symbol changed sections: __timekeeping_inject_sleeptime.constprop.18.cold.27 /home/asavkov/dev/kpatch/kpatch-build/create-diff-object: unreconcilable difference Fix by ignoring .cold.* name suffix in is_bundleable() for.text.unlikely sections. Signed-off-by: Artem Savkov Signed-off-by: Roger Pau Monné --- common.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/common.c b/common.c index 68a71f75ac7b..84ca14d3e397 100644 --- a/common.c +++ b/common.c @@ -126,7 +126,9 @@ static int is_bundleable(struct symbol *sym) if (sym->type == STT_FUNC && !strncmp(sym->sec->name, ".text.unlikely.",15) && - !strcmp(sym->sec->name + 15, sym->name)) + (!strcmp(sym->sec->name + 15, sym->name) || + (strstr(sym->name, ".cold.") && + !strncmp(sym->sec->name + 15, sym->name, strlen(sym->sec->name) - 15)))) return 1; if (sym->type == STT_OBJECT && From patchwork Thu Jan 16 17:52:09 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Roger_Pau_Monn=C3=A9?= X-Patchwork-Id: 13942105 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 18748C02183 for ; Thu, 16 Jan 2025 17:53:04 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.873679.1284679 (Exim 4.92) (envelope-from ) id 1tYU33-0007f9-Ow; Thu, 16 Jan 2025 17:52:53 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 873679.1284679; Thu, 16 Jan 2025 17:52:53 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1tYU33-0007f0-LO; Thu, 16 Jan 2025 17:52:53 +0000 Received: by outflank-mailman (input) for mailman id 873679; Thu, 16 Jan 2025 17:52:51 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1tYU31-0007CP-Ky for xen-devel@lists.xenproject.org; Thu, 16 Jan 2025 17:52:51 +0000 Received: from mail-ej1-x629.google.com (mail-ej1-x629.google.com [2a00:1450:4864:20::629]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id b3bf4873-d432-11ef-a0e2-8be0dac302b0; Thu, 16 Jan 2025 18:52:50 +0100 (CET) Received: by mail-ej1-x629.google.com with SMTP id a640c23a62f3a-aaecf50578eso271479166b.2 for ; Thu, 16 Jan 2025 09:52:50 -0800 (PST) Received: from localhost ([84.78.159.3]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-ab384c57034sm27787866b.34.2025.01.16.09.52.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Jan 2025 09:52:48 -0800 (PST) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: b3bf4873-d432-11ef-a0e2-8be0dac302b0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=citrix.com; s=google; t=1737049969; x=1737654769; darn=lists.xenproject.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=FuFvwoczQ0Dt1tA24xhRPUnmiSMeJ5zfD1PkZdC+rZ4=; b=TCfaB8BNMNubLNnPXbD6bMbfmJI/c3o/xtaHojwA3oSy3bNnaO1qwi/Z/rIyF+9Juu ycwe9rTGtRxJM6raqjYo9P2OHA3n93PAfpvKNvHdEX5EEIh9ohaM6LhsRB5t1ArKjFTj X9OMXDdgTineOjogMRw5wYwfOuKnIMJsfMI8s= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737049969; x=1737654769; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=FuFvwoczQ0Dt1tA24xhRPUnmiSMeJ5zfD1PkZdC+rZ4=; b=wWcWF7QEHDwtLGNnqbPakYIp7nORGssd64HmW4nxKaZHZeYgaDN6or9CYUkGe83yEj zU2hbz5Uj0P+YWGYnqSjaCEqESimjFklZpVdsR3ektXOmptBksZNCggHU2krt/mJa91v lubdJboXjjCsUevEOmWowoGsJ5lFuBu2C0a1WRRdWN3aZsiL5lr/7XQn5JcXBYadTzGY cnnvjl6L/R/mZLXi+Rzqi2Gec6tVB6VrdprwwDgxpMhPfpR7vO9VjcxLAtgOjspnY/nO HRQyw26VQ8kl+bCSjUYNrxW66QG7slOVnZOQtZVy0xpABaUDa8B1EGqdo/iG7ygUJuGW LfCQ== X-Gm-Message-State: AOJu0YxiDsnklJLQlaoHGXaNk3nMLi+jsuEFcEUvZ8iNut/GztWfk5r0 jmSmhyFMgeB/Tf5ZSDlSSe2HEw/o/a3OAL7q59nAVmRmqehSHT9baOq//5phOTNhGbSn+NUTBA+ 6 X-Gm-Gg: ASbGncudV+qYdLiy2TE0olpWQ0kKNWnhZtJlWumlaDDfHfIV+jtEooEnkJl+x53o8yP jA5OWKu/9UUTYbJDpeJfYOiA/dDlbY91zt8gBBEeySxKUU6Krno+kfoqM8Bx5AHx8YdZlP4K6Ad jsZfLt9hdWaJzInxSEwnbsaqsldaKuaprtI5NYWIA9+fM1Q6vEIT7dKAhnLMoSSh2iHkVilCnD8 mAkREnqhQX+MHEhQ84XBC575ZAeQ4mCu4rhFVqF5PDp5nqVmLbeQfi6nv2Dpw== X-Google-Smtp-Source: AGHT+IHQ78fj4w35Y9kLgaBu47AToy7EGUILnKAan473qANN6ZzI//+m6f88rVqsRBAIby1r3BuuSQ== X-Received: by 2002:a17:907:7f0a:b0:aab:da48:493e with SMTP id a640c23a62f3a-ab2ab559c29mr3048679366b.21.1737049969348; Thu, 16 Jan 2025 09:52:49 -0800 (PST) From: Roger Pau Monne To: xen-devel@lists.xenproject.org Cc: konrad.wilk@oracle.com, ross.lagerwall@citrix.com, Artem Savkov , =?utf-8?q?Roger_Pau_Monn=C3=A9?= Subject: [PATCH 2/7] create-diff-object: add symbol relations Date: Thu, 16 Jan 2025 18:52:09 +0100 Message-ID: <20250116175214.83742-3-roger.pau@citrix.com> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20250116175214.83742-1-roger.pau@citrix.com> References: <20250116175214.83742-1-roger.pau@citrix.com> MIME-Version: 1.0 From: Artem Savkov Add a function that would detect parent/child symbol relations. So far it only supports .cold.* symbols as children. Signed-off-by: Artem Savkov Signed-off-by: Roger Pau Monné --- common.h | 2 ++ create-diff-object.c | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+) diff --git a/common.h b/common.h index 5ff9ef6ca8e9..7f3a82ffdb29 100644 --- a/common.h +++ b/common.h @@ -85,6 +85,8 @@ struct section { struct symbol { struct list_head list; struct symbol *twin; + struct symbol *parent; + struct symbol *child; struct section *sec; GElf_Sym sym; char *name; diff --git a/create-diff-object.c b/create-diff-object.c index fed360a9aa68..b041d94d9723 100644 --- a/create-diff-object.c +++ b/create-diff-object.c @@ -327,6 +327,38 @@ static void kpatch_rename_mangled_functions(struct kpatch_elf *base, } } +/* + * During optimization gcc may move unlikely execution branches into *.cold + * subfunctions. kpatch_detect_child_functions detects such subfunctions and + * crossreferences them with their parent functions through parent/child + * pointers. + */ +static void kpatch_detect_child_functions(struct kpatch_elf *kelf) +{ + struct symbol *sym; + + list_for_each_entry(sym, &kelf->symbols, list) { + char *coldstr; + + coldstr = strstr(sym->name, ".cold."); + if (coldstr != NULL) { + char *pname; + + pname = strndup(sym->name, coldstr - sym->name); + if (!pname) + ERROR("strndup"); + + sym->parent = find_symbol_by_name(&kelf->symbols, pname); + free(pname); + + if (!sym->parent) + ERROR("failed to find parent function for %s", sym->name); + + sym->parent->child = sym; + } + } +} + /* * This function detects whether the given symbol is a "special" static local * variable (for lack of a better term). @@ -2329,6 +2361,9 @@ int main(int argc, char *argv[]) log_debug("Open patched\n"); kelf_patched = kpatch_elf_open(arguments.args[1]); + kpatch_detect_child_functions(kelf_base); + kpatch_detect_child_functions(kelf_patched); + log_debug("Compare elf headers\n"); kpatch_compare_elf_headers(kelf_base->elf, kelf_patched->elf); log_debug("Check program headers of base\n"); From patchwork Thu Jan 16 17:52:10 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Roger_Pau_Monn=C3=A9?= X-Patchwork-Id: 13942106 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 3722DC02188 for ; Thu, 16 Jan 2025 17:53:05 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.873680.1284686 (Exim 4.92) (envelope-from ) id 1tYU34-0007iN-3q; Thu, 16 Jan 2025 17:52:54 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 873680.1284686; Thu, 16 Jan 2025 17:52:54 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1tYU33-0007hS-Tv; Thu, 16 Jan 2025 17:52:53 +0000 Received: by outflank-mailman (input) for mailman id 873680; Thu, 16 Jan 2025 17:52:52 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1tYU32-0007CP-Gg for xen-devel@lists.xenproject.org; Thu, 16 Jan 2025 17:52:52 +0000 Received: from mail-ed1-x52e.google.com (mail-ed1-x52e.google.com [2a00:1450:4864:20::52e]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id b4d73ef0-d432-11ef-a0e2-8be0dac302b0; Thu, 16 Jan 2025 18:52:52 +0100 (CET) Received: by mail-ed1-x52e.google.com with SMTP id 4fb4d7f45d1cf-5d932eac638so2527302a12.1 for ; Thu, 16 Jan 2025 09:52:52 -0800 (PST) Received: from localhost ([84.78.159.3]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5db73edbc18sm227073a12.69.2025.01.16.09.52.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Jan 2025 09:52:50 -0800 (PST) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: b4d73ef0-d432-11ef-a0e2-8be0dac302b0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=citrix.com; s=google; t=1737049971; x=1737654771; darn=lists.xenproject.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=PStf4fVV3eap1o0m+cwA72iRcnwg9eiUKsl3FHMYlFU=; b=Tqh209ID0kkvPNRWt5u+zTzLFI0cjqx8oJ/QQRr7BbTuvi4SSHJHHMQMAEE0NmvR0U SonJZg7ftu5VqrkSfWreDR4U3VOQrpb2MOv8RFtZ9D5MNNH5kn9R4BzVb92gDLdhUlzo hL1XEY5+vc4ztc86PX2yVjsOCKsDOvn2B+Ve8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737049971; x=1737654771; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=PStf4fVV3eap1o0m+cwA72iRcnwg9eiUKsl3FHMYlFU=; b=E5VZGcAkkMcd3GSRZwAjC9UbkzsETKVxQg4MzNVGHZrPAiIUDIV7iLmHUZxPwTPGC1 Bx4QL2NID7JJAGDmTpmMQuidt7rCYgPLMmq601tnr28Bj/FUg6kE3t/j2hsIPexGPcIF cvUNvvC7p45dPn+grbIBIZG7r014zuVHFqgTu1YTvI91gvsvUzBFD+7JnzcPpFy1zsit DueT6kU5dgRIO0Fc4WL5FiOMaJH2oc7k3xdAaAoeXAGPduricin5Ko4yOYnq5Jlo6Zz3 cZjiCxHhWJq90YFr7j+pkKHE9pVtT0uxfMf45ikEyKxd+DzUTHXWxgxTlt0OHiS3lxFj PGYg== X-Gm-Message-State: AOJu0YxPOL3juHPUR5mrsIF2evZHignfrSPcuuIqWNjw5ITxEt9KKsZ5 iz/YrdlKfgWCer486ZqAjJojzG3/2IPPc/NtUwZyXe2ZfHU8GxuYCt7FmFBDsjeTCXQ7e9kA2Gj k X-Gm-Gg: ASbGncsB9pcxq/0i3YC2rzb4Ow0vsOS3VwhJ38RHGB0NSHXTDQuRPkg4S/ItvHH2bTb fJhKhbTqTU027FmuzcD3GGMIrATKfuHd9x6dDjDYAdUv7ZB1AjoMHtfCbjDKdi64OGSI24xjk0g aarsc6+ynzZy2gs5dVZWTfsH6qLsWIC/vH5/07dKZh4BBjtB0+vhsDIgxLxIFVLdcMICh9UPdI+ +QX+99SpdkQiMsx6b4Vrz0JZ7VK1BLUyXAZq0qjRFVeg7D2pYP8qdD1MtqI4g== X-Google-Smtp-Source: AGHT+IGM5B89/sW4jjyLnVgy25mYg6tio8LEb3BuycnqnUnpAsENjVhhpxBjpArg3oaD7QOU8tBTaA== X-Received: by 2002:a05:6402:4304:b0:5d0:e570:508d with SMTP id 4fb4d7f45d1cf-5d972e1787bmr34413603a12.17.1737049970833; Thu, 16 Jan 2025 09:52:50 -0800 (PST) From: Roger Pau Monne To: xen-devel@lists.xenproject.org Cc: konrad.wilk@oracle.com, ross.lagerwall@citrix.com, Artem Savkov , =?utf-8?q?Roger_Pau_Monn=C3=A9?= Subject: [PATCH 3/7] create-diff-object: propagate child symbol changes Date: Thu, 16 Jan 2025 18:52:10 +0100 Message-ID: <20250116175214.83742-4-roger.pau@citrix.com> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20250116175214.83742-1-roger.pau@citrix.com> References: <20250116175214.83742-1-roger.pau@citrix.com> MIME-Version: 1.0 From: Artem Savkov Propagate child symbol changes to it's parent. Signed-off-by: Artem Savkov Signed-off-by: Roger Pau Monné --- create-diff-object.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/create-diff-object.c b/create-diff-object.c index b041d94d9723..dd5466bff6ce 100644 --- a/create-diff-object.c +++ b/create-diff-object.c @@ -821,8 +821,14 @@ static void kpatch_compare_sections(struct list_head *seclist) if (sec->base->sym && sec->base->sym->status != CHANGED) sec->base->sym->status = sec->status; } else { - if (sec->sym && sec->sym->status != CHANGED) - sec->sym->status = sec->status; + struct symbol *sym = sec->sym; + + if (sym && sym->status != CHANGED) + sym->status = sec->status; + + if (sym && sym->child && sym->status == SAME && + sym->child->sec->status == CHANGED) + sym->status = CHANGED; } } } From patchwork Thu Jan 16 17:52:11 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Roger_Pau_Monn=C3=A9?= X-Patchwork-Id: 13942107 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 02BC2C0218A for ; Thu, 16 Jan 2025 17:53:05 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.873681.1284692 (Exim 4.92) (envelope-from ) id 1tYU34-0007pn-Hl; Thu, 16 Jan 2025 17:52:54 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 873681.1284692; Thu, 16 Jan 2025 17:52:54 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1tYU34-0007pI-8Z; Thu, 16 Jan 2025 17:52:54 +0000 Received: by outflank-mailman (input) for mailman id 873681; Thu, 16 Jan 2025 17:52:53 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1tYU33-0007CP-JR for xen-devel@lists.xenproject.org; Thu, 16 Jan 2025 17:52:53 +0000 Received: from mail-ej1-x62b.google.com (mail-ej1-x62b.google.com [2a00:1450:4864:20::62b]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id b57a67f7-d432-11ef-a0e2-8be0dac302b0; Thu, 16 Jan 2025 18:52:53 +0100 (CET) Received: by mail-ej1-x62b.google.com with SMTP id a640c23a62f3a-aa68b513abcso243480166b.0 for ; Thu, 16 Jan 2025 09:52:53 -0800 (PST) Received: from localhost ([84.78.159.3]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-ab384c5c470sm27605266b.26.2025.01.16.09.52.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Jan 2025 09:52:51 -0800 (PST) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: b57a67f7-d432-11ef-a0e2-8be0dac302b0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=citrix.com; s=google; t=1737049972; x=1737654772; darn=lists.xenproject.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=lkduoX8PBg5wURJov3JoF6FhqdQ9jnRnJkykFwuVuZg=; b=bIroicPcLT3DNyLvc4AZ/eKYdI9emjI4M5k3XSAPUWXVECVvxQmL7aora6M8qke4ok RzE/bMEAfA8vpXnVCPc75FBRUuVlkRf1V1i63ZTHJc0ybnIPZ4BTszQX3DhqYZDvrSDP 3sqnrIkS0pTBaCF4D+628nB3IhmFVBDZkB4AQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737049972; x=1737654772; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=lkduoX8PBg5wURJov3JoF6FhqdQ9jnRnJkykFwuVuZg=; b=qAk5s5bGTidyCGc8/SBLLQt5iLDFmPPWrxkNhsLCj2hekJ1WCKjLt0YwEn+YpmTBVS gmBNA4gJ1Wr47O9nTrlHABlDyk8rCaZ+fABDZdYRQGsuNeKvZOLoKubKe6PadRnNTu3I QeVcbl8yVRECWEQp5U4LbK0p4TOzYg0sCayd6CSEKdSozUolCzjiiRlCsun7W2eJ6+8C KUH7BVqefZZ5XqdB1GpSl+YTc2BMXZAF5v+9sa5FHpLdN49M1ihcVux3dNqUVRrdkXwW iYLyM4ATj8Th6X8Xv+BCy+amwgKplvdK8fiXHs227WdSdjz4UPOETFeI1usdYoJ0Ezx9 fUbA== X-Gm-Message-State: AOJu0YwWE7d6W2o+kHjqkakH9YEzx0lwGTw62x/ziQ+0WWk6jT+1lgxp MxRjvxII3HpczGeeUCDwsn5jMKyfCgwSzaEz2W8VsVa9GbuHt1p56quyougFuC/oc7DQ7u4Lo4k U X-Gm-Gg: ASbGncvq+ooqL8x1emWSgj8786xfHM12s9/Hv9a8n2uR3mdG8rxAOR1DJfdRQTh/ap6 qQciALZgcYDvcbcwthFJxrdvDB1Sm01PYKD/cydS7J6+5U7XoxKlk+9+3i50BLFThkmp5jSRt7W ASDSjLMr2MRGBHr67iVmn4pmAbbnaiIKmcK8mwM65nvyk3M/4bwuc0JZ3DZFo7zB/5ekn9Y3Pqi 7d/sh6epDuaHm8Di5OeDdsycRss3XpMSb8E41LTRSm6/6OjzoWiSE9zqThtsQ== X-Google-Smtp-Source: AGHT+IGIWKNJ4OtuhG7/i0Y2/9mANngRo5I7/u9pGjriJtCtSVzLJB4+kk7wHWPjSwVBWTH8QmM9wg== X-Received: by 2002:a17:907:9997:b0:ab2:c0ba:519e with SMTP id a640c23a62f3a-ab2c0ba708fmr3082553166b.35.1737049972304; Thu, 16 Jan 2025 09:52:52 -0800 (PST) From: Roger Pau Monne To: xen-devel@lists.xenproject.org Cc: konrad.wilk@oracle.com, ross.lagerwall@citrix.com, Artem Savkov , =?utf-8?q?Roger_Pau_Monn=C3=A9?= Subject: [PATCH 4/7] create-diff-object: allow changing subsections Date: Thu, 16 Jan 2025 18:52:11 +0100 Message-ID: <20250116175214.83742-5-roger.pau@citrix.com> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20250116175214.83742-1-roger.pau@citrix.com> References: <20250116175214.83742-1-roger.pau@citrix.com> MIME-Version: 1.0 From: Artem Savkov gcc8 can place functions to .text.unlikely and .text.hot subsections during optimizations. Allow symbols to change subsections instead of failing. Signed-off-by: Artem Savkov Signed-off-by: Roger Pau Monné --- create-diff-object.c | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/create-diff-object.c b/create-diff-object.c index dd5466bff6ce..3189d3e8451c 100644 --- a/create-diff-object.c +++ b/create-diff-object.c @@ -55,6 +55,13 @@ #include "common.h" char *childobj; + +enum subsection { + SUBSECTION_NORMAL, + SUBSECTION_HOT, + SUBSECTION_UNLIKELY +}; + enum loglevel loglevel = NORMAL; static void kpatch_compare_elf_headers(Elf *elf1, Elf *elf2) @@ -833,6 +840,22 @@ static void kpatch_compare_sections(struct list_head *seclist) } } +static enum subsection kpatch_subsection_type(struct section *sec) +{ + if (!strncmp(sec->name, ".text.unlikely.", 15)) + return SUBSECTION_UNLIKELY; + + if (!strncmp(sec->name, ".text.hot.", 10)) + return SUBSECTION_HOT; + + return SUBSECTION_NORMAL; +} + +static int kpatch_subsection_changed(struct section *sec1, struct section *sec2) +{ + return kpatch_subsection_type(sec1) != kpatch_subsection_type(sec2); +} + static void kpatch_compare_correlated_symbol(struct symbol *sym) { struct symbol *sym1 = sym, *sym2 = sym->twin; @@ -846,10 +869,12 @@ static void kpatch_compare_correlated_symbol(struct symbol *sym) /* * If two symbols are correlated but their sections are not, then the * symbol has changed sections. This is only allowed if the symbol is - * moving out of an ignored section. + * moving out of an ignored section, or moving between normal/hot/unlikely + * subsections. */ if (sym1->sec && sym2->sec && sym1->sec->twin != sym2->sec) { - if (sym2->sec->twin && sym2->sec->twin->ignore) + if ((sym2->sec->twin && sym2->sec->twin->ignore) || + kpatch_subsection_changed(sym1->sec, sym2->sec)) sym->status = CHANGED; else DIFF_FATAL("symbol changed sections: %s, %s, %s, %s", sym1->name, sym2->name, sym1->sec->name, sym2->sec->name); From patchwork Thu Jan 16 17:52:12 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Roger_Pau_Monn=C3=A9?= X-Patchwork-Id: 13942108 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id BC4B1C02187 for ; Thu, 16 Jan 2025 17:53:05 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.873682.1284710 (Exim 4.92) (envelope-from ) id 1tYU36-0008QS-P2; Thu, 16 Jan 2025 17:52:56 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 873682.1284710; Thu, 16 Jan 2025 17:52:56 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1tYU36-0008QJ-Lu; Thu, 16 Jan 2025 17:52:56 +0000 Received: by outflank-mailman (input) for mailman id 873682; Thu, 16 Jan 2025 17:52:55 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1tYU35-0007CP-KG for xen-devel@lists.xenproject.org; Thu, 16 Jan 2025 17:52:55 +0000 Received: from mail-ed1-x52d.google.com (mail-ed1-x52d.google.com [2a00:1450:4864:20::52d]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id b6ab3639-d432-11ef-a0e2-8be0dac302b0; Thu, 16 Jan 2025 18:52:55 +0100 (CET) Received: by mail-ed1-x52d.google.com with SMTP id 4fb4d7f45d1cf-5d9837f201aso4236583a12.0 for ; Thu, 16 Jan 2025 09:52:55 -0800 (PST) Received: from localhost ([84.78.159.3]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-ab384d2d69fsm27215966b.79.2025.01.16.09.52.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Jan 2025 09:52:53 -0800 (PST) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: b6ab3639-d432-11ef-a0e2-8be0dac302b0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=citrix.com; s=google; t=1737049974; x=1737654774; darn=lists.xenproject.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=GKB1yFs9c8qB7Ii2QUVBsCJgsFYCAo4Ha6+WZCUSBfI=; b=t6+0mhNL8ZhKyFpbFGHukojR9IGHOWUYKFDxhLCJhzpYt7aFSOJe5CkzjxSwdPXiI+ aJFUm+EcQZMk9Use+Wgbj6LaSxsTXqwIavtJrYqFfPx+nieWj3WgTChzFSuzHKVogalC UCrEz2Z+6QcMc2ez88XvqRPqAhhJkhsMyqshc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737049974; x=1737654774; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=GKB1yFs9c8qB7Ii2QUVBsCJgsFYCAo4Ha6+WZCUSBfI=; b=ArxhJ1rppZqJYCs2Er8EDSIdDE3GengFkAU1/Qe6dx95uUFUvdqAgEs/oTyTZLuNJp GfbrtJ1fUg/Wa0xH9ZK8wDCYOOb9dKQZve6jatdl0sWWkzY7eyyAB91GZQ0X2N/ieuQ+ d1bgaFBgvO6B4OeUjYCDgNU5yvrWnlgulXDVUmBBwVcZUgvU5PDyMpqUpQdrSWLwGlEB r1ylMRlOff82HRKKErPumNWhGOrowyxqa9vVIX7nB1QobwFpJk8efBIU01W5500fNu9q J9ZmRs8D1T4Ytx+8IoaonzjBlWDw4yTFgZwASQwaCTAlbllXilFVhjQlzYyu2/tjuKRO 5OEA== X-Gm-Message-State: AOJu0YzRV/p/bJQCIR/XdsIF9ALbUTMzo6CWUQlrpF5GTeECbAkGBD0W Wvego9liphsZg9ijKWH/ZHgwtLl3TP6imb+Kl2/D9UkxlbgjS6T/JdYRRNN848uB4KuCfSUbEzz j X-Gm-Gg: ASbGnctW/52qFIo3oJk/prF33zQQjPtd50O4AQPl2L/Df3oCFpq4/DHDRNS9ifOw+Mh odJ9uO6Vb3c0RORprpRAUYjpu0FDCc4WpBpGjJJ5wPNFeljCinlkZ4NkPTBEFWpeT38VLGHjfZ+ JR8Q1OxlRAvAXaEBIpeWXdDVjOHPFZP6epVI5sbi3/lZbAVfcEyB//U4DgugWA5e2+vxDHFmjqm pesEFAbcqv/8RcmKZlAU/tfAF90I/dDj5efyVASJjwFh62VdIHU8Md2/AJ5tw== X-Google-Smtp-Source: AGHT+IGH4OzQgxrsJ/IwnTnRF18Pado6jmWcA1RPVb0SjpZkArfJzXDlTxxDnOmwH4JgvOnn9o1fdg== X-Received: by 2002:a17:907:9d18:b0:ab3:85eb:377c with SMTP id a640c23a62f3a-ab385eb4029mr59295266b.17.1737049973869; Thu, 16 Jan 2025 09:52:53 -0800 (PST) From: Roger Pau Monne To: xen-devel@lists.xenproject.org Cc: konrad.wilk@oracle.com, ross.lagerwall@citrix.com, Artem Savkov , =?utf-8?q?Roger_Pau_Monn=C3=A9?= Subject: [PATCH 5/7] create-diff-object: add .text.hot to the list of bundleable functions Date: Thu, 16 Jan 2025 18:52:12 +0100 Message-ID: <20250116175214.83742-6-roger.pau@citrix.com> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20250116175214.83742-1-roger.pau@citrix.com> References: <20250116175214.83742-1-roger.pau@citrix.com> MIME-Version: 1.0 From: Artem Savkov According to gcc8's man pages gcc can put functions into .text.unlikely or .text.hot subfunctions during optimization. Add ".text.hot" to the list of bundleable functions in is_bundleable(). Signed-off-by: Artem Savkov Signed-off-by: Roger Pau Monné --- common.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/common.c b/common.c index 84ca14d3e397..b46fcf5cb6ca 100644 --- a/common.c +++ b/common.c @@ -131,6 +131,11 @@ static int is_bundleable(struct symbol *sym) !strncmp(sym->sec->name + 15, sym->name, strlen(sym->sec->name) - 15)))) return 1; + if (sym->type == STT_FUNC && + !strncmp(sym->sec->name, ".text.hot.",10) && + !strcmp(sym->sec->name + 10, sym->name)) + return 1; + if (sym->type == STT_OBJECT && !strncmp(sym->sec->name, ".data.",6) && !strcmp(sym->sec->name + 6, sym->name)) From patchwork Thu Jan 16 17:52:13 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Roger_Pau_Monn=C3=A9?= X-Patchwork-Id: 13942110 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 01E3FC02183 for ; Thu, 16 Jan 2025 17:53:06 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.873683.1284720 (Exim 4.92) (envelope-from ) id 1tYU38-0000G4-6j; Thu, 16 Jan 2025 17:52:58 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 873683.1284720; Thu, 16 Jan 2025 17:52:58 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1tYU38-0000Et-0x; Thu, 16 Jan 2025 17:52:58 +0000 Received: by outflank-mailman (input) for mailman id 873683; Thu, 16 Jan 2025 17:52:56 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1tYU36-0007CP-KW for xen-devel@lists.xenproject.org; Thu, 16 Jan 2025 17:52:56 +0000 Received: from mail-ed1-x52b.google.com (mail-ed1-x52b.google.com [2a00:1450:4864:20::52b]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id b74e02b7-d432-11ef-a0e2-8be0dac302b0; Thu, 16 Jan 2025 18:52:56 +0100 (CET) Received: by mail-ed1-x52b.google.com with SMTP id 4fb4d7f45d1cf-5d3cf094768so2189107a12.0 for ; Thu, 16 Jan 2025 09:52:56 -0800 (PST) Received: from localhost ([84.78.159.3]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-ab384f224e0sm26235766b.112.2025.01.16.09.52.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Jan 2025 09:52:54 -0800 (PST) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: b74e02b7-d432-11ef-a0e2-8be0dac302b0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=citrix.com; s=google; t=1737049975; x=1737654775; darn=lists.xenproject.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=sXVxPmSkdh6kTkitg7Sn1/R1oEUNu+Kk247t0METCbc=; b=Uc7Ti+F3lmBlCvE7EC2B6zQyMxGzLjfvlab3jVvOE1frB7JUn1kWhC6PxGkFDUKHDg 0nbLYwRjEnJdtw12z2glQLYVy5vTVfvK+3g/WIfCGd6Ab87d7IYnz9RL2OBKBPVoCd7m H4xie7EIh7MnrVoQ03oLEJsb6TeFly8hoO57M= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737049975; x=1737654775; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=sXVxPmSkdh6kTkitg7Sn1/R1oEUNu+Kk247t0METCbc=; b=Ndp855aArMaV0u/S0kdQntWR6mkDDoYGnhGWcBiUp8EgbZr5TB4ncYx5Je29Cxx9+B UGoM6ybifsKcO/q09FpG0XiIyQE+bGRPJHVhnVkV9qcYXxPJUpXPpNNGYcWH2PusYPGJ NqHVGJYv1d6O6QBtaQCVuFB9Vg5hGYcrYy8C30vO4Ub/xqF4WZoxNkH2ru18il8W+vhE 5WmXkyFrPSfrOwEsQEu6QT0b4N4fsz2LfixQtyYcI/Ca00myvRpgs8lfrJp6gU+oApUZ yVX7xyi3EoLx7WDi4huNP6RyfQp5bzBv4mVPi83OwTidN49sdruA+0G1tcUwGMSnYcLG pF4Q== X-Gm-Message-State: AOJu0Yz9EbwjAFcq1h7L/50/AQ8n5ZKD5H8DqM+8sHnu6BbzH1Rt1CSx Lk0J6JxCIlIPsBpD8qZ+EEk3L4pT4TQvaeEAkh2diLITHypiX7tGZky8yjELkWVGtCFmxbt6jXe O X-Gm-Gg: ASbGnctyN06UcnGqHK8Oh0sMTPBZxbmsCOspNTDlcSGZheJUhnzDkMABGFISnazOc2v vP6ezJnXd99nL1AbFhGO/2JUR+SQIOBuc6Am4qkeJwa/asN+VdN25nkq8G9GvCUJyfaWMw5De1g 0/ELNidHXxrBio027NzWXwh5W5FvtuItng4nq+cQ/kxZSYQgOzDswrgp5Ucz+TyUTjgGBkjRe8B VG56YnVifMW2cmIu7wzpywflinhYvSaqNJ0/1ANMIzC/Wtbpv/Ch0N8gOVRAw== X-Google-Smtp-Source: AGHT+IFdZIe4URc/r5aMLDRcUwmFjsTbWtOQeBFa9lkuRgU01Wen7f7gO9nWpmnH3qTK+bjccegIkA== X-Received: by 2002:a17:907:72d0:b0:aa6:5eae:7ed8 with SMTP id a640c23a62f3a-ab2ab66cea6mr3122115866b.6.1737049975319; Thu, 16 Jan 2025 09:52:55 -0800 (PST) From: Roger Pau Monne To: xen-devel@lists.xenproject.org Cc: konrad.wilk@oracle.com, ross.lagerwall@citrix.com, Artem Savkov , =?utf-8?q?Roger_Pau_Monn=C3=A9?= Subject: [PATCH 6/7] create-diff-object: propagate ignore.functions to children Date: Thu, 16 Jan 2025 18:52:13 +0100 Message-ID: <20250116175214.83742-7-roger.pau@citrix.com> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20250116175214.83742-1-roger.pau@citrix.com> References: <20250116175214.83742-1-roger.pau@citrix.com> MIME-Version: 1.0 From: Artem Savkov Add child symbols to .kpatch.ignore.functions in case their parents are added to the list. Signed-off-by: Artem Savkov Signed-off-by: Roger Pau Monné --- create-diff-object.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/create-diff-object.c b/create-diff-object.c index 3189d3e8451c..6060a73555ed 100644 --- a/create-diff-object.c +++ b/create-diff-object.c @@ -936,6 +936,10 @@ static void kpatch_mark_ignored_functions_same(struct kpatch_elf *kelf) log_normal("NOTICE: no change detected in function %s, unnecessary KPATCH_IGNORE_FUNCTION()?\n", rela->sym->name); rela->sym->status = SAME; rela->sym->sec->status = SAME; + + if (rela->sym->child) + rela->sym->child->status = SAME; + if (rela->sym->sec->secsym) rela->sym->sec->secsym->status = SAME; if (rela->sym->sec->rela) From patchwork Thu Jan 16 17:52:14 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Roger_Pau_Monn=C3=A9?= X-Patchwork-Id: 13942112 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id F3A78C0218D for ; Thu, 16 Jan 2025 17:53:07 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.873685.1284730 (Exim 4.92) (envelope-from ) id 1tYU39-0000YG-Fj; Thu, 16 Jan 2025 17:52:59 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 873685.1284730; Thu, 16 Jan 2025 17:52:59 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1tYU39-0000XG-CA; Thu, 16 Jan 2025 17:52:59 +0000 Received: by outflank-mailman (input) for mailman id 873685; Thu, 16 Jan 2025 17:52:58 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1tYU37-0007CP-Uj for xen-devel@lists.xenproject.org; Thu, 16 Jan 2025 17:52:57 +0000 Received: from mail-ed1-x52c.google.com (mail-ed1-x52c.google.com [2a00:1450:4864:20::52c]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id b812c9cb-d432-11ef-a0e2-8be0dac302b0; Thu, 16 Jan 2025 18:52:57 +0100 (CET) Received: by mail-ed1-x52c.google.com with SMTP id 4fb4d7f45d1cf-5d9f06f8cf2so2369387a12.3 for ; Thu, 16 Jan 2025 09:52:57 -0800 (PST) Received: from localhost ([84.78.159.3]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5db73684c70sm242918a12.47.2025.01.16.09.52.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Jan 2025 09:52:56 -0800 (PST) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: b812c9cb-d432-11ef-a0e2-8be0dac302b0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=citrix.com; s=google; t=1737049976; x=1737654776; darn=lists.xenproject.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=pdKNm+zFNAAty/krwKMMryYSZX6eNIKljOU3/XkBfjk=; b=TrP4+fX4xWedESq+GgjV0EGPvvFyXVfxL6/8PBb6isMet6d4NFl814iulAIbSB/MHQ wtpjeKTq5IhOZuOeQ+/LYdudWBnaHq8YtMEKqXB9FrXgFRZEp426thxRD67/MwDRsrkj iuoju2xlwQADRgljQduiHBjcudljLHgvW+5kI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737049976; x=1737654776; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=pdKNm+zFNAAty/krwKMMryYSZX6eNIKljOU3/XkBfjk=; b=CPYiibXyvu7qHt21RClF5XL7WROHoRVZc1OPlxH6TMUBX4ovzvTkzqSbhFij6q+vT6 Fm02yWsVNqoRwqxguGzJdyxfSXOx4jeua69a7Az6lJtimiXOTrNKRbx0wKVED1uyhhnk FiFY35sujMcGA1+qdE/NBEoA7B0/+nMwmalIo3sp+gjB4dEMg1T9Bsfxu+NOYgC6ATtB IGzRQET1Kbkemw4quKwvKObumNCWNUZ5IXfWedXE6uxS2nfc2G/c85FtiZt3k8OcQrl2 QH/pnSKGN/bi2Hf5+zKmTgewRrC1EmEEjfTcMBbsASzEyJ40uHFFV1hd4GUWWlyic6jb M7sg== X-Gm-Message-State: AOJu0YxjYyt0yXiXO0l7VcVU/YrqUMxFtmiwC2quyYrvTUzfvH4pOOQ9 BoFBHl03nNjsodiLksLbr0FU19XYr853A+o2BA+IS0CxCpT6g7U4kLoui/71NfL3T9nhpsVkKca e X-Gm-Gg: ASbGncv+KmEl5hjOHRbBG9YV1gBJq86mjknt7MWvK+otbtPpNrhUxwOdC8V5g5LoY2P 6tRlUOMlgN1+qXTgTL7WYvPBlJXr+ENJlHn1JRW/PxMeM8Gz0q8IAS5J/k02ETO04UYXXMYOoUn 58k6zVkVcs6vYF+leiS5cIciRkaN8hqyL/lrPiiqRAbIRkk53umNYRH07+D6gk1XnSmrJjeLMKo CZ09vkA+TbF7CZ/42t2BV6Lw8EdFx/t9ONu9Ncb4iFTY+6N8PBK398JOzaYxA== X-Google-Smtp-Source: AGHT+IE5XnhgEzjPcuMfl//ipOH+hpNHepD0cjDK0+Mb4WVVe19cwgfC5+H5ddmcqSBBK+MRP1f+hA== X-Received: by 2002:a05:6402:3217:b0:5cf:bcaf:98ec with SMTP id 4fb4d7f45d1cf-5d972e48686mr30530902a12.26.1737049976608; Thu, 16 Jan 2025 09:52:56 -0800 (PST) From: Roger Pau Monne To: xen-devel@lists.xenproject.org Cc: konrad.wilk@oracle.com, ross.lagerwall@citrix.com, Artem Savkov , =?utf-8?q?Roger_Pau_Monn=C3=A9?= Subject: [PATCH 7/7] create-build-diff: support for .cold functions with no id suffix Date: Thu, 16 Jan 2025 18:52:14 +0100 Message-ID: <20250116175214.83742-8-roger.pau@citrix.com> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20250116175214.83742-1-roger.pau@citrix.com> References: <20250116175214.83742-1-roger.pau@citrix.com> MIME-Version: 1.0 From: Artem Savkov create-build-diff expects .cold functions to be suffixed by an id, which is not always the case. Drop the trailing '.' when searching for cold functions. Fixes: #1160 Signed-off-by: Artem Savkov Signed-off-by: Roger Pau Monné --- common.c | 2 +- create-diff-object.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/common.c b/common.c index b46fcf5cb6ca..67b9fcdb0ada 100644 --- a/common.c +++ b/common.c @@ -127,7 +127,7 @@ static int is_bundleable(struct symbol *sym) if (sym->type == STT_FUNC && !strncmp(sym->sec->name, ".text.unlikely.",15) && (!strcmp(sym->sec->name + 15, sym->name) || - (strstr(sym->name, ".cold.") && + (strstr(sym->name, ".cold") && !strncmp(sym->sec->name + 15, sym->name, strlen(sym->sec->name) - 15)))) return 1; diff --git a/create-diff-object.c b/create-diff-object.c index 6060a73555ed..19590fc0fce1 100644 --- a/create-diff-object.c +++ b/create-diff-object.c @@ -347,7 +347,7 @@ static void kpatch_detect_child_functions(struct kpatch_elf *kelf) list_for_each_entry(sym, &kelf->symbols, list) { char *coldstr; - coldstr = strstr(sym->name, ".cold."); + coldstr = strstr(sym->name, ".cold"); if (coldstr != NULL) { char *pname;