public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Koralahalli Channabasappa, Smita" <skoralah@amd.com>
To: Borislav Petkov <bp@alien8.de>
Cc: Smita Koralahalli <Smita.KoralahalliChannabasappa@amd.com>,
	x86@kernel.org, linux-edac@vger.kernel.org,
	linux-kernel@vger.kernel.org, Tony Luck <tony.luck@intel.com>,
	"H . Peter Anvin" <hpa@zytor.com>,
	yazen.ghannam@amd.com
Subject: Re: [PATCH 1/5] x86/mce/inject: Check if a bank is unpopulated before error simulation
Date: Thu, 14 Oct 2021 15:26:13 -0500	[thread overview]
Message-ID: <f6b6b66d-0e6b-e64a-9c97-4e067610a3da@amd.com> (raw)
In-Reply-To: <YWh1bc6Lol65f0RH@zn.tnic>

On 10/14/21 1:22 PM, Borislav Petkov wrote:

> On Mon, Oct 11, 2021 at 04:12:14PM -0500, Koralahalli Channabasappa, Smita wrote:
>> I do not have the bank number in order to look up the IPID for that bank.
>> I couldn't know the bank number because mce-inject files are synchronized
>> in a way that once the bank number is written the injection starts.
>> Can you please suggest what needs to be done here?
>>
>> Also, the IPID register is read only from the OS, hence the user provided
>> IPID values could be useful for "sw" error injection types. For "hw" error
>> injection types we need to read from the registers to determine the IPID
>> value.
>>
>> Should there be two cases where on a "sw" injection use the user provided
>> IPID value whereas on "hw" injection read from registers?
> Right, that's a good point. So the way I see it is, we need to decide
> what is allowed for sw injection and what for hw injection, wrt to IPID
> value.
>
> I think for sw injection, we probably should say that since this is
> sw only and its purpose is to test the code only, there should not be
> any limitations imposed by the underlying machine. Like using the bank
> number, for example.
>
> So what you do now for sw injection:
>
> 		if (val && inj_type == SW_INJ)
> 			m->ipid = val;
>
> should be good enough. User simply sets some IPID value and that value
> will be used for the bank which is written when injecting.
>
> Now, for hw injection, you have two cases:
>
> 1. The bank is unpopulated so setting the IPID there doesn't make any sense.
>
> 2. The bank *is* populated and the respective IPID MSR has a value
> describing what that bank is.
>
> And in that case, does it even make sense to set the IPID? I don't think
> so because that IP block's type - aka IPID - has been set already by
> hardware/firmware.
>
> So the way I see it, it makes no sense whatsoever to set the IPID of a
> bank during hw injection.
>
> Right?

Yes, I agree. inj_ipid_set() can be used to serve the purpose of setting
user provided IPID on a sw injection only.

My concern was, we need to determine whether the bank is unpopulated or
populated before trying to inject the errors on a hw injection, for which
we need to read the IPID MSR of that bank.

We cannot do that inside inj_ipid_set() as we do not know the bank number
until inj_bank_set() executes which is called after inj_ipid_set().
mce-inject files are synchronized in a way that once the bank number is
written in inj_bank_set(), injection starts.

So this snippet of code:

if (inj_type != SW_INJ) {
	rdmsrl_on_cpu(m->extcpu, MSR_AMD64_SMCA_MCx_IPID(val),&m->ipid);
	if (!m->ipid) {
		pr_err("Error injection not possible - bank %d unpopulated\n");
		return -ENODEV;
	}
}

should be retained inside inj_bank_set() ?

And inj_ipid_set() should just set m->ipid = val on a SW_INJ as you mentioned
above?

Thanks,



  reply	other threads:[~2021-10-14 20:26 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-15 23:27 [PATCH 0/5] x86/mce: Handle error simulation failures in mce-inject module Smita Koralahalli
2021-09-15 23:27 ` [PATCH 1/5] x86/mce/inject: Check if a bank is unpopulated before error simulation Smita Koralahalli
2021-09-24  8:26   ` Borislav Petkov
2021-09-27 19:51     ` Smita Koralahalli Channabasappa
2021-09-27 20:15       ` Borislav Petkov
2021-09-27 21:56         ` Smita Koralahalli Channabasappa
2021-09-27 22:05           ` Borislav Petkov
2021-10-11 21:12     ` Koralahalli Channabasappa, Smita
2021-10-14 18:22       ` Borislav Petkov
2021-10-14 20:26         ` Koralahalli Channabasappa, Smita [this message]
2021-10-14 20:57           ` Borislav Petkov
2021-09-15 23:27 ` [PATCH 2/5] x86/mce/inject: Set the valid bit in MCA_STATUS before error injection Smita Koralahalli
2021-09-24  8:26   ` Borislav Petkov
2021-09-15 23:27 ` [PATCH 3/5] x86/mce: Use msr_ops in prepare_msrs() Smita Koralahalli
2021-09-24  8:26   ` Borislav Petkov
2021-09-15 23:27 ` [PATCH 4/5] x86/mce/inject: Check for writes ignored in status registers Smita Koralahalli
2021-09-15 23:27 ` [PATCH 5/5] x86/mce/mce-inject: Return error code to userspace from mce-inject module Smita Koralahalli
2021-09-24  8:26   ` Borislav Petkov

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=f6b6b66d-0e6b-e64a-9c97-4e067610a3da@amd.com \
    --to=skoralah@amd.com \
    --cc=Smita.KoralahalliChannabasappa@amd.com \
    --cc=bp@alien8.de \
    --cc=hpa@zytor.com \
    --cc=linux-edac@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tony.luck@intel.com \
    --cc=x86@kernel.org \
    --cc=yazen.ghannam@amd.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