From: Przemek Kitszel <przemyslaw.kitszel@intel.com>
To: Simon Horman <horms@kernel.org>,
Mateusz Polchlopek <mateusz.polchlopek@intel.com>
Cc: <intel-wired-lan@lists.osuosl.org>, <apw@canonical.com>,
<joe@perches.com>, <dwaipayanray1@gmail.com>,
<lukas.bulwahn@gmail.com>, <akpm@linux-foundation.org>,
<willemb@google.com>, <edumazet@google.com>,
<linux-kernel@vger.kernel.org>, <netdev@vger.kernel.org>,
Igor Bagnucki <igor.bagnucki@intel.com>,
Wojciech Drewek <wojciech.drewek@intel.com>
Subject: Re: [Intel-wired-lan] [PATCH iwl-next v1 3/6] ice: add Tx hang devlink health reporter
Date: Wed, 10 Jul 2024 15:59:23 +0200 [thread overview]
Message-ID: <b83d8d92-44c5-438f-acef-d5781ab44f0d@intel.com> (raw)
In-Reply-To: <20240708124055.GN1481495@kernel.org>
On 7/8/24 14:40, Simon Horman wrote:
> On Wed, Jul 03, 2024 at 08:59:19AM -0400, Mateusz Polchlopek wrote:
>> From: Przemek Kitszel <przemyslaw.kitszel@intel.com>
>>
>> Add Tx hang devlink health reporter, see struct ice_tx_hang_event to see
>> what is reported.
>>
>> Subsequent commits will extend it by more info, for now it dumps
>> descriptors with little metadata.
>>
>> Signed-off-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
>> Reviewed-by: Igor Bagnucki <igor.bagnucki@intel.com>
>> Reviewed-by: Wojciech Drewek <wojciech.drewek@intel.com>
>> Signed-off-by: Mateusz Polchlopek <mateusz.polchlopek@intel.com>
>
> ...
>
>> +/**
>> + * ice_fmsg_put_ptr - put hex value of pointer into fmsg
>> + *
>> + * @fmsg: devlink fmsg under construction
>> + * @name: name to pass
>> + * @ptr: 64 bit value to print as hex and put into fmsg
>> + */
>> +static void ice_fmsg_put_ptr(struct devlink_fmsg *fmsg, const char *name,
>> + void *ptr)
>> +{
>> + char buf[sizeof(ptr) * 3];
>> +
>> + sprintf(buf, "%p", ptr);
>> + devlink_fmsg_put(fmsg, name, buf);
>> +}
>
> ...
>
>> +static int ice_tx_hang_reporter_dump(struct devlink_health_reporter *reporter,
>> + struct devlink_fmsg *fmsg, void *priv_ctx,
>> + struct netlink_ext_ack *extack)
>> +{
>> + struct ice_tx_hang_event *event = priv_ctx;
>> +
>> + devlink_fmsg_obj_nest_start(fmsg);
>> + ICE_DEVLINK_FMSG_PUT_FIELD(fmsg, event, head);
>> + ICE_DEVLINK_FMSG_PUT_FIELD(fmsg, event, intr);
>> + ICE_DEVLINK_FMSG_PUT_FIELD(fmsg, event, vsi_num);
>> + ICE_DEVLINK_FMSG_PUT_FIELD(fmsg, event, queue);
>> + ICE_DEVLINK_FMSG_PUT_FIELD(fmsg, event, next_to_clean);
>> + ICE_DEVLINK_FMSG_PUT_FIELD(fmsg, event, next_to_use);
>> + devlink_fmsg_put(fmsg, "irq-mapping", event->tx_ring->q_vector->name);
>> + ice_fmsg_put_ptr(fmsg, "desc-ptr", event->tx_ring->desc);
>> + ice_fmsg_put_ptr(fmsg, "dma-ptr", (void *)event->tx_ring->dma);
>
> As reported by the kernel test robot, GCC 13 complains about this cast:
>
> .../devlink_health.c: In function 'ice_tx_hang_reporter_dump':
> .../devlink_health.c:76:43: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
> 76 | ice_fmsg_put_ptr(fmsg, "dma-ptr", (void *)event->tx_ring->dma);
> |
>
> Perhaps a good solution is to add a helper similar to ice_fmsg_put_ptr,
> but which takes a dma_buf_t rather than a void * as it's last argument.
instead of duplicating the function for just one call, I will simply
resolve the warning by yet another cast:
ice_fmsg_put_ptr(fmsg, "dma-ptr", (void *)(long)event->tx_ring->dma);
^^^^^^ // cast to long added
>
>> + devlink_fmsg_binary_pair_put(fmsg, "desc", event->tx_ring->desc,
>> + size_mul(event->tx_ring->count,
>> + sizeof(struct ice_tx_desc)));
Here I would drop size_mul(), as any wrong ::count value could easily
extent the dump past tx_ring memory, resulting in attempt at reading
past their page
And we are not really protecting against "too big" fmsg, as it is capped
anyway to 4-8K.
Perhaps fmsg-put also ::count to aid spotting such cases, but only if it
is not the default 256.
--
not a change request, just digression:
it would be nice for devlink_fmsg_binary_pair_put() to compress
"repeated same value", like hexdump(1) does.
>> + devlink_fmsg_obj_nest_end(fmsg);
>> +
>> + return 0;
>> +}
next prev parent reply other threads:[~2024-07-10 13:59 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-03 12:59 [Intel-wired-lan] [PATCH iwl-next v1 0/6] Add support for devlink health events Mateusz Polchlopek
2024-07-03 12:59 ` [Intel-wired-lan] [PATCH iwl-next v1 1/6] checkpatch: don't complain on _Generic() use Mateusz Polchlopek
2024-07-08 12:41 ` Simon Horman
2024-07-03 12:59 ` [Intel-wired-lan] [PATCH iwl-next v1 2/6] devlink: add devlink_fmsg_put() macro Mateusz Polchlopek
2024-07-08 12:41 ` Simon Horman
2024-07-03 12:59 ` [Intel-wired-lan] [PATCH iwl-next v1 3/6] ice: add Tx hang devlink health reporter Mateusz Polchlopek
2024-07-05 0:23 ` kernel test robot
2024-07-08 12:40 ` Simon Horman
2024-07-10 13:59 ` Przemek Kitszel [this message]
2024-07-03 12:59 ` [Intel-wired-lan] [PATCH iwl-next v1 4/6] ice: print ethtool stats as part of " Mateusz Polchlopek
2024-07-08 12:41 ` Simon Horman
2024-07-03 12:59 ` [Intel-wired-lan] [PATCH iwl-next v1 5/6] ice: Add MDD logging via devlink health Mateusz Polchlopek
2024-07-08 12:42 ` Simon Horman
2024-07-03 12:59 ` [Intel-wired-lan] [PATCH iwl-next v1 6/6] ice: devlink health: dump also skb on Tx hang Mateusz Polchlopek
2024-07-08 12:42 ` Simon Horman
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=b83d8d92-44c5-438f-acef-d5781ab44f0d@intel.com \
--to=przemyslaw.kitszel@intel.com \
--cc=akpm@linux-foundation.org \
--cc=apw@canonical.com \
--cc=dwaipayanray1@gmail.com \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=igor.bagnucki@intel.com \
--cc=intel-wired-lan@lists.osuosl.org \
--cc=joe@perches.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lukas.bulwahn@gmail.com \
--cc=mateusz.polchlopek@intel.com \
--cc=netdev@vger.kernel.org \
--cc=willemb@google.com \
--cc=wojciech.drewek@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
all inboxes | Powered by JetHome®