From: Julia Lawall <julia.lawall@inria.fr>
To: Mathieu Poirier <mathieu.poirier@linaro.org>,
ohad@wizery.com, bjorn.andersson@linaro.org,
arnaud.pouliquen@st.com
Cc: robh+dt@kernel.org, mcoquelin.stm32@gmail.com,
alexandre.torgue@st.com, linux-remoteproc@vger.kernel.org,
devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org, kbuild-all@lists.01.org
Subject: Re: [PATCH v5 13/19] remoteproc: Properly deal with the resource table (fwd)
Date: Sun, 14 Feb 2021 23:33:09 +0100 (CET) [thread overview]
Message-ID: <alpine.DEB.2.22.394.2102142331120.2942@hadrien> (raw)
[-- Attachment #1: Type: text/plain, Size: 7944 bytes --]
There are identical kfrees on lines 2078 and 2080.
julia
---------- Forwarded message ----------
Date: Fri, 12 Feb 2021 10:45:50 +0800
From: kernel test robot <lkp@intel.com>
To: kbuild@lists.01.org
Cc: lkp@intel.com, Julia Lawall <julia.lawall@lip6.fr>
Subject: Re: [PATCH v5 13/19] remoteproc: Properly deal with the resource table
CC: kbuild-all@lists.01.org
In-Reply-To: <20210211234627.2669674-14-mathieu.poirier@linaro.org>
References: <20210211234627.2669674-14-mathieu.poirier@linaro.org>
TO: Mathieu Poirier <mathieu.poirier@linaro.org>
TO: ohad@wizery.com
TO: bjorn.andersson@linaro.org
TO: arnaud.pouliquen@st.com
CC: robh+dt@kernel.org
CC: mcoquelin.stm32@gmail.com
CC: alexandre.torgue@st.com
CC: linux-remoteproc@vger.kernel.org
CC: devicetree@vger.kernel.org
CC: linux-kernel@vger.kernel.org
CC: linux-arm-kernel@lists.infradead.org
Hi Mathieu,
I love your patch! Perhaps something to improve:
[auto build test WARNING on robh/for-next]
[also build test WARNING on linus/master v5.11-rc7 next-20210211]
[cannot apply to remoteproc/for-next rpmsg/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]
url: https://github.com/0day-ci/linux/commits/Mathieu-Poirier/remoteproc-Add-support-for-detaching-a-remote-processor/20210212-075607
base: https://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git for-next
:::::: branch date: 3 hours ago
:::::: commit date: 3 hours ago
config: openrisc-randconfig-c003-20210209 (attached as .config)
compiler: or1k-linux-gcc (GCC) 9.3.0
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Julia Lawall <julia.lawall@lip6.fr>
"coccinelle warnings: (new ones prefixed by >>)"
>> drivers/remoteproc/remoteproc_core.c:2080:7-26: ERROR: reference preceded by free on line 2078
vim +2080 drivers/remoteproc/remoteproc_core.c
400e64df6b237e Ohad Ben-Cohen 2011-10-20 2012
eab58da78fe46f Mathieu Poirier 2021-02-11 2013 /**
eab58da78fe46f Mathieu Poirier 2021-02-11 2014 * rproc_detach() - Detach the remote processor from the
eab58da78fe46f Mathieu Poirier 2021-02-11 2015 * remoteproc core
eab58da78fe46f Mathieu Poirier 2021-02-11 2016 *
eab58da78fe46f Mathieu Poirier 2021-02-11 2017 * @rproc: the remote processor
eab58da78fe46f Mathieu Poirier 2021-02-11 2018 *
eab58da78fe46f Mathieu Poirier 2021-02-11 2019 * Detach a remote processor (previously attached to with rproc_attach()).
eab58da78fe46f Mathieu Poirier 2021-02-11 2020 *
eab58da78fe46f Mathieu Poirier 2021-02-11 2021 * In case @rproc is still being used by an additional user(s), then
eab58da78fe46f Mathieu Poirier 2021-02-11 2022 * this function will just decrement the power refcount and exit,
eab58da78fe46f Mathieu Poirier 2021-02-11 2023 * without disconnecting the device.
eab58da78fe46f Mathieu Poirier 2021-02-11 2024 *
eab58da78fe46f Mathieu Poirier 2021-02-11 2025 * Function rproc_detach() calls __rproc_detach() in order to let a remote
eab58da78fe46f Mathieu Poirier 2021-02-11 2026 * processor know that services provided by the application processor are
eab58da78fe46f Mathieu Poirier 2021-02-11 2027 * no longer available. From there it should be possible to remove the
eab58da78fe46f Mathieu Poirier 2021-02-11 2028 * platform driver and even power cycle the application processor (if the HW
eab58da78fe46f Mathieu Poirier 2021-02-11 2029 * supports it) without needing to switch off the remote processor.
eab58da78fe46f Mathieu Poirier 2021-02-11 2030 */
eab58da78fe46f Mathieu Poirier 2021-02-11 2031 int rproc_detach(struct rproc *rproc)
eab58da78fe46f Mathieu Poirier 2021-02-11 2032 {
eab58da78fe46f Mathieu Poirier 2021-02-11 2033 struct device *dev = &rproc->dev;
eab58da78fe46f Mathieu Poirier 2021-02-11 2034 int ret;
eab58da78fe46f Mathieu Poirier 2021-02-11 2035
eab58da78fe46f Mathieu Poirier 2021-02-11 2036 ret = mutex_lock_interruptible(&rproc->lock);
eab58da78fe46f Mathieu Poirier 2021-02-11 2037 if (ret) {
eab58da78fe46f Mathieu Poirier 2021-02-11 2038 dev_err(dev, "can't lock rproc %s: %d\n", rproc->name, ret);
eab58da78fe46f Mathieu Poirier 2021-02-11 2039 return ret;
eab58da78fe46f Mathieu Poirier 2021-02-11 2040 }
eab58da78fe46f Mathieu Poirier 2021-02-11 2041
eab58da78fe46f Mathieu Poirier 2021-02-11 2042 if (rproc->state != RPROC_RUNNING && rproc->state != RPROC_ATTACHED) {
eab58da78fe46f Mathieu Poirier 2021-02-11 2043 ret = -EPERM;
eab58da78fe46f Mathieu Poirier 2021-02-11 2044 goto out;
eab58da78fe46f Mathieu Poirier 2021-02-11 2045 }
eab58da78fe46f Mathieu Poirier 2021-02-11 2046
eab58da78fe46f Mathieu Poirier 2021-02-11 2047 /* if the remote proc is still needed, bail out */
eab58da78fe46f Mathieu Poirier 2021-02-11 2048 if (!atomic_dec_and_test(&rproc->power)) {
eab58da78fe46f Mathieu Poirier 2021-02-11 2049 ret = -EBUSY;
eab58da78fe46f Mathieu Poirier 2021-02-11 2050 goto out;
eab58da78fe46f Mathieu Poirier 2021-02-11 2051 }
eab58da78fe46f Mathieu Poirier 2021-02-11 2052
eab58da78fe46f Mathieu Poirier 2021-02-11 2053 ret = __rproc_detach(rproc);
eab58da78fe46f Mathieu Poirier 2021-02-11 2054 if (ret) {
eab58da78fe46f Mathieu Poirier 2021-02-11 2055 atomic_inc(&rproc->power);
eab58da78fe46f Mathieu Poirier 2021-02-11 2056 goto out;
eab58da78fe46f Mathieu Poirier 2021-02-11 2057 }
eab58da78fe46f Mathieu Poirier 2021-02-11 2058
66e2fed7a4bb20 Mathieu Poirier 2021-02-11 2059 /*
66e2fed7a4bb20 Mathieu Poirier 2021-02-11 2060 * Install a clean resource table for re-attach while
66e2fed7a4bb20 Mathieu Poirier 2021-02-11 2061 * rproc->table_ptr is still valid.
66e2fed7a4bb20 Mathieu Poirier 2021-02-11 2062 */
66e2fed7a4bb20 Mathieu Poirier 2021-02-11 2063 ret = rproc_reset_loaded_rsc_table(rproc);
66e2fed7a4bb20 Mathieu Poirier 2021-02-11 2064 if (ret) {
66e2fed7a4bb20 Mathieu Poirier 2021-02-11 2065 atomic_inc(&rproc->power);
66e2fed7a4bb20 Mathieu Poirier 2021-02-11 2066 goto out;
66e2fed7a4bb20 Mathieu Poirier 2021-02-11 2067 }
66e2fed7a4bb20 Mathieu Poirier 2021-02-11 2068
eab58da78fe46f Mathieu Poirier 2021-02-11 2069 /* clean up all acquired resources */
eab58da78fe46f Mathieu Poirier 2021-02-11 2070 rproc_resource_cleanup(rproc);
eab58da78fe46f Mathieu Poirier 2021-02-11 2071
eab58da78fe46f Mathieu Poirier 2021-02-11 2072 /* release HW resources if needed */
eab58da78fe46f Mathieu Poirier 2021-02-11 2073 rproc_unprepare_device(rproc);
eab58da78fe46f Mathieu Poirier 2021-02-11 2074
eab58da78fe46f Mathieu Poirier 2021-02-11 2075 rproc_disable_iommu(rproc);
eab58da78fe46f Mathieu Poirier 2021-02-11 2076
66e2fed7a4bb20 Mathieu Poirier 2021-02-11 2077 /* Free the copy of the resource table */
66e2fed7a4bb20 Mathieu Poirier 2021-02-11 @2078 kfree(rproc->cached_table);
eab58da78fe46f Mathieu Poirier 2021-02-11 2079 /* Follow the same sequence as in rproc_shutdown() */
eab58da78fe46f Mathieu Poirier 2021-02-11 @2080 kfree(rproc->cached_table);
eab58da78fe46f Mathieu Poirier 2021-02-11 2081 rproc->cached_table = NULL;
66e2fed7a4bb20 Mathieu Poirier 2021-02-11 2082 rproc->clean_table = NULL;
eab58da78fe46f Mathieu Poirier 2021-02-11 2083 rproc->table_ptr = NULL;
66e2fed7a4bb20 Mathieu Poirier 2021-02-11 2084
eab58da78fe46f Mathieu Poirier 2021-02-11 2085 out:
eab58da78fe46f Mathieu Poirier 2021-02-11 2086 mutex_unlock(&rproc->lock);
eab58da78fe46f Mathieu Poirier 2021-02-11 2087 return ret;
eab58da78fe46f Mathieu Poirier 2021-02-11 2088 }
eab58da78fe46f Mathieu Poirier 2021-02-11 2089 EXPORT_SYMBOL(rproc_detach);
eab58da78fe46f Mathieu Poirier 2021-02-11 2090
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
[-- Attachment #2: Type: application/gzip, Size: 24584 bytes --]
WARNING: multiple messages have this Message-ID (diff)
From: Julia Lawall <julia.lawall@inria.fr>
To: kbuild-all@lists.01.org
Subject: Re: [PATCH v5 13/19] remoteproc: Properly deal with the resource table (fwd)
Date: Sun, 14 Feb 2021 23:33:09 +0100 [thread overview]
Message-ID: <alpine.DEB.2.22.394.2102142331120.2942@hadrien> (raw)
[-- Attachment #1: Type: text/plain, Size: 8110 bytes --]
There are identical kfrees on lines 2078 and 2080.
julia
---------- Forwarded message ----------
Date: Fri, 12 Feb 2021 10:45:50 +0800
From: kernel test robot <lkp@intel.com>
To: kbuild(a)lists.01.org
Cc: lkp(a)intel.com, Julia Lawall <julia.lawall@lip6.fr>
Subject: Re: [PATCH v5 13/19] remoteproc: Properly deal with the resource table
CC: kbuild-all(a)lists.01.org
In-Reply-To: <20210211234627.2669674-14-mathieu.poirier@linaro.org>
References: <20210211234627.2669674-14-mathieu.poirier@linaro.org>
TO: Mathieu Poirier <mathieu.poirier@linaro.org>
TO: ohad(a)wizery.com
TO: bjorn.andersson(a)linaro.org
TO: arnaud.pouliquen(a)st.com
CC: robh+dt(a)kernel.org
CC: mcoquelin.stm32(a)gmail.com
CC: alexandre.torgue(a)st.com
CC: linux-remoteproc(a)vger.kernel.org
CC: devicetree(a)vger.kernel.org
CC: linux-kernel(a)vger.kernel.org
CC: linux-arm-kernel(a)lists.infradead.org
Hi Mathieu,
I love your patch! Perhaps something to improve:
[auto build test WARNING on robh/for-next]
[also build test WARNING on linus/master v5.11-rc7 next-20210211]
[cannot apply to remoteproc/for-next rpmsg/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]
url: https://github.com/0day-ci/linux/commits/Mathieu-Poirier/remoteproc-Add-support-for-detaching-a-remote-processor/20210212-075607
base: https://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git for-next
:::::: branch date: 3 hours ago
:::::: commit date: 3 hours ago
config: openrisc-randconfig-c003-20210209 (attached as .config)
compiler: or1k-linux-gcc (GCC) 9.3.0
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Julia Lawall <julia.lawall@lip6.fr>
"coccinelle warnings: (new ones prefixed by >>)"
>> drivers/remoteproc/remoteproc_core.c:2080:7-26: ERROR: reference preceded by free on line 2078
vim +2080 drivers/remoteproc/remoteproc_core.c
400e64df6b237e Ohad Ben-Cohen 2011-10-20 2012
eab58da78fe46f Mathieu Poirier 2021-02-11 2013 /**
eab58da78fe46f Mathieu Poirier 2021-02-11 2014 * rproc_detach() - Detach the remote processor from the
eab58da78fe46f Mathieu Poirier 2021-02-11 2015 * remoteproc core
eab58da78fe46f Mathieu Poirier 2021-02-11 2016 *
eab58da78fe46f Mathieu Poirier 2021-02-11 2017 * @rproc: the remote processor
eab58da78fe46f Mathieu Poirier 2021-02-11 2018 *
eab58da78fe46f Mathieu Poirier 2021-02-11 2019 * Detach a remote processor (previously attached to with rproc_attach()).
eab58da78fe46f Mathieu Poirier 2021-02-11 2020 *
eab58da78fe46f Mathieu Poirier 2021-02-11 2021 * In case @rproc is still being used by an additional user(s), then
eab58da78fe46f Mathieu Poirier 2021-02-11 2022 * this function will just decrement the power refcount and exit,
eab58da78fe46f Mathieu Poirier 2021-02-11 2023 * without disconnecting the device.
eab58da78fe46f Mathieu Poirier 2021-02-11 2024 *
eab58da78fe46f Mathieu Poirier 2021-02-11 2025 * Function rproc_detach() calls __rproc_detach() in order to let a remote
eab58da78fe46f Mathieu Poirier 2021-02-11 2026 * processor know that services provided by the application processor are
eab58da78fe46f Mathieu Poirier 2021-02-11 2027 * no longer available. From there it should be possible to remove the
eab58da78fe46f Mathieu Poirier 2021-02-11 2028 * platform driver and even power cycle the application processor (if the HW
eab58da78fe46f Mathieu Poirier 2021-02-11 2029 * supports it) without needing to switch off the remote processor.
eab58da78fe46f Mathieu Poirier 2021-02-11 2030 */
eab58da78fe46f Mathieu Poirier 2021-02-11 2031 int rproc_detach(struct rproc *rproc)
eab58da78fe46f Mathieu Poirier 2021-02-11 2032 {
eab58da78fe46f Mathieu Poirier 2021-02-11 2033 struct device *dev = &rproc->dev;
eab58da78fe46f Mathieu Poirier 2021-02-11 2034 int ret;
eab58da78fe46f Mathieu Poirier 2021-02-11 2035
eab58da78fe46f Mathieu Poirier 2021-02-11 2036 ret = mutex_lock_interruptible(&rproc->lock);
eab58da78fe46f Mathieu Poirier 2021-02-11 2037 if (ret) {
eab58da78fe46f Mathieu Poirier 2021-02-11 2038 dev_err(dev, "can't lock rproc %s: %d\n", rproc->name, ret);
eab58da78fe46f Mathieu Poirier 2021-02-11 2039 return ret;
eab58da78fe46f Mathieu Poirier 2021-02-11 2040 }
eab58da78fe46f Mathieu Poirier 2021-02-11 2041
eab58da78fe46f Mathieu Poirier 2021-02-11 2042 if (rproc->state != RPROC_RUNNING && rproc->state != RPROC_ATTACHED) {
eab58da78fe46f Mathieu Poirier 2021-02-11 2043 ret = -EPERM;
eab58da78fe46f Mathieu Poirier 2021-02-11 2044 goto out;
eab58da78fe46f Mathieu Poirier 2021-02-11 2045 }
eab58da78fe46f Mathieu Poirier 2021-02-11 2046
eab58da78fe46f Mathieu Poirier 2021-02-11 2047 /* if the remote proc is still needed, bail out */
eab58da78fe46f Mathieu Poirier 2021-02-11 2048 if (!atomic_dec_and_test(&rproc->power)) {
eab58da78fe46f Mathieu Poirier 2021-02-11 2049 ret = -EBUSY;
eab58da78fe46f Mathieu Poirier 2021-02-11 2050 goto out;
eab58da78fe46f Mathieu Poirier 2021-02-11 2051 }
eab58da78fe46f Mathieu Poirier 2021-02-11 2052
eab58da78fe46f Mathieu Poirier 2021-02-11 2053 ret = __rproc_detach(rproc);
eab58da78fe46f Mathieu Poirier 2021-02-11 2054 if (ret) {
eab58da78fe46f Mathieu Poirier 2021-02-11 2055 atomic_inc(&rproc->power);
eab58da78fe46f Mathieu Poirier 2021-02-11 2056 goto out;
eab58da78fe46f Mathieu Poirier 2021-02-11 2057 }
eab58da78fe46f Mathieu Poirier 2021-02-11 2058
66e2fed7a4bb20 Mathieu Poirier 2021-02-11 2059 /*
66e2fed7a4bb20 Mathieu Poirier 2021-02-11 2060 * Install a clean resource table for re-attach while
66e2fed7a4bb20 Mathieu Poirier 2021-02-11 2061 * rproc->table_ptr is still valid.
66e2fed7a4bb20 Mathieu Poirier 2021-02-11 2062 */
66e2fed7a4bb20 Mathieu Poirier 2021-02-11 2063 ret = rproc_reset_loaded_rsc_table(rproc);
66e2fed7a4bb20 Mathieu Poirier 2021-02-11 2064 if (ret) {
66e2fed7a4bb20 Mathieu Poirier 2021-02-11 2065 atomic_inc(&rproc->power);
66e2fed7a4bb20 Mathieu Poirier 2021-02-11 2066 goto out;
66e2fed7a4bb20 Mathieu Poirier 2021-02-11 2067 }
66e2fed7a4bb20 Mathieu Poirier 2021-02-11 2068
eab58da78fe46f Mathieu Poirier 2021-02-11 2069 /* clean up all acquired resources */
eab58da78fe46f Mathieu Poirier 2021-02-11 2070 rproc_resource_cleanup(rproc);
eab58da78fe46f Mathieu Poirier 2021-02-11 2071
eab58da78fe46f Mathieu Poirier 2021-02-11 2072 /* release HW resources if needed */
eab58da78fe46f Mathieu Poirier 2021-02-11 2073 rproc_unprepare_device(rproc);
eab58da78fe46f Mathieu Poirier 2021-02-11 2074
eab58da78fe46f Mathieu Poirier 2021-02-11 2075 rproc_disable_iommu(rproc);
eab58da78fe46f Mathieu Poirier 2021-02-11 2076
66e2fed7a4bb20 Mathieu Poirier 2021-02-11 2077 /* Free the copy of the resource table */
66e2fed7a4bb20 Mathieu Poirier 2021-02-11 @2078 kfree(rproc->cached_table);
eab58da78fe46f Mathieu Poirier 2021-02-11 2079 /* Follow the same sequence as in rproc_shutdown() */
eab58da78fe46f Mathieu Poirier 2021-02-11 @2080 kfree(rproc->cached_table);
eab58da78fe46f Mathieu Poirier 2021-02-11 2081 rproc->cached_table = NULL;
66e2fed7a4bb20 Mathieu Poirier 2021-02-11 2082 rproc->clean_table = NULL;
eab58da78fe46f Mathieu Poirier 2021-02-11 2083 rproc->table_ptr = NULL;
66e2fed7a4bb20 Mathieu Poirier 2021-02-11 2084
eab58da78fe46f Mathieu Poirier 2021-02-11 2085 out:
eab58da78fe46f Mathieu Poirier 2021-02-11 2086 mutex_unlock(&rproc->lock);
eab58da78fe46f Mathieu Poirier 2021-02-11 2087 return ret;
eab58da78fe46f Mathieu Poirier 2021-02-11 2088 }
eab58da78fe46f Mathieu Poirier 2021-02-11 2089 EXPORT_SYMBOL(rproc_detach);
eab58da78fe46f Mathieu Poirier 2021-02-11 2090
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 24584 bytes --]
next reply other threads:[~2021-02-14 22:34 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-14 22:33 Julia Lawall [this message]
2021-02-14 22:33 ` [PATCH v5 13/19] remoteproc: Properly deal with the resource table (fwd) Julia Lawall
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=alpine.DEB.2.22.394.2102142331120.2942@hadrien \
--to=julia.lawall@inria.fr \
--cc=alexandre.torgue@st.com \
--cc=arnaud.pouliquen@st.com \
--cc=bjorn.andersson@linaro.org \
--cc=devicetree@vger.kernel.org \
--cc=kbuild-all@lists.01.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-remoteproc@vger.kernel.org \
--cc=mathieu.poirier@linaro.org \
--cc=mcoquelin.stm32@gmail.com \
--cc=ohad@wizery.com \
--cc=robh+dt@kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.