NVDIMM Device and Persistent Memory development
 help / color / mirror / Atom feed
From: Jane Chu <jane.chu@oracle.com>
To: "Luck, Tony" <tony.luck@intel.com>, "bp@alien8.de" <bp@alien8.de>,
	"tglx@linutronix.de" <tglx@linutronix.de>,
	"mingo@redhat.com" <mingo@redhat.com>,
	"dave.hansen@linux.intel.com" <dave.hansen@linux.intel.com>,
	"x86@kernel.org" <x86@kernel.org>,
	"linux-edac@vger.kernel.org" <linux-edac@vger.kernel.org>,
	"Williams, Dan J" <dan.j.williams@intel.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"hch@lst.de" <hch@lst.de>,
	"nvdimm@lists.linux.dev" <nvdimm@lists.linux.dev>
Subject: Re: [PATCH v5] x86/mce: retrieve poison range from hardware
Date: Mon, 1 Aug 2022 20:31:19 +0000	[thread overview]
Message-ID: <97eb67fe-b60c-3291-3743-3e3655a0bb27@oracle.com> (raw)
In-Reply-To: <SJ1PR11MB608393FA8D4FE8092A84D53AFC9A9@SJ1PR11MB6083.namprd11.prod.outlook.com>

On 8/1/2022 8:58 AM, Luck, Tony wrote:
>> 	struct mce m;
>> +	int lsb = PAGE_SHIFT;
> 
> Some maintainers like to order local declaration lines from longest to shortest
>   
>> +     /*
>> +      * Even if the ->validation_bits are set for address mask,
>> +      * to be extra safe, check and reject an error radius '0',
>> +      * and fallback to the default page size.
>> +      */
>> +     if (mem_err->validation_bits & CPER_MEM_VALID_PA_MASK) {
>> +             lsb = __ffs64(mem_err->physical_addr_mask);
>> +             if (lsb == 1)
>> +                     lsb = PAGE_SHIFT;
>> +     }
> 
> 
> The comment above __ffs64() says:
> 
> * The result is not defined if no bits are set, so check that @word
>   * is non-zero before calling this.
> 
> So if the intent is "extra safe" should check for that:
> 
>          if (mem_err->validation_bits & CPER_MEM_VALID_PA_MASK &&
>              mem_err->physical_addr_mask) {
>                  lsb = __ffs64(mem_err->physical_addr_mask);
>                  if (lsb == 1)
>                          lsb = PAGE_SHIFT;
>          }

Indeed, thanks a lot!

-jane


> 
> -Tony
> 
> 	
> 


  reply	other threads:[~2022-08-01 20:31 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-30  6:17 [PATCH v5] x86/mce: retrieve poison range from hardware Jane Chu
2022-08-01 15:58 ` Luck, Tony
2022-08-01 20:31   ` Jane Chu [this message]
2022-08-01 16:44 ` Dan Williams
2022-08-01 20:34   ` Jane Chu
2022-08-01 21:20     ` Dan Williams
2022-08-01 22:01       ` Jane Chu

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=97eb67fe-b60c-3291-3743-3e3655a0bb27@oracle.com \
    --to=jane.chu@oracle.com \
    --cc=bp@alien8.de \
    --cc=dan.j.williams@intel.com \
    --cc=dave.hansen@linux.intel.com \
    --cc=hch@lst.de \
    --cc=linux-edac@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=nvdimm@lists.linux.dev \
    --cc=tglx@linutronix.de \
    --cc=tony.luck@intel.com \
    --cc=x86@kernel.org \
    /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