From: kernel test robot <lkp@intel.com>
To: James Clark <james.clark@arm.com>, coresight@lists.linaro.org
Cc: oe-kbuild-all@lists.linux.dev, James Clark <james.clark@arm.com>,
Mathieu Poirier <mathieu.poirier@linaro.org>,
Suzuki K Poulose <suzuki.poulose@arm.com>,
Mike Leach <mike.leach@linaro.org>, Leo Yan <leo.yan@linaro.org>,
Alexander Shishkin <alexander.shishkin@linux.intel.com>,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 6/8] coresight: Refactor out buffer allocation function for ETR
Date: Thu, 9 Mar 2023 16:18:20 +0800 [thread overview]
Message-ID: <202303091603.UuxHblt7-lkp@intel.com> (raw)
In-Reply-To: <20230308173904.3449231-7-james.clark@arm.com>
Hi James,
I love your patch! Perhaps something to improve:
[auto build test WARNING on linus/master]
[also build test WARNING on v6.3-rc1 next-20230309]
[cannot apply to atorgue-stm32/stm32-next soc/for-next]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/James-Clark/coresight-Use-enum-type-for-cs_mode-wherever-possible/20230309-014226
patch link: https://lore.kernel.org/r/20230308173904.3449231-7-james.clark%40arm.com
patch subject: [PATCH 6/8] coresight: Refactor out buffer allocation function for ETR
config: arm-randconfig-r046-20230308 (https://download.01.org/0day-ci/archive/20230309/202303091603.UuxHblt7-lkp@intel.com/config)
compiler: arm-linux-gnueabi-gcc (GCC) 12.1.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/intel-lab-lkp/linux/commit/3651e0e04e2a01c3cbcb4a4e9289092f2377dc13
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review James-Clark/coresight-Use-enum-type-for-cs_mode-wherever-possible/20230309-014226
git checkout 3651e0e04e2a01c3cbcb4a4e9289092f2377dc13
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=arm olddefconfig
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=arm SHELL=/bin/bash drivers/hwtracing/coresight/
If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>
| Link: https://lore.kernel.org/oe-kbuild-all/202303091603.UuxHblt7-lkp@intel.com/
All warnings (new ones prefixed by >>):
drivers/hwtracing/coresight/coresight-tmc-etr.c: In function 'tmc_etr_get_sysfs_buffer':
>> drivers/hwtracing/coresight/coresight-tmc-etr.c:1174:13: warning: variable 'ret' set but not used [-Wunused-but-set-variable]
1174 | int ret = 0;
| ^~~
vim +/ret +1174 drivers/hwtracing/coresight/coresight-tmc-etr.c
6c6ed1e244c053 Mathieu Poirier 2016-05-03 1171
3651e0e04e2a01 James Clark 2023-03-08 1172 static struct etr_buf *tmc_etr_get_sysfs_buffer(struct coresight_device *csdev)
6c6ed1e244c053 Mathieu Poirier 2016-05-03 1173 {
de5461970b3e9e Mathieu Poirier 2016-05-03 @1174 int ret = 0;
6c6ed1e244c053 Mathieu Poirier 2016-05-03 1175 unsigned long flags;
6c6ed1e244c053 Mathieu Poirier 2016-05-03 1176 struct tmc_drvdata *drvdata = dev_get_drvdata(csdev->dev.parent);
96a7f644006ecc Suzuki K Poulose 2018-09-20 1177 struct etr_buf *sysfs_buf = NULL, *new_buf = NULL, *free_buf = NULL;
6c6ed1e244c053 Mathieu Poirier 2016-05-03 1178
de5461970b3e9e Mathieu Poirier 2016-05-03 1179 /*
75f4e3619fe202 Suzuki K Poulose 2018-07-11 1180 * If we are enabling the ETR from disabled state, we need to make
75f4e3619fe202 Suzuki K Poulose 2018-07-11 1181 * sure we have a buffer with the right size. The etr_buf is not reset
75f4e3619fe202 Suzuki K Poulose 2018-07-11 1182 * immediately after we stop the tracing in SYSFS mode as we wait for
75f4e3619fe202 Suzuki K Poulose 2018-07-11 1183 * the user to collect the data. We may be able to reuse the existing
75f4e3619fe202 Suzuki K Poulose 2018-07-11 1184 * buffer, provided the size matches. Any allocation has to be done
75f4e3619fe202 Suzuki K Poulose 2018-07-11 1185 * with the lock released.
de5461970b3e9e Mathieu Poirier 2016-05-03 1186 */
6c6ed1e244c053 Mathieu Poirier 2016-05-03 1187 spin_lock_irqsave(&drvdata->spinlock, flags);
96a7f644006ecc Suzuki K Poulose 2018-09-20 1188 sysfs_buf = READ_ONCE(drvdata->sysfs_buf);
96a7f644006ecc Suzuki K Poulose 2018-09-20 1189 if (!sysfs_buf || (sysfs_buf->size != drvdata->size)) {
6c6ed1e244c053 Mathieu Poirier 2016-05-03 1190 spin_unlock_irqrestore(&drvdata->spinlock, flags);
de5461970b3e9e Mathieu Poirier 2016-05-03 1191
75f4e3619fe202 Suzuki K Poulose 2018-07-11 1192 /* Allocate memory with the locks released */
75f4e3619fe202 Suzuki K Poulose 2018-07-11 1193 free_buf = new_buf = tmc_etr_setup_sysfs_buf(drvdata);
75f4e3619fe202 Suzuki K Poulose 2018-07-11 1194 if (IS_ERR(new_buf))
3651e0e04e2a01 James Clark 2023-03-08 1195 return new_buf;
de5461970b3e9e Mathieu Poirier 2016-05-03 1196
de5461970b3e9e Mathieu Poirier 2016-05-03 1197 /* Let's try again */
de5461970b3e9e Mathieu Poirier 2016-05-03 1198 spin_lock_irqsave(&drvdata->spinlock, flags);
de5461970b3e9e Mathieu Poirier 2016-05-03 1199 }
de5461970b3e9e Mathieu Poirier 2016-05-03 1200
75f4e3619fe202 Suzuki K Poulose 2018-07-11 1201 if (drvdata->reading || drvdata->mode == CS_MODE_PERF) {
de5461970b3e9e Mathieu Poirier 2016-05-03 1202 ret = -EBUSY;
de5461970b3e9e Mathieu Poirier 2016-05-03 1203 goto out;
6c6ed1e244c053 Mathieu Poirier 2016-05-03 1204 }
6c6ed1e244c053 Mathieu Poirier 2016-05-03 1205
f2facc3366d77e Mathieu Poirier 2016-05-03 1206 /*
f2facc3366d77e Mathieu Poirier 2016-05-03 1207 * In sysFS mode we can have multiple writers per sink. Since this
f2facc3366d77e Mathieu Poirier 2016-05-03 1208 * sink is already enabled no memory is needed and the HW need not be
75f4e3619fe202 Suzuki K Poulose 2018-07-11 1209 * touched, even if the buffer size has changed.
f2facc3366d77e Mathieu Poirier 2016-05-03 1210 */
f973d88b757037 Mathieu Poirier 2019-04-25 1211 if (drvdata->mode == CS_MODE_SYSFS) {
f973d88b757037 Mathieu Poirier 2019-04-25 1212 atomic_inc(csdev->refcnt);
f2facc3366d77e Mathieu Poirier 2016-05-03 1213 goto out;
f973d88b757037 Mathieu Poirier 2019-04-25 1214 }
f2facc3366d77e Mathieu Poirier 2016-05-03 1215
de5461970b3e9e Mathieu Poirier 2016-05-03 1216 /*
75f4e3619fe202 Suzuki K Poulose 2018-07-11 1217 * If we don't have a buffer or it doesn't match the requested size,
75f4e3619fe202 Suzuki K Poulose 2018-07-11 1218 * use the buffer allocated above. Otherwise reuse the existing buffer.
de5461970b3e9e Mathieu Poirier 2016-05-03 1219 */
96a7f644006ecc Suzuki K Poulose 2018-09-20 1220 sysfs_buf = READ_ONCE(drvdata->sysfs_buf);
96a7f644006ecc Suzuki K Poulose 2018-09-20 1221 if (!sysfs_buf || (new_buf && sysfs_buf->size != new_buf->size)) {
96a7f644006ecc Suzuki K Poulose 2018-09-20 1222 free_buf = sysfs_buf;
96a7f644006ecc Suzuki K Poulose 2018-09-20 1223 drvdata->sysfs_buf = new_buf;
de5461970b3e9e Mathieu Poirier 2016-05-03 1224 }
de5461970b3e9e Mathieu Poirier 2016-05-03 1225
de5461970b3e9e Mathieu Poirier 2016-05-03 1226 out:
6c6ed1e244c053 Mathieu Poirier 2016-05-03 1227 spin_unlock_irqrestore(&drvdata->spinlock, flags);
6c6ed1e244c053 Mathieu Poirier 2016-05-03 1228
de5461970b3e9e Mathieu Poirier 2016-05-03 1229 /* Free memory outside the spinlock if need be */
75f4e3619fe202 Suzuki K Poulose 2018-07-11 1230 if (free_buf)
75f4e3619fe202 Suzuki K Poulose 2018-07-11 1231 tmc_etr_free_sysfs_buf(free_buf);
3651e0e04e2a01 James Clark 2023-03-08 1232 return drvdata->sysfs_buf;
3651e0e04e2a01 James Clark 2023-03-08 1233 }
3651e0e04e2a01 James Clark 2023-03-08 1234
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests
next prev parent reply other threads:[~2023-03-09 8:22 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-08 17:38 [PATCH 0/8] coresight: Fix CTI module refcount leak by making it a helper device James Clark
2023-03-08 17:38 ` [PATCH 1/8] coresight: Use enum type for cs_mode wherever possible James Clark
2023-03-08 17:38 ` [PATCH 2/8] coresight: Change name of pdata->conns James Clark
2023-03-08 17:38 ` [PATCH 3/8] coresight: Rename nr_outports to nr_outconns James Clark
2023-03-08 17:38 ` [PATCH 4/8] coresight: Dynamically add connections James Clark
2023-03-08 17:38 ` [PATCH 5/8] coresight: Store in-connections as well as out-connections James Clark
2023-03-09 10:09 ` Suzuki K Poulose
2023-03-08 17:39 ` [PATCH 6/8] coresight: Refactor out buffer allocation function for ETR James Clark
2023-03-09 8:18 ` kernel test robot [this message]
2023-03-08 17:39 ` [PATCH 7/8] coresight: Enable and disable helper devices adjacent to the path James Clark
2023-03-08 17:39 ` [PATCH 8/8] coresight: Fix CTI module refcount leak by making it a helper device James Clark
2023-03-09 8:39 ` kernel test robot
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=202303091603.UuxHblt7-lkp@intel.com \
--to=lkp@intel.com \
--cc=alexander.shishkin@linux.intel.com \
--cc=coresight@lists.linaro.org \
--cc=james.clark@arm.com \
--cc=leo.yan@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mathieu.poirier@linaro.org \
--cc=mike.leach@linaro.org \
--cc=oe-kbuild-all@lists.linux.dev \
--cc=suzuki.poulose@arm.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