Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp4070833ybl; Mon, 13 Jan 2020 07:22:41 -0800 (PST) X-Google-Smtp-Source: APXvYqzYGwP9VkfNZ/1thxjKtQ1PGBP0eTLezEMHhhbXmyvhurySEy5qVKs1M215KFEkE084oQvq X-Received: by 2002:a05:6808:a8e:: with SMTP id q14mr12353847oij.173.1578928960874; Mon, 13 Jan 2020 07:22:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578928960; cv=none; d=google.com; s=arc-20160816; b=OkohGTMpTZRPE3UkAv4HcNO0lik62uPrBs+melt3tB+y11Qn6c6YIAoVtaPovEF1SX 2QhDjuAWyGhvaDIbVeB9RfARG+3IhTbng1SYzJqokzdCUf/Op5bcuB+bb5PC0J+GkBuo Q+ErARIscsbjbgLIsNN8XCAgw/p5lpQc7AECDLybPWk3iA0WZ2vu6fEkIqUf8OD4BJRL uDUDoFsEIEZMz0dl8cfou7lkRt5sf/+A795hzRb5tOVW+JatTQ1dQYjWzbHruOy3TheJ C2s+1bQ5+GlLR1+T/Wx+B3Fdeb/+Qnev8LOAJ4Pmkxfcy/yqrckS7YKz8dQSk3DAygou X5FA== 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=Xio3ltsZ5CL1rGBail8nUykniEUKdTJ+MhVEQqazwvU=; b=HFEaQkplanMBWZ/2zKtvrgsLHhElWUDtjSP6LYS8I+O5GQLogBQGsRDKbuJQbjWEVH VC+Rwt0mDCvfmMTfl+nUZTL0RcwSeAzmGZ7k8yXewYLOg3wXuegAKy64wbhEbMr25Sos 3IItdUYk3g6gC3p4i5MSlHv8zDyDmYz0MtvNJF3VyAv0tlWvc6qZpJmlt/lu6AZUP0nA /9ZMIuv0Co6Dlimzr9tBPZRYnb9yjyDXyYk5BqF2iifJHEssiAg8WZsS6pz2PT1LV9L5 5eF2aSaN3qA/6wi+HsE1KKJIlcyAp3rQMOv730bwyIL5pbsGxdkfwlBAT8n0iJmOBzz3 nRJQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=XBlxvOFS; 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 m24si5813858oic.11.2020.01.13.07.22.28; Mon, 13 Jan 2020 07:22:40 -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=XBlxvOFS; 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 S1729153AbgAMPVN (ORCPT + 99 others); Mon, 13 Jan 2020 10:21:13 -0500 Received: from mail-pl1-f194.google.com ([209.85.214.194]:44265 "EHLO mail-pl1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728558AbgAMPVN (ORCPT ); Mon, 13 Jan 2020 10:21:13 -0500 Received: by mail-pl1-f194.google.com with SMTP id az3so3926088plb.11 for ; Mon, 13 Jan 2020 07:21:13 -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=Xio3ltsZ5CL1rGBail8nUykniEUKdTJ+MhVEQqazwvU=; b=XBlxvOFSWkhf5jOxtE1Jstbl/y1fHgss2bgjBDGytbhH8Aq/6Te18ZGLd92cxH3SoR 2v/9Y6BkFaLkj56QsKKo9yEBtiWdkZ4Q0D6dhJggBWWJeEH5eWu0N4HSuxaNHkHeWkx5 69gjs+FOSPISRwpreQg5IlDtCIrtXwVNJXfO3AktEPrG3Rl3rI7ZYx0Ga3PL7MJC/aB8 skZBN2UPl0R4zMOA/GUVivuDD9wxODbeRXG3IXzjP20npcrKtE7IYOv+cD2vPPMhPEnK pia71Duax2cEASLqn+YA9PyqA9Ecf55dHUdPMSp+2fQ7LHJ4zFvhKQ8RpKJstZZeNJei 610w== 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=Xio3ltsZ5CL1rGBail8nUykniEUKdTJ+MhVEQqazwvU=; b=XM9y+bGDhdY2LRf/oS1uFZtfkpbXCg59QpwV1JVFo4s/iSg14f5LzWDP0oRbHPA181 z5VY2DFf4N7vJV4+X+RCplMN9+cqo9AFTPcqvVqyNxIsSXelyzB101Dpl3cdIa+aSDl+ xz/KfeFWe4W7W6nm5NKKeggvhN0Bmb3m1e6Q6zcPbLltD3mNKxHbIZqBdAV5N618ziTC R8KCbtJZx6MQBwU7LUIV1H8rQFNjeIWRp7t2QzVet2jyIEQzYivC4CMvYNE64mrA8/s1 gLm/NsRyLPVVidTfm8LeOTKnLYovBZ5ACSMFcjNVruaPQGY89IpNVy7h+AvKF56o7E49 X97w== X-Gm-Message-State: APjAAAW6fq3cGRxqG1WKsWTNk29MNhBl155i03/rj6wCRwVpaHB5aMg4 j5mQF0dh66USD97H5J5zF4kSvQ== X-Received: by 2002:a17:902:ab83:: with SMTP id f3mr20933451plr.106.1578928872619; Mon, 13 Jan 2020 07:21:12 -0800 (PST) Received: from leoy-ThinkPad-X240s (li519-153.members.linode.com. [66.175.222.153]) by smtp.gmail.com with ESMTPSA id w4sm13737264pjt.23.2020.01.13.07.21.06 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 13 Jan 2020 07:21:12 -0800 (PST) Date: Mon, 13 Jan 2020 23:21:03 +0800 From: Leo Yan To: Jiri Olsa Cc: Mathieu Poirier , 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: <20200113152103.GC10620@leoy-ThinkPad-X240s> References: <20200108142010.11269-1-leo.yan@linaro.org> <20200109050753.GA24741@leoy-ThinkPad-X240s> <20200109163424.GA5721@xps15> <20200110150410.GG82989@krava> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200110150410.GG82989@krava> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jan 10, 2020 at 04:04:10PM +0100, Jiri Olsa wrote: > On Thu, Jan 09, 2020 at 09:34:24AM -0700, Mathieu Poirier wrote: > > SNIP > > > > > 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. > > hi, > sry for late reply.. > > I think ;-) we should either add all different types to the union > or just add 'str' pointer to handle strings correctly.. which seems > better, because it's less changes and there's no real issue that > would need that other bigger change Thanks for the suggestion, Jiri. Have sent out patch v5 with following the ideas. Thanks, Leo Yan