linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "N, Pandith" <pandith.n@intel.com>
To: Joe Perches <joe@perches.com>,
	"georgi.djakov@linaro.org" <georgi.djakov@linaro.org>,
	"linux-pm@vger.kernel.org" <linux-pm@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Cc: "mgross@linux.intel.com" <mgross@linux.intel.com>,
	"Zhou, Furong" <furong.zhou@intel.com>,
	"Sangannavar,
	Mallikarjunappa"  <mallikarjunappa.sangannavar@intel.com>,
	"Raja Subramanian,
	Lakshmi Bai"  <lakshmi.bai.raja.subramanian@intel.com>
Subject: RE: [PATCH V6 1/1] interconnect: intel: Add Keem Bay noc driver
Date: Wed, 1 Sep 2021 13:50:15 +0000	[thread overview]
Message-ID: <BYAPR11MB35281058ADB062E796338B7FE1CD9@BYAPR11MB3528.namprd11.prod.outlook.com> (raw)
In-Reply-To: <1c5b485cc9b8836b09f99278233d9dc0ae991da7.camel@perches.com>

Hi,

> -----Original Message-----
> From: Joe Perches <joe@perches.com>
> Sent: Tuesday, August 31, 2021 8:56 PM
> To: N, Pandith <pandith.n@intel.com>; georgi.djakov@linaro.org; linux-
> pm@vger.kernel.org; linux-kernel@vger.kernel.org
> Cc: mgross@linux.intel.com; Zhou, Furong <furong.zhou@intel.com>;
> Sangannavar, Mallikarjunappa <mallikarjunappa.sangannavar@intel.com>; Raja
> Subramanian, Lakshmi Bai <lakshmi.bai.raja.subramanian@intel.com>
> Subject: Re: [PATCH V6 1/1] interconnect: intel: Add Keem Bay noc driver
> 
> On Tue, 2021-08-31 at 12:06 +0530, pandith.n@intel.com wrote:
> > From: Pandith N <pandith.n@intel.com>
> >
> > Add support for Network on Chip(NOC) counters. Enable features to
> > configure and capture NOC probe counters, needed for DDR bandwidth
> > measurement. NOC driver is specific to Intel Keem Bay SOC. NOC
> > hardware counters are used for DDR statistics profiling, it is not related to
> timers.
> > Interface details are provided in include/uapi/linux/noc_uapi.h
> 
> trivial notes:
> 
> > diff --git a/drivers/interconnect/intel/Kconfig
> > b/drivers/interconnect/intel/Kconfig
> []
> > +config INTERCONNECT_INTEL_KEEMBAY
> > +	tristate "Intel Keem Bay Enable DDR profiling using NOC"
> > +	depends on INTERCONNECT_INTEL || ARCH_KEEMBAY ||
> COMPILE_TEST
> > +	help
> > +	  Enable this option for DDR bandwidth measurements using NOC
> > +
> > +	  Add support for Network-on-chip (NOC) in DDR Subsystem(DSS).
> > +	  DSS NOC has capabilities to enable and get statistics profiling.
> > +	  NOC driver enables features to configure and capture NOC probe
> > +          counters, needed for DSS bandwidth measurement.
> 
> Inconsistent tab/space indentation on this line
> 
It will corrected with tab + 2 spaces

> > diff --git a/drivers/interconnect/intel/keembay-bwmon.c
> > b/drivers/interconnect/intel/keembay-bwmon.c
> []
> > +/**
> > + * flex_noc_setup() - Setup two counters for the NOC probe
> > + * @noc: NOC type to setup counters
> > + * @counter: Counter number to set up counter n and n+1
> > + * @trace_port: trace port number to setup counters
> > + *
> > + * This function will setup the counters for the trace port given.
> 
> This seems to be unnecessary kernel-doc and if it is useful, the return value isn't
> described.
> 
Will add description for return value

> > +int flex_noc_setup(enum noc_ss_type noc, enum noc_counter counter,
> > +int trace_port) {
> > +	int offset;
> > +
> > +	if (noc >= NOC_TYPE_MAX || counter >= NOC_COUNTER_MAX)
> > +		return -EINVAL;
> > +
> > +	offset = f_offset[counter / 2];
> > +
> > +	/* Stop ongoing stats */
> > +	noc_writel(MAINCTL, 0);
> > +	noc_writel(CFGCTL, 0);
> > +
> > +	/* Setup trace port and counters port select */
> > +	noc_writel(TRACEPORTSEL, trace_port);
> > +	noc_writel((c_offset[counter] + C_PORTSEL), trace_port);
> 
> Lots of unnecessary parentheses
> 
Will change as below : 
noc_writel(c_offset[counter] + C_PORTSEL, trace_port);

> > +	noc_writel((c_offset[counter + 1] + C_PORTSEL), trace_port);
> > +
> > +	/* Setup counter sources & triggers, Alarm mode - OFF */
> > +	noc_writel((c_offset[counter] + C_SRC), COUNTERS_0_SRC_VAL);
> > +	noc_writel((c_offset[counter] + C_ALARMMODE),
> COUNTERS_ALARMMODE_VAL);
> > +	noc_writel((c_offset[counter + 1] + C_SRC), COUNTERS_1_SRC_VAL);
> > +	noc_writel((c_offset[counter + 1] + C_ALARMMODE),
> > +		   COUNTERS_ALARMMODE_VAL);
> 
> []
Will correct unnecessary parenthesis in above 4 statements
 
> 
> > +enum noc_status flexnoc_counter_capture(enum noc_ss_type noc,
> > +					enum noc_counter counter, u32
> *value) {
> > +	unsigned long j0, j1, delay;
> > +	u32 c0_0, c0_1;
> > +
> > +	if (noc >= NOC_TYPE_MAX ||
> > +	    counter >= NOC_COUNTER_MAX  ||
> > +	    !value)
> > +		return NOC_PROBE_ERR_INVALID_ARGS;
> > +
> > +	delay = msecs_to_jiffies(NOC_CAPTURE_TIMEOUT_MSEC);
> > +	j0 = jiffies;
> > +	j1 = j0 + delay;
> 
> j0 and j1 seem unnecessary
> 
Yes, will change it to single timeout variable.

> 	timeout = jiffies + msecs_to_jiffies(NOC_CAPTURE_TIMEOUT_MSEC);
> 
> > +	do {
> > +		c0_0 = noc_readl((c_offset[counter] + C_VAL));
> > +		usleep_range(10000, 11000);
> 
> Seems a long time.
> 
Will review if this time can be optimized.

> > +		c0_1 = noc_readl((c_offset[counter] + C_VAL));
> > +		/* If mainctrl is zero , return error */
> > +		if (noc_readl(MAINCTL) == 0)
> > +			return NOC_PROBE_ERR_IN_PROGRESS;
> > +		/* If counters are zero, keep reading */
> > +		if (0 == c0_0 && 0 == c0_1) {
> > +			break;
> > +		} else if (c0_0 != c0_1) {
> > +			continue;
> > +		} else {
> > +			/* counters look good break the while */
> > +			break;
> > +		}
> > +	} while (time_before(jiffies, j1));
> 
> 	} while (time_before(jiffies, timeout);
>
Variable will be renamed as timeout.
 
> []
> 
> > +static long noc_ioctl(struct file *file, unsigned int cmd, unsigned
> > +long arg) {
> > +	struct flexnoc_countercapture capture_data;
> > +	void __user *argp = (void __user *)arg;
> > +	struct flexnoc_probestart probe_data;
> > +	struct flexnoc_setup setup_data;
> > +	int rc;
> > +
> > +	if (!arg) {
> > +		pr_err("NOC: Null pointer from user\n");
> 
> Perhaps useful to add #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt near the
> top of the file.
> 
will add this line to the top of the file
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt

Regards,
Pandith


  reply	other threads:[~2021-09-01 13:50 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-31  6:36 [PATCH V6 1/1] interconnect: intel: Add Keem Bay noc driver pandith.n
2021-08-31 15:25 ` Joe Perches
2021-09-01 13:50   ` N, Pandith [this message]
2021-08-31 16:15 ` Randy Dunlap
2021-09-01  5:21   ` N, Pandith

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=BYAPR11MB35281058ADB062E796338B7FE1CD9@BYAPR11MB3528.namprd11.prod.outlook.com \
    --to=pandith.n@intel.com \
    --cc=furong.zhou@intel.com \
    --cc=georgi.djakov@linaro.org \
    --cc=joe@perches.com \
    --cc=lakshmi.bai.raja.subramanian@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=mallikarjunappa.sangannavar@intel.com \
    --cc=mgross@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).