lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240708124055.GN1481495@kernel.org>
Date: Mon, 8 Jul 2024 13:40:55 +0100
From: Simon Horman <horms@...nel.org>
To: Mateusz Polchlopek <mateusz.polchlopek@...el.com>
Cc: intel-wired-lan@...ts.osuosl.org, apw@...onical.com, joe@...ches.com,
	dwaipayanray1@...il.com, lukas.bulwahn@...il.com,
	akpm@...ux-foundation.org, willemb@...gle.com, edumazet@...gle.com,
	linux-kernel@...r.kernel.org, netdev@...r.kernel.org,
	Przemek Kitszel <przemyslaw.kitszel@...el.com>,
	Igor Bagnucki <igor.bagnucki@...el.com>,
	Wojciech Drewek <wojciech.drewek@...el.com>
Subject: Re: [Intel-wired-lan] [PATCH iwl-next v1 3/6] ice: add Tx hang
 devlink health reporter

On Wed, Jul 03, 2024 at 08:59:19AM -0400, Mateusz Polchlopek wrote:
> From: Przemek Kitszel <przemyslaw.kitszel@...el.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@...el.com>
> Reviewed-by: Igor Bagnucki <igor.bagnucki@...el.com>
> Reviewed-by: Wojciech Drewek <wojciech.drewek@...el.com>
> Signed-off-by: Mateusz Polchlopek <mateusz.polchlopek@...el.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.

> +	devlink_fmsg_binary_pair_put(fmsg, "desc", event->tx_ring->desc,
> +				     size_mul(event->tx_ring->count,
> +					      sizeof(struct ice_tx_desc)));
> +	devlink_fmsg_obj_nest_end(fmsg);
> +
> +	return 0;
> +}

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ