From: Simon Glass Date: Mon, 8 Apr 2019 13:20:49 -0600 Subject: [U-Boot] [PATCH v2 09/13] div64: Don't instrument the division function In-Reply-To: <20190408192053.236725-1-sjg@chromium.org> References: <20190408192053.236725-1-sjg@chromium.org> Message-ID: <20190408192053.236725-10-sjg@chromium.org> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de This function may be called from tracing code, since that code needs to read the timer and this often requires calling do_div(), which calls __div64_32(). If this function is instrumented it causes an infinite loop, since emitting a trace record requests the time, which in turn emits a trace record, etc. Update the prototype to prevent instrumentation code being added. Signed-off-by: Simon Glass --- Changes in v2: - Add new patch to avoid instrumenting the division function lib/div64.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/div64.c b/lib/div64.c index 7abc68c3332..62933c92c4f 100644 --- a/lib/div64.c +++ b/lib/div64.c @@ -25,7 +25,13 @@ #if BITS_PER_LONG == 32 #ifndef __div64_32 -u32 __attribute__((weak)) __div64_32(u64 *n, u32 base) +/* + * Don't instrument this function as it may be called from tracing code, since + * it needs to read the timer and this often requires calling do_div(), which + * calls this function. + */ +uint32_t __attribute__((weak, no_instrument_function)) __div64_32(u64 *n, + u32 base) { u64 rem = *n; u64 b = base; -- 2.21.0.392.gf8f6787159e-goog