All of lore.kernel.org
 help / color / mirror / Atom feed
From: Koba Ko <koba.ko@canonical.com>
To: "Luck, Tony" <tony.luck@intel.com>
Cc: Markus Elfring <Markus.Elfring@web.de>,
	"linux-edac@vger.kernel.org" <linux-edac@vger.kernel.org>,
	"kernel-janitors@vger.kernel.org"
	<kernel-janitors@vger.kernel.org>, Borislav Petkov <bp@alien8.de>,
	James Morse <james.morse@arm.com>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	Robert Richter <rric@kernel.org>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2] EDAC/i10nm: shift exponent is negative
Date: Tue, 4 Jul 2023 12:59:15 +0800	[thread overview]
Message-ID: <CAJB-X+XVO29wVxVezjFrgCyXigqEJxAzb0K0wueXNto5K_x2tA@mail.gmail.com> (raw)
In-Reply-To: <CAJB-X+X+09-m57JcZcb-_9dKUG3CtAbLXxGTEg7R0bB8pyJx9Q@mail.gmail.com>

As per suggestions, i modified V3.
could you please take a look

Subject: [PATCH][V3] EDAC/i10nm: shift exponent is negative

Because failed to read from DIMM, get the negative value for shift
operation.
`EDAC DEBUG: skx_get_dimm_attr: bad ranks = 3 (raw=0xffffffff)
 EDAC DEBUG: skx_get_dimm_attr: bad rows = 7 (raw=0xffffffff)
 EDAC DEBUG: skx_get_dimm_attr: bad cols = 3 (raw=0xffffffff)
 EDAC DEBUG: i10nm_get_dimm_config: dimmmtr 0xffffffff mcddrtcfg
0xffffffff (mc1 ch0 dimm1)`

UBSAN complains this error
`UBSAN: shift-out-of-bounds in drivers/edac/skx_common.c:369:16
 shift exponent -66 is negative`

when get rows, cols and ranks, the returned error value doesn't be
handled.

check the return value is EINVAL, if yes, directly return 0 and
show error message explicitly.

Fixes: 4ec656bdf43a13) EDAC, skx_edac: Add EDAC driver for Skylake
Signed-off-by: Koba Ko <koba.ko@canonical.com>
---
V2 -> V3: simplify the summary and add 'Fixes:'
V1 -> V2: make error-print explicitly

On Tue, Jul 4, 2023 at 10:20 AM Koba Ko <koba.ko@canonical.com> wrote:
>
> On Tue, Jul 4, 2023 at 5:51 AM Luck, Tony <tony.luck@intel.com> wrote:
> >
> > > > UBSAN complains this error
> > > > ~~~
> > > >  UBSAN: shift-out-of-bounds in drivers/edac/skx_common.c:369:16
> > > …
> > > > ~~~
> > > >
> > > > when get rows, cols and ranks, the returned error value doesn't be
> > > > handled.
> > > >
> > > > check the return value is EINVAL, if yes, directly return 0.
> > > …
> > >
> > > * Please improve this change description further.
> >
> > To be specific. Initially you reported this because of the UBSAN error
> > report. But, after community discussion you now know that the problem
> > is that one or more of the rows/cols/ranks has a value that the EDAC driver
> > doesn't expect and probably can handle.
> >
> > So, in V2, the commit message should start with the information these
> > values are out of range and mention this was discovered when UBSAN
> > put out a warning about a negative shift. No need to include the whole
> > of the UBSAN stack trace.
> >
> > Then describe the two fixes that this patch includes. One is to change the
> > edac debug message into a console error message to enable further
> > debug of this issue. The other is to skip the unrecognized DIMM.
> >
> > > * How do you think about to add the tag “Fixes”?
> >
> > This is a good idea.  Use git blame, or dig into the GIT history to
> > find the commit where this code was introduced (hint .. git blame
> > says:
> > 88a242c98740 ("EDAC, skx_common: Separate common code out from skx_edac")
> > but that obviously just refactored code, so you should dig back more into
> > the history.
> There are two parts,
> 1. @get_dimm_attr, edac_dbg was added since e235dd43d8b0f0
> 2. get num of ranks, rows and cols, 4ec656bdf43a13
>
> Should I add all of them prefixes with "Fixes"?
>
> >
> > > > V2: make error-print explicitly
> > > > ---
> > >
> > > Would you like to avoid a misplaced marker line here?
> > >
> > > See also:
> > > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?h=v6.4#n686
> >
> > That's an excellent resource.
> >
> > -Tony

  reply	other threads:[~2023-07-04  4:59 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-03 16:25 [PATCH][V2] EDAC/i10nm: shift exponent is negative Koba Ko
     [not found] ` <4ec2b7d2-11a5-6ab6-087a-175ed31faca4@web.de>
2023-07-03 21:51   ` [PATCH v2] " Luck, Tony
2023-07-04  1:50     ` Koba Ko
2023-07-04  3:14       ` Luck, Tony
2023-07-05  4:08       ` Luck, Tony
2023-07-05  8:45         ` Koba Ko
2023-07-05 15:22           ` Luck, Tony
2023-07-06 14:11             ` Zhuo, Qiuxu
2023-07-06 17:40               ` Koba Ko
2023-07-07  3:34                 ` Zhuo, Qiuxu
2023-07-09 15:42                   ` Koba Ko
2023-07-10  1:18                     ` Zhuo, Qiuxu
2023-07-10  6:25                     ` Dan Carpenter
2023-07-10  8:08                       ` Zhuo, Qiuxu
2023-07-04  2:20     ` Koba Ko
2023-07-04  4:59       ` Koba Ko [this message]
     [not found]         ` <9c27530e-21f9-15ce-5116-5af5b0c25f53@web.de>
2023-07-04  8:05           ` Koba Ko
2023-07-04  8:17           ` Koba Ko
     [not found]             ` <706f49e8-d536-651a-2f19-394518633b53@web.de>
2023-07-04  8:59               ` [v2/v3] " Koba Ko
2023-07-04 12:02 ` [PATCH][V2] " Dan Carpenter
2023-07-04 12:32   ` Koba Ko

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=CAJB-X+XVO29wVxVezjFrgCyXigqEJxAzb0K0wueXNto5K_x2tA@mail.gmail.com \
    --to=koba.ko@canonical.com \
    --cc=Markus.Elfring@web.de \
    --cc=bp@alien8.de \
    --cc=james.morse@arm.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-edac@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=rric@kernel.org \
    --cc=tony.luck@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.