Received: by 2002:a25:ca44:0:0:0:0:0 with SMTP id a65csp1897993ybg; Thu, 30 Jul 2020 05:42:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJysHj31Ik29m9gtWnh/btJLVfjmRIvTIJkn9dmyEom/BEseL4TVDx37pV9uFXOJZZLK0XKc X-Received: by 2002:aa7:c0d8:: with SMTP id j24mr2527239edp.338.1596112954257; Thu, 30 Jul 2020 05:42:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596112954; cv=none; d=google.com; s=arc-20160816; b=RA34z+E3wWnn/GtmZd+Ga0HhU95Eh25sZLX1gpuYvy7GaM38xt7Sf4GujusOC3xNoj MyokUNzG6vZn9uZhtLEic5RFIjkAXLjYYSC7ETOIiF9+KxOvKrliIWs83zo+41yKmwMd kRE6aHcM2TMVl3kF4d4cR+EuQl+6cywdf+czD8uJ6XUoaIXkpVUisfOFmdYJ7RVpQX6j Q8z1fXDl14CVDMCliABlcN3Dx4+ZIOKiu8wWY+tTd4HJ+YHjRmPM+bYORetj+D774MTN V8qfm+BupP5DqmY2p6kb9YDyvDqvjK67e5ASnrZLMTKeyCdnQHeX/cl1ljmFiqv+iwRl bjGg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=657ZXaavlZsnMYk6AbzdWXyxefEdWI1VRZPYAY+0IGo=; b=lZMsLj0AN/7asdns66l7hv/rb5GmUIuvmYmaE26pkeS0jxYDqjiRL0fBRMmtILGwxs dViRgQFWgdvLpsxZuLzTkWY/LqF0dZVon6Z1ZQcFx0k2RMN/Hw4AVvgvd3vNsWzATAQE ZURb9cxWxGKT188IZDF+fyHt1FX8DvcFMhMblGOqAx6L//ZT9NzfZvp2EQarp5+/RKjF Eig01VyN8nN7BraAzQvNt/uu/NaEyerORl2TR9F/njMFYW3TFSN0XJVs/XRMb7Otvwer Vd33TFiVSAQ/ns1Zn/B6UI7GzXXdf1Jej+FZgJinwWNUcYeAMo1evZQ2hTrk022kU10c ZEpw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="X/y+2B/U"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id lx7si2859572ejb.752.2020.07.30.05.42.11; Thu, 30 Jul 2020 05:42:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="X/y+2B/U"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728289AbgG3Mkz (ORCPT + 99 others); Thu, 30 Jul 2020 08:40:55 -0400 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:30672 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726581AbgG3Mkz (ORCPT ); Thu, 30 Jul 2020 08:40:55 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1596112853; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=657ZXaavlZsnMYk6AbzdWXyxefEdWI1VRZPYAY+0IGo=; b=X/y+2B/Ub4H+dDH7udXThFm45FMVbiss9r5PDwIRZNEqkvQB+MBfAK3OL7qwqwZdKYq4s/ RPr6rYmR9pa1C9f/Sw5Ikd3B+Lt4dsUoU4z5c09Mv6PPcmwFapsvmbWbyeKNrwSxqD/P79 IAd1A8HyoaqbLsiHAAxCD2gMgmf6aOg= Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-484-VRQzHyBdNTersSSQZt0RNw-1; Thu, 30 Jul 2020 08:40:52 -0400 X-MC-Unique: VRQzHyBdNTersSSQZt0RNw-1 Received: by mail-wr1-f70.google.com with SMTP id t3so6860808wrr.5 for ; Thu, 30 Jul 2020 05:40:52 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=657ZXaavlZsnMYk6AbzdWXyxefEdWI1VRZPYAY+0IGo=; b=lsTysGMNKAqh0CzJejPHH9tvUSnTLtBOos+Ai1kTu4+u6ir8AG3iuHdmFiaX9LPVok talrDi6SZlSpaUsqmoj+6bzKG2YVKtUqRptrEpOuknIB3GWbwmJmnD0GkTbQXLpUD3A/ dpRoXX8ebUMZT2xbl6con9Lf6SMP0M0XjZRBGLcPGd2JuOXg+0O4R2BkaLfpRLfKo1+T dgadF32Mt9rTuL6gNCd0Tx0DrdZ2cMw/puOmG+EUsbmzkyn5sfBEQFPOqusWGmRuFadN QGZBi9595Wl2i0PvGeIijBQ4BrlRn/6+WG0nejCnvWpcD3esPrj/nzex3E5G1TQgkwnK xHeA== X-Gm-Message-State: AOAM5333A0dkI+4e8AzT0tkusT2MDTxGqwDJggX67/i0EReSDK3jt0wQ dT7RYgKSB8VgHyqW0EkDKJiugXGhxwCrjRV4FdOsl+JT+D90yyn4XwjFIXjvc+TeedQuIpIz1Dr /OI0ovGuENxNjudpCqC85A5qW X-Received: by 2002:adf:9561:: with SMTP id 88mr2576235wrs.240.1596112849874; Thu, 30 Jul 2020 05:40:49 -0700 (PDT) X-Received: by 2002:adf:9561:: with SMTP id 88mr2576220wrs.240.1596112849710; Thu, 30 Jul 2020 05:40:49 -0700 (PDT) Received: from ?IPv6:2a01:cb14:499:3d00:cd47:f651:9d80:157a? ([2a01:cb14:499:3d00:cd47:f651:9d80:157a]) by smtp.gmail.com with ESMTPSA id f15sm8309487wmj.39.2020.07.30.05.40.48 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 30 Jul 2020 05:40:49 -0700 (PDT) Subject: Re: [PATCH v3 4/4] objtool: orc_gen: Move orc_entry out of instruction structure To: peterz@infradead.org Cc: linux-kernel@vger.kernel.org, jpoimboe@redhat.com, mhelsley@vmware.com, mbenes@suse.cz References: <20200730094143.27494-1-jthierry@redhat.com> <20200730094143.27494-5-jthierry@redhat.com> <20200730100304.GI2655@hirez.programming.kicks-ass.net> From: Julien Thierry Message-ID: Date: Thu, 30 Jul 2020 13:40:48 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.5.0 MIME-Version: 1.0 In-Reply-To: <20200730100304.GI2655@hirez.programming.kicks-ass.net> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 7/30/20 11:03 AM, peterz@infradead.org wrote: > On Thu, Jul 30, 2020 at 10:41:43AM +0100, Julien Thierry wrote: >> One orc_entry is associated with each instruction in the object file, >> but having the orc_entry contained by the instruction structure forces >> architectures not implementing the orc subcommands to provide a dummy >> definition of the orc_entry. >> >> Avoid that by having orc_entries in a separate list, part of the >> objtool_file. >> > >> diff --git a/tools/objtool/orc_gen.c b/tools/objtool/orc_gen.c >> index 66fd56c33303..00f1efd05653 100644 >> --- a/tools/objtool/orc_gen.c >> +++ b/tools/objtool/orc_gen.c >> @@ -9,18 +9,33 @@ >> #include "check.h" >> #include "warn.h" >> >> +struct orc_data { >> + struct list_head list; >> + struct instruction *insn; >> + struct orc_entry orc; >> +}; >> + >> int create_orc(struct objtool_file *file) >> { >> struct instruction *insn; >> >> for_each_insn(file, insn) { >> - struct orc_entry *orc = &insn->orc; >> struct cfi_reg *cfa = &insn->cfi.cfa; >> struct cfi_reg *bp = &insn->cfi.regs[CFI_BP]; >> + struct orc_entry *orc; >> + struct orc_data *od; >> >> if (!insn->sec->text) >> continue; >> >> + od = calloc(1, sizeof(*od)); >> + if (!od) >> + return -1; >> + od->insn = insn; >> + list_add_tail(&od->list, &file->orc_data_list); >> + >> + orc = &od->orc; >> + >> orc->end = insn->cfi.end; >> >> if (cfa->base == CFI_UNDEFINED) { > > This will dramatically increase the amount of allocation calls, what, if > anything, does this do for the performance of objtool? > I guess I forgot about the usecase of running objtool on vmlinux... On a kernel build for x86_64 defconfig, the difference in time seems to be withing the noise. But I agree the proposed code is not ideal and on the other we've tried avoiding #ifdef in the code. Ideally I'd have an empty orc_entry definition when SUBCMD_ORC is not implemented. Would you have a suggested approach to do that? Thanks, -- Julien Thierry