Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp2424380ybl; Thu, 9 Jan 2020 12:30:48 -0800 (PST) X-Google-Smtp-Source: APXvYqw1qW6j9LanONxypmcdQQ/Qu2xtBIqof5p6bbGh5DZUQHdM/9XjVN3hlRg7Npq9dZBgqnz5 X-Received: by 2002:a9d:6b17:: with SMTP id g23mr9654281otp.265.1578601848323; Thu, 09 Jan 2020 12:30:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578601848; cv=none; d=google.com; s=arc-20160816; b=B893UWmwHZxWTjXzoLDvdxb9FTru49529y/xuAViofjmpTOqBdGIpPfS6AsLKMgIFT s/DJolA2jPky+BnOe2i34nXKFqUUYEofg1qDgL81hOt8JTq2wtYtS7CbJQ4TYeAaymZ+ OPEpyBP/02qMU1kelgkp0owvq3M1dZfPb6FGiKKmWPtwYqx35RvwXTIMpdcJuxKS0x93 b18pnNMNvcZGf0JDzuYiTAUNJeSn4KMzju9K65h1RYAqiag3dhpNVyiMIz4mP34tCLMd jlYCJHwoH/0MN4u9+OUHAX+fJkhy2WabNUUDpPoWR5LQofkcrTgtJQYxX090//sYmU7/ i7Rg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=cKowTXElbIwNPHiVPa4u4GnF2xIwH7p+D7SwgI4xDds=; b=L8aSI3tSGnjATkzCFkMbpcx4f6nFrMiK/owx7xNClHvQPIQVev0ycDpDMik9orX3Bt YiRztazBC2Wm8kdlJEY3+RJnvzk28lfEsuxxo2FsR09RlxscjLwnjfW8tojd2PzroUVP kiOJMxL0a+SFoL22vSfNqp/yG5PsVzlw0nnJBApFwKNHRYJJwWgqPWsCPN+zsJ0DyyMw ec7/rdSKRCAQFh+DCvfYBZxF6QV65To7EAMO/7JSS0zFcbICuT4jIBF/1PxaNuCU8sJV omUmmIvR77oHVbU6gbR6PcfBYOa5oWwiBtBGneAg4ZV2PSUKo09MinF+OhSIhny0kXdf dfgQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=KranUPvI; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k8si4600230otp.13.2020.01.09.12.30.36; Thu, 09 Jan 2020 12:30:48 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=KranUPvI; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387692AbgAIQe2 (ORCPT + 99 others); Thu, 9 Jan 2020 11:34:28 -0500 Received: from mail-pj1-f68.google.com ([209.85.216.68]:53049 "EHLO mail-pj1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727861AbgAIQe2 (ORCPT ); Thu, 9 Jan 2020 11:34:28 -0500 Received: by mail-pj1-f68.google.com with SMTP id a6so1358004pjh.2 for ; Thu, 09 Jan 2020 08:34:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=cKowTXElbIwNPHiVPa4u4GnF2xIwH7p+D7SwgI4xDds=; b=KranUPvIVSlrQAeovbcdugffemKy/nR+ighvkTl00RCdUFrRihDCRDxFEZRZN9JG+v UyNWVX9N764l0/gx4dzPGT7buMh2fg3v8z9XO03HhHGpmporxiy0g33ISVkf3n5Q1ccH lvGlJAU+N5/FoaOV0yWTPnIW5C964CXKHhFSESlOZyCKhwHJxUY0At3jJ1DIuUfJoceK lvvBBIPPjAsLca2UpRaroS6RID9NOl1V0zs8p5w0a+fi5KxWh1vKTXTa48eX/RF6nDzU mF7I+j3lThSGZvAjUALBKU1G/vYarh91VfoZLLTPlqyvK/7kn7UVSPyPBcoaLNtNUR/u Cb0A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=cKowTXElbIwNPHiVPa4u4GnF2xIwH7p+D7SwgI4xDds=; b=USb+E6I/Norc1cC7zNzCI9eo5ruDu2t7O0GfWbxEELOocqDK4J5pP93CZCyxpyCk+L 0IwRKUqfcXalQi9xUVAJ1Sv9dcjnZD370k91br2Yusu+yDZbbMg194QuyTXPRCDgb+yp dIkNe5+MnGpwHz3VgSTpqyz6puio1C9Wyz6PvRlcdq2kFUcSmEszOtO1L9Zpkxrl6KjS zSNo5lVokvdU1p5igcDigOIsTIXw1r38aBe8kpyckrovy0R/IA+8P7HWxst3lj29q5MH EO+4SnlYfZP8eBXrYnayeCkLS/z7TmyH6uZCBbDeVmo/ox2FJY9aJ4DL04cxGPNwPjE3 BEOA== X-Gm-Message-State: APjAAAUwHCsFoCnhic2ZnDZjH0psDl+XP7RzSBYGo4tbhPmLusqWphDr ryGsObJlXn/A2UgC81o2rM6hAw== X-Received: by 2002:a17:902:b68c:: with SMTP id c12mr12357128pls.160.1578587667268; Thu, 09 Jan 2020 08:34:27 -0800 (PST) Received: from xps15 (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id j9sm8446085pff.6.2020.01.09.08.34.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Jan 2020 08:34:26 -0800 (PST) Date: Thu, 9 Jan 2020 09:34:24 -0700 From: Mathieu Poirier To: Leo Yan Cc: Arnaldo Carvalho de Melo , Jiri Olsa , Suzuki K Poulose , Peter Zijlstra , Ingo Molnar , Mark Rutland , Alexander Shishkin , Namhyung Kim , Ian Rogers , Adrian Hunter , Thomas Gleixner , Andi Kleen , linux-arm-kernel , Linux Kernel Mailing List , Mike Leach Subject: Re: [PATCH v4 1/2] perf parse: Refactor struct perf_evsel_config_term Message-ID: <20200109163424.GA5721@xps15> References: <20200108142010.11269-1-leo.yan@linaro.org> <20200109050753.GA24741@leoy-ThinkPad-X240s> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200109050753.GA24741@leoy-ThinkPad-X240s> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jan 09, 2020 at 01:08:06PM +0800, Leo Yan wrote: > Hi Mathieu, > > On Wed, Jan 08, 2020 at 10:58:31AM -0700, Mathieu Poirier wrote: > > [...] > > > > diff --git a/tools/perf/util/evsel_config.h b/tools/perf/util/evsel_config.h > > > index 1f8d2fe0b66e..4e5b3ebf09cf 100644 > > > --- a/tools/perf/util/evsel_config.h > > > +++ b/tools/perf/util/evsel_config.h > > > @@ -33,21 +33,8 @@ struct perf_evsel_config_term { > > > struct list_head list; > > > enum evsel_term_type type; > > > union { > > > - u64 period; > > > - u64 freq; > > > - bool time; > > > - char *callgraph; > > > - char *drv_cfg; > > > - u64 stack_user; > > > - int max_stack; > > > - bool inherit; > > > - bool overwrite; > > > - char *branch; > > > - unsigned long max_events; > > > - bool percore; > > > - bool aux_output; > > > - u32 aux_sample_size; > > > - u64 cfg_chg; > > > + u64 num; > > > + char *str; > > > > That is a lot more than just dealing with the "char *" members. Given > > the pervasiveness of the changes I would have been happy to leave > > other members alone for the time being. > > I think actually you are suggesting like below which add general > members and also keep the old members. If so, I prefer to add two > general members 'num' and 'str'. If we are to deal with all flields of the union, I think it should be as below: union { bool cfg_bool; int cfg_int; unsigned long cfg_ulong; u32 cfg_u32; char *cfg_str; } val; But just dealing with the "char *" as below would also be fine with me: union { u64 period; u64 freq; bool time; u64 stack_user; int max_stack; bool inherit; bool overwrite; unsigned long max_events; bool percore; bool aux_output; u32 aux_sample_size; u64 cfg_chg; u64 num; char *str; } val; > > struct perf_evsel_config_term { > struct list_head list; > enum evsel_term_type type; > union { > u64 period; > u64 freq; > bool time; > char *callgraph; > char *drv_cfg; > u64 stack_user; > int max_stack; > bool inherit; > bool overwrite; > char *branch; > unsigned long max_events; > bool percore; > bool aux_output; > u32 aux_sample_size; > u64 cfg_chg; > + u64 num; > + char *str; > } val; > bool weak; > }; > > > I will let Jiri make the > > final call but if we are to proceed this way I think we should have a > > member per type to avoid casting issues. > > Yeah, let's see what's Jiri thinking. > > Just note, with this change, I don't see any casting warning or errors > when built perf on arm64/arm32. At this time you may not, but they will happen and it will be very hard to debug. > > Thanks, > Leo Yan