All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jani Nikula <jani.nikula@linux.intel.com>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	"Avizrat, Yaron" <yaron.avizrat@intel.com>,
	"Elbaz, Koby" <koby.elbaz@intel.com>,
	"Sinyuk, Konstantin" <konstantin.sinyuk@intel.com>
Subject: Re: [PATCH v2 1/1] accel/habanalabs: Switch to use %ptTs
Date: Tue, 04 Mar 2025 21:01:59 +0200	[thread overview]
Message-ID: <87jz94y5zs.fsf@intel.com> (raw)
In-Reply-To: <20250206192109.1133364-2-andriy.shevchenko@linux.intel.com>

On Thu, 06 Feb 2025, Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:
> Use %ptTs instead of open-coded variant to print contents of time64_t type
> in human readable form.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
>
> v2: fixed the parameters to be the pointers
>
>  drivers/accel/habanalabs/common/device.c | 25 +++---------------------
>  1 file changed, 3 insertions(+), 22 deletions(-)
>
> diff --git a/drivers/accel/habanalabs/common/device.c b/drivers/accel/habanalabs/common/device.c
> index 30277ae410d4..96897c12dfee 100644
> --- a/drivers/accel/habanalabs/common/device.c
> +++ b/drivers/accel/habanalabs/common/device.c
> @@ -1066,28 +1066,11 @@ static bool is_pci_link_healthy(struct hl_device *hdev)
>  	return (device_id == hdev->pdev->device);
>  }
>  
> -static void stringify_time_of_last_heartbeat(struct hl_device *hdev, char *time_str, size_t size,
> -						bool is_pq_hb)
> -{
> -	time64_t seconds = is_pq_hb ? hdev->heartbeat_debug_info.last_pq_heartbeat_ts
> -					: hdev->heartbeat_debug_info.last_eq_heartbeat_ts;
> -	struct tm tm;
> -
> -	if (!seconds)
> -		return;
> -
> -	time64_to_tm(seconds, 0, &tm);
> -
> -	snprintf(time_str, size, "%ld-%02d-%02d %02d:%02d:%02d (UTC)",
> -		tm.tm_year + 1900, tm.tm_mon, tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec);
> -}
> -
>  static bool hl_device_eq_heartbeat_received(struct hl_device *hdev)
>  {
>  	struct eq_heartbeat_debug_info *heartbeat_debug_info = &hdev->heartbeat_debug_info;
>  	u32 cpu_q_id = heartbeat_debug_info->cpu_queue_id, pq_pi_mask = (HL_QUEUE_LENGTH << 1) - 1;
>  	struct asic_fixed_properties *prop = &hdev->asic_prop;
> -	char pq_time_str[64] = "N/A", eq_time_str[64] = "N/A";

The "N/A" gets replaced with, I presume, "1970-01-01 00:00:00" for 0
timestamps, which is not the same thing.

But I honestly don't know anything about the driver.


BR,
Jani.

>  
>  	if (!prop->cpucp_info.eq_health_check_supported)
>  		return true;
> @@ -1095,17 +1078,15 @@ static bool hl_device_eq_heartbeat_received(struct hl_device *hdev)
>  	if (!hdev->eq_heartbeat_received) {
>  		dev_err(hdev->dev, "EQ heartbeat event was not received!\n");
>  
> -		stringify_time_of_last_heartbeat(hdev, pq_time_str, sizeof(pq_time_str), true);
> -		stringify_time_of_last_heartbeat(hdev, eq_time_str, sizeof(eq_time_str), false);
>  		dev_err(hdev->dev,
> -			"EQ: {CI %u, HB counter %u, last HB time: %s}, PQ: {PI: %u, CI: %u (%u), last HB time: %s}\n",
> +			"EQ: {CI %u, HB counter %u, last HB time: %ptTs}, PQ: {PI: %u, CI: %u (%u), last HB time: %ptTs}\n",
>  			hdev->event_queue.ci,
>  			heartbeat_debug_info->heartbeat_event_counter,
> -			eq_time_str,
> +			&hdev->heartbeat_debug_info.last_eq_heartbeat_ts,
>  			hdev->kernel_queues[cpu_q_id].pi,
>  			atomic_read(&hdev->kernel_queues[cpu_q_id].ci),
>  			atomic_read(&hdev->kernel_queues[cpu_q_id].ci) & pq_pi_mask,
> -			pq_time_str);
> +			&hdev->heartbeat_debug_info.last_pq_heartbeat_ts);
>  
>  		hl_eq_dump(hdev, &hdev->event_queue);

-- 
Jani Nikula, Intel

  parent reply	other threads:[~2025-03-04 19:02 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-06 19:20 [PATCH v2 1/1] accel/habanalabs: Switch to use %ptTs Andy Shevchenko
2025-03-04 14:40 ` Andy Shevchenko
2025-03-04 19:01 ` Jani Nikula [this message]
2025-03-05  9:40   ` Andy Shevchenko

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=87jz94y5zs.fsf@intel.com \
    --to=jani.nikula@linux.intel.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=koby.elbaz@intel.com \
    --cc=konstantin.sinyuk@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=yaron.avizrat@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 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.