Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Rodrigo Vivi <rodrigo.vivi@intel.com>
To: Xin Wang <x.wang@intel.com>
Cc: <intel-xe@lists.freedesktop.org>, Fei Yang <fei.yang@intel.com>,
	"Shuicheng Lin" <shuicheng.lin@intel.com>
Subject: Re: [PATCH] drm/xe/debugfs: fixed the return value of wedged_mode_set
Date: Fri, 14 Feb 2025 10:11:25 -0500	[thread overview]
Message-ID: <Z69dHeA5o66T8x3B@intel.com> (raw)
In-Reply-To: <Z658iN54wTvgbaa1@intel.com>

On Thu, Feb 13, 2025 at 06:13:12PM -0500, Rodrigo Vivi wrote:
> On Fri, Feb 14, 2025 at 06:36:15AM +0800, Xin Wang wrote:
> > It is generally expected that the write() function should return a
> > positive value indicating the number of bytes written or a negative
> > error code if an error occurs. Returning 0 is unusual and can lead
> > to unexpected behavior.
> > 
> > When the user program writes the same value to wedged_mode twice in
> > a row, a lockup will occur, because the value expected to be
> > returned by the write() function inside the program should be equal
> > to the actual written value instead of 0.
> > 
> > To reproduce the issue:
> > echo 1 > /sys/kernel/debug/dri/0/wedged_mode
> > echo 1 > /sys/kernel/debug/dri/0/wedged_mode   <- lockup here
> > 
> > Signed-off-by: Xin Wang <x.wang@intel.com>
> > Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
> > Cc: Fei Yang <fei.yang@intel.com>
> > Cc: Shuicheng Lin <shuicheng.lin@intel.com>
> > ---
> >  drivers/gpu/drm/xe/xe_debugfs.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/drivers/gpu/drm/xe/xe_debugfs.c b/drivers/gpu/drm/xe/xe_debugfs.c
> > index 56cb3788e752..b46075edf60a 100644
> > --- a/drivers/gpu/drm/xe/xe_debugfs.c
> > +++ b/drivers/gpu/drm/xe/xe_debugfs.c
> > @@ -167,7 +167,7 @@ static ssize_t wedged_mode_set(struct file *f, const char __user *ubuf,
> >  		return -EINVAL;
> >  
> >  	if (xe->wedged.mode == wedged_mode)
> > -		return 0;
> > +		return size;
> 
> Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>

pushed to drm-xe-next. Thanks for the fix

> 
> >  
> >  	xe->wedged.mode = wedged_mode;
> >  
> > -- 
> > 2.43.0
> > 

  reply	other threads:[~2025-02-14 15:11 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-13 22:36 [PATCH] drm/xe/debugfs: fixed the return value of wedged_mode_set Xin Wang
2025-02-13 23:13 ` Rodrigo Vivi
2025-02-14 15:11   ` Rodrigo Vivi [this message]
2025-02-14  0:24 ` ✓ CI.Patch_applied: success for " Patchwork
2025-02-14  0:24 ` ✓ CI.checkpatch: " Patchwork
2025-02-14  0:25 ` ✓ CI.KUnit: " Patchwork
2025-02-14  0:47 ` ✓ CI.Build: " Patchwork
2025-02-14  0:50 ` ✓ CI.Hooks: " Patchwork
2025-02-14  0:52 ` ✓ CI.checksparse: " Patchwork
2025-02-14  1:12 ` ✓ Xe.CI.BAT: " Patchwork
2025-02-14 21:33 ` ✗ Xe.CI.Full: failure " Patchwork

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=Z69dHeA5o66T8x3B@intel.com \
    --to=rodrigo.vivi@intel.com \
    --cc=fei.yang@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=shuicheng.lin@intel.com \
    --cc=x.wang@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