diff mbox series

vhost: use pr_err for vq_err

Message ID 20240516074629.1785921-1-peng.fan@oss.nxp.com (mailing list archive)
State Not Applicable
Headers show
Series vhost: use pr_err for vq_err | expand

Checks

Context Check Description
netdev/tree_selection success Not a local patch

Commit Message

Peng Fan (OSS) May 16, 2024, 7:46 a.m. UTC
From: Peng Fan <peng.fan@nxp.com>

Use pr_err to print out error message without enabling DEBUG. This could
make people catch error easier.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
 drivers/vhost/vhost.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Michael S. Tsirkin May 16, 2024, 12:33 p.m. UTC | #1
On Thu, May 16, 2024 at 03:46:29PM +0800, Peng Fan (OSS) wrote:
> From: Peng Fan <peng.fan@nxp.com>
> 
> Use pr_err to print out error message without enabling DEBUG. This could
> make people catch error easier.
> 
> Signed-off-by: Peng Fan <peng.fan@nxp.com>

This isn't appropriate: pr_err must not be triggerable
by userspace. If you are debugging userspace, use a debugging
kernel, it's that simple.


> ---
>  drivers/vhost/vhost.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/vhost/vhost.h b/drivers/vhost/vhost.h
> index bb75a292d50c..0bff436d1ce9 100644
> --- a/drivers/vhost/vhost.h
> +++ b/drivers/vhost/vhost.h
> @@ -248,7 +248,7 @@ void vhost_iotlb_map_free(struct vhost_iotlb *iotlb,
>  			  struct vhost_iotlb_map *map);
>  
>  #define vq_err(vq, fmt, ...) do {                                  \
> -		pr_debug(pr_fmt(fmt), ##__VA_ARGS__);       \
> +		pr_err(pr_fmt(fmt), ##__VA_ARGS__);       \
>  		if ((vq)->error_ctx)                               \
>  				eventfd_signal((vq)->error_ctx);\
>  	} while (0)
> -- 
> 2.37.1
Peng Fan May 16, 2024, 12:36 p.m. UTC | #2
> Subject: Re: [PATCH] vhost: use pr_err for vq_err
> 
> On Thu, May 16, 2024 at 03:46:29PM +0800, Peng Fan (OSS) wrote:
> > From: Peng Fan <peng.fan@nxp.com>
> >
> > Use pr_err to print out error message without enabling DEBUG. This
> > could make people catch error easier.
> >
> > Signed-off-by: Peng Fan <peng.fan@nxp.com>
> 
> This isn't appropriate: pr_err must not be triggerable by userspace. If you are
> debugging userspace, use a debugging kernel, it's that simple.

I see, then drop this patch.

Thanks,
Peng.
> 
> 
> > ---
> >  drivers/vhost/vhost.h | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/vhost/vhost.h b/drivers/vhost/vhost.h index
> > bb75a292d50c..0bff436d1ce9 100644
> > --- a/drivers/vhost/vhost.h
> > +++ b/drivers/vhost/vhost.h
> > @@ -248,7 +248,7 @@ void vhost_iotlb_map_free(struct vhost_iotlb *iotlb,
> >  			  struct vhost_iotlb_map *map);
> >
> >  #define vq_err(vq, fmt, ...) do {                                  \
> > -		pr_debug(pr_fmt(fmt), ##__VA_ARGS__);       \
> > +		pr_err(pr_fmt(fmt), ##__VA_ARGS__);       \
> >  		if ((vq)->error_ctx)                               \
> >  				eventfd_signal((vq)->error_ctx);\
> >  	} while (0)
> > --
> > 2.37.1
diff mbox series

Patch

diff --git a/drivers/vhost/vhost.h b/drivers/vhost/vhost.h
index bb75a292d50c..0bff436d1ce9 100644
--- a/drivers/vhost/vhost.h
+++ b/drivers/vhost/vhost.h
@@ -248,7 +248,7 @@  void vhost_iotlb_map_free(struct vhost_iotlb *iotlb,
 			  struct vhost_iotlb_map *map);
 
 #define vq_err(vq, fmt, ...) do {                                  \
-		pr_debug(pr_fmt(fmt), ##__VA_ARGS__);       \
+		pr_err(pr_fmt(fmt), ##__VA_ARGS__);       \
 		if ((vq)->error_ctx)                               \
 				eventfd_signal((vq)->error_ctx);\
 	} while (0)