public inbox for linux-rdma@vger.kernel.org
 help / color / mirror / Atom feed
* [bug report] net/mlx5e: Simulate missing IPsec TX limits hardware functionality
@ 2023-05-30 11:26 Dan Carpenter
  2023-05-30 11:36 ` Leon Romanovsky
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2023-05-30 11:26 UTC (permalink / raw)
  To: leon; +Cc: linux-rdma

Hello Leon Romanovsky,

The patch b2f7b01d36a9: "net/mlx5e: Simulate missing IPsec TX limits
hardware functionality" from Mar 30, 2023, leads to the following
Smatch static checker warning:

	drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec.c:68 mlx5e_ipsec_handle_tx_limit()
	warn: sleeping in atomic context

drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec.c
    57 static void mlx5e_ipsec_handle_tx_limit(struct work_struct *_work)
    58 {
    59         struct mlx5e_ipsec_dwork *dwork =
    60                 container_of(_work, struct mlx5e_ipsec_dwork, dwork.work);
    61         struct mlx5e_ipsec_sa_entry *sa_entry = dwork->sa_entry;
    62         struct xfrm_state *x = sa_entry->x;
    63 
    64         spin_lock(&x->lock);

Holding a spinlock.

    65         xfrm_state_check_expire(x);
    66         if (x->km.state == XFRM_STATE_EXPIRED) {
    67                 sa_entry->attrs.drop = true;
--> 68                 mlx5e_accel_ipsec_fs_modify(sa_entry);

This function call will do some GFP_KERNEL allocations so it sleeps.

    69         }
    70         spin_unlock(&x->lock);
    71 
    72         if (sa_entry->attrs.drop)
    73                 return;
    74 
    75         queue_delayed_work(sa_entry->ipsec->wq, &dwork->dwork,
    76                            MLX5_IPSEC_RESCHED);
    77 }

regards,
dan carpenter

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [bug report] net/mlx5e: Simulate missing IPsec TX limits hardware functionality
  2023-05-30 11:26 [bug report] net/mlx5e: Simulate missing IPsec TX limits hardware functionality Dan Carpenter
@ 2023-05-30 11:36 ` Leon Romanovsky
  0 siblings, 0 replies; 2+ messages in thread
From: Leon Romanovsky @ 2023-05-30 11:36 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: linux-rdma

On Tue, May 30, 2023 at 02:26:19PM +0300, Dan Carpenter wrote:
> Hello Leon Romanovsky,
> 
> The patch b2f7b01d36a9: "net/mlx5e: Simulate missing IPsec TX limits
> hardware functionality" from Mar 30, 2023, leads to the following
> Smatch static checker warning:
> 
> 	drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec.c:68 mlx5e_ipsec_handle_tx_limit()
> 	warn: sleeping in atomic context
> 
> drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec.c
>     57 static void mlx5e_ipsec_handle_tx_limit(struct work_struct *_work)
>     58 {
>     59         struct mlx5e_ipsec_dwork *dwork =
>     60                 container_of(_work, struct mlx5e_ipsec_dwork, dwork.work);
>     61         struct mlx5e_ipsec_sa_entry *sa_entry = dwork->sa_entry;
>     62         struct xfrm_state *x = sa_entry->x;
>     63 
>     64         spin_lock(&x->lock);
> 
> Holding a spinlock.
> 
>     65         xfrm_state_check_expire(x);
>     66         if (x->km.state == XFRM_STATE_EXPIRED) {
>     67                 sa_entry->attrs.drop = true;
> --> 68                 mlx5e_accel_ipsec_fs_modify(sa_entry);
> 
> This function call will do some GFP_KERNEL allocations so it sleeps.

Thanks Dan, I have a fix in my queue and will submit it.

Thanks

> 
>     69         }
>     70         spin_unlock(&x->lock);
>     71 
>     72         if (sa_entry->attrs.drop)
>     73                 return;
>     74 
>     75         queue_delayed_work(sa_entry->ipsec->wq, &dwork->dwork,
>     76                            MLX5_IPSEC_RESCHED);
>     77 }
> 
> regards,
> dan carpenter

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-05-30 11:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-05-30 11:26 [bug report] net/mlx5e: Simulate missing IPsec TX limits hardware functionality Dan Carpenter
2023-05-30 11:36 ` Leon Romanovsky

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox