From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id F01FCA0545; Tue, 8 Nov 2022 13:47:17 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9DCF5400D4; Tue, 8 Nov 2022 13:47:17 +0100 (CET) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mails.dpdk.org (Postfix) with ESMTP id 3C3924003C for ; Tue, 8 Nov 2022 13:47:14 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1667911633; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=62KTMvPUdiHg2f+MpZSmtdWKM/QpqD4zA/uYRkIjQjE=; b=i8bAqPpCEeiiOhOnC6kNMYp6Xgdl5sM3KaIfXK6pnEcSO5XvdhShSjvw71XIgFbOTw79wP Y+BUsTxu/UVHNSz41IgM2xN8ZDKwl1eBy+sPoasvoWU6MIpsrR8jj5hDUNfr1ESuEKqBtP 9nF3TJmHtgKQc7Ob+MwLtvfHpk3BEt4= Received: from mail-pl1-f198.google.com (mail-pl1-f198.google.com [209.85.214.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-205-wv0C9TzKNp2L0Rph7DALYg-1; Tue, 08 Nov 2022 07:47:12 -0500 X-MC-Unique: wv0C9TzKNp2L0Rph7DALYg-1 Received: by mail-pl1-f198.google.com with SMTP id k9-20020a170902c40900b0018734e872a9so11310599plk.21 for ; Tue, 08 Nov 2022 04:47:12 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=62KTMvPUdiHg2f+MpZSmtdWKM/QpqD4zA/uYRkIjQjE=; b=mvdQPVA6JvwaToeexnS3QWIqvrUFfRsS0K1vhWtvxxCpVIWDvziDku6oan5etR9LED 7bMiQrHjVv+3tgfU/6Yx+bF7KUZJGYTxtOLEiaPonYO8UPm6oXgYrB6mz0wRPTHdPEWc 82u/unz/TVtXJ5sKYaCueVvMP4yIg3jfN6yQFKqaTASKui4sZ8FjpzfuolqztnKvb59C WkM6++kFlfQF+Z2Npm1+wpfFSp3A7LGGGMKZ3pKaQ8J23SYviSyDh0m44F80afMChiev dz6xiB3qCuADA99OWZgoUZ1OKl5cEt3z5AFj2MaSfTAEwVN5a9ogNZec/tv3fNXQhlw9 8ZMw== X-Gm-Message-State: ACrzQf0oR5mirHwfUfPlpSoDItdKIAaQTlx/Kp3FisWN/xHrkcJR3WaM JQxZcW8++oSuddX9k2aVswUSZ66msqoRxp3q22BDFGeGvjQb3uvoUwODN9c9xTkBjI6tLO3lxq7 m3FvQ9jBfg9zuon4Ns8A= X-Received: by 2002:a65:5c0c:0:b0:46e:f582:7378 with SMTP id u12-20020a655c0c000000b0046ef5827378mr46952448pgr.120.1667911631437; Tue, 08 Nov 2022 04:47:11 -0800 (PST) X-Google-Smtp-Source: AMsMyM4clf+HE0X1HHeFBYDRmADqgjCbWVNdLepUCmoIiYNND47gr9WaKGiuTgZKQ57nduHCmtMNvbxZYcRavVpezb4= X-Received: by 2002:a65:5c0c:0:b0:46e:f582:7378 with SMTP id u12-20020a655c0c000000b0046ef5827378mr46952425pgr.120.1667911631115; Tue, 08 Nov 2022 04:47:11 -0800 (PST) MIME-Version: 1.0 References: <20220608115826.11783-1-getelson@nvidia.com> In-Reply-To: <20220608115826.11783-1-getelson@nvidia.com> From: David Marchand Date: Tue, 8 Nov 2022 13:46:59 +0100 Message-ID: Subject: Re: [PATCH 1/2] common/mlx5: update log format after devx_general_cmd error To: Gregory Etelson , rasland@nvidia.com Cc: dev@dpdk.org, Matan Azrad , Viacheslav Ovsiienko , Thomas Monjalon X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org On Wed, Jun 8, 2022 at 1:58 PM Gregory Etelson wrote: > > Application can fetch syndrome value after FW operation failure > starting from Mellanox OFED-5.6. > The patch updates log data issued after devx_general_cmd error. > > Signed-off-by: Gregory Etelson > Acked-by: Matan Azrad > --- > drivers/common/mlx5/mlx5_devx_cmds.c | 103 ++++++++++++--------------- > 1 file changed, 44 insertions(+), 59 deletions(-) > > diff --git a/drivers/common/mlx5/mlx5_devx_cmds.c b/drivers/common/mlx5/mlx5_devx_cmds.c > index c6bdbc12bb..bc06aeccc7 100644 > --- a/drivers/common/mlx5/mlx5_devx_cmds.c > +++ b/drivers/common/mlx5/mlx5_devx_cmds.c > @@ -13,39 +13,49 @@ > #include "mlx5_common_log.h" > #include "mlx5_malloc.h" > > +/* FW writes status value to the OUT buffer at offset 00H */ > +#define MLX5_FW_STATUS(o) MLX5_GET(general_obj_out_cmd_hdr, (o), status) > +/* FW writes syndrome value to the OUT buffer at offset 04H */ > +#define MLX5_FW_SYNDROME(o) MLX5_GET(general_obj_out_cmd_hdr, (o), syndrome) > + > +#define MLX5_DEVX_ERR_RC(x) ((x) > 0 ? -(x) : ((x) < 0 ? (x) : -1)) > + > +static void > +mlx5_devx_err_log(void *out, const char *reason, > + const char *param, uint32_t value) > +{ > + rte_errno = errno; > + if (!param) > + DRV_LOG(ERR, "DevX %s failed errno=%d status=%#x syndrome=%#x", > + reason, errno, MLX5_FW_STATUS(out), > + MLX5_FW_SYNDROME(out)); > + else > + DRV_LOG(ERR, "DevX %s %s=%#X failed errno=%d status=%#x syndrome=%#x", > + reason, param, value, errno, MLX5_FW_STATUS(out), > + MLX5_FW_SYNDROME(out)); > +} > + > static void * > mlx5_devx_get_hca_cap(void *ctx, uint32_t *in, uint32_t *out, > int *err, uint32_t flags) > { > const size_t size_in = MLX5_ST_SZ_DW(query_hca_cap_in) * sizeof(int); > const size_t size_out = MLX5_ST_SZ_DW(query_hca_cap_out) * sizeof(int); > - int status, syndrome, rc; > + int rc; > > - if (err) > - *err = 0; > memset(in, 0, size_in); > memset(out, 0, size_out); > MLX5_SET(query_hca_cap_in, in, opcode, MLX5_CMD_OP_QUERY_HCA_CAP); > MLX5_SET(query_hca_cap_in, in, op_mod, flags); > rc = mlx5_glue->devx_general_cmd(ctx, in, size_in, out, size_out); > - if (rc) { > - DRV_LOG(ERR, > - "Failed to query devx HCA capabilities func %#02x", > - flags >> 1); > + if (rc || MLX5_FW_STATUS(out)) { > + mlx5_devx_err_log(out, "HCA capabilities", "func", flags >> 1); > if (err) > - *err = rc > 0 ? -rc : rc; > - return NULL; > - } > - status = MLX5_GET(query_hca_cap_out, out, status); > - syndrome = MLX5_GET(query_hca_cap_out, out, syndrome); > - if (status) { > - DRV_LOG(ERR, > - "Failed to query devx HCA capabilities func %#02x status %x, syndrome = %x", > - flags >> 1, status, syndrome); > - if (err) > - *err = -1; > + *err = MLX5_DEVX_ERR_RC(rc); > return NULL; > } > + if (err) > + *err = 0; > return MLX5_ADDR_OF(query_hca_cap_out, out, capability); > } > > @@ -74,7 +84,7 @@ mlx5_devx_cmd_register_read(void *ctx, uint16_t reg_id, uint32_t arg, > uint32_t in[MLX5_ST_SZ_DW(access_register_in)] = {0}; > uint32_t out[MLX5_ST_SZ_DW(access_register_out) + > MLX5_ACCESS_REGISTER_DATA_DWORD_MAX] = {0}; > - int status, rc; > + int rc; > > MLX5_ASSERT(data && dw_cnt); > MLX5_ASSERT(dw_cnt <= MLX5_ACCESS_REGISTER_DATA_DWORD_MAX); > @@ -91,23 +101,13 @@ mlx5_devx_cmd_register_read(void *ctx, uint16_t reg_id, uint32_t arg, > rc = mlx5_glue->devx_general_cmd(ctx, in, sizeof(in), out, > MLX5_ST_SZ_BYTES(access_register_out) + > sizeof(uint32_t) * dw_cnt); > - if (rc) > - goto error; > - status = MLX5_GET(access_register_out, out, status); > - if (status) { > - int syndrome = MLX5_GET(access_register_out, out, syndrome); > - > - DRV_LOG(DEBUG, "Failed to read access NIC register 0x%X, " > - "status %x, syndrome = %x", > - reg_id, status, syndrome); > - return -1; > + if (rc || MLX5_FW_STATUS(out)) { > + mlx5_devx_err_log(out, "read access", "NIC register", reg_id); > + return MLX5_DEVX_ERR_RC(rc); I went back in the mailing list archive to find this change. This patch makes the pmd spat some scary log messages... I get this on a system with a CX5 nic (OVS dpdk-latest + 22.11-rc2) : 2022-11-08T12:26:09.218Z|00027|dpdk|ERR|mlx5_common: DevX read access NIC register=0X9055 failed errno=22 status=0 syndrome=0 Should I be scared? The system runs fine and nothing else changed in my setup (afaics), so I'd expect it continues working.. This specific change of level on the "read access" check breaks OVS system dpdk unit tests, as those tests fail on ERR level logs. If this is harmless, please send a patch to revert to debug level (and for other log messages that were updated in this patch if it was unneeded). Thanks. -- David Marchand