Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1256097 > unrolled thread
| Started by | Toshi Kani <toshi.kani@hpe.com> |
|---|---|
| First post | 2015-10-26 16:10 +0100 |
| Last post | 2015-10-26 18:00 +0100 |
| Articles | 5 — 2 participants |
Back to article view | Back to linux.kernel
[PATCH v2 UPDATE 3/3] ACPI/APEI/EINJ: Allow memory error injection to NVDIMM Toshi Kani <toshi.kani@hpe.com> - 2015-10-26 16:10 +0100
RE: [PATCH v2 UPDATE 3/3] ACPI/APEI/EINJ: Allow memory error injection to NVDIMM "Luck, Tony" <tony.luck@intel.com> - 2015-10-26 17:30 +0100
Re: [PATCH v2 UPDATE 3/3] ACPI/APEI/EINJ: Allow memory error injection to NVDIMM Toshi Kani <toshi.kani@hpe.com> - 2015-10-26 17:40 +0100
RE: [PATCH v2 UPDATE 3/3] ACPI/APEI/EINJ: Allow memory error injection to NVDIMM "Luck, Tony" <tony.luck@intel.com> - 2015-10-26 17:50 +0100
Re: [PATCH v2 UPDATE 3/3] ACPI/APEI/EINJ: Allow memory error injection to NVDIMM Toshi Kani <toshi.kani@hpe.com> - 2015-10-26 18:00 +0100
| From | Toshi Kani <toshi.kani@hpe.com> |
|---|---|
| Date | 2015-10-26 16:10 +0100 |
| Subject | [PATCH v2 UPDATE 3/3] ACPI/APEI/EINJ: Allow memory error injection to NVDIMM |
| Message-ID | <qnRzk-1mw-15@gated-at.bofh.it> |
In the case of memory error injection, einj_error_inject() checks
if a target address is regular RAM. Update this check to add a call
to region_intersects_pmem() to verify if a target address range is
NVDIMM. This allows injecting a memory error to both RAM and NVDIMM
for testing.
Also, the current RAM check, page_is_ram(), is replaced with
region_intersects_ram() so that it can verify a target address
range with the requested size.
Signed-off-by: Toshi Kani <toshi.kani@hpe.com>
Reviewed-by: Dan Williams <dan.j.williams@intel.com>
---
Add a blank line before if-statement. (Borislav Petkov)
---
drivers/acpi/apei/einj.c | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/drivers/acpi/apei/einj.c b/drivers/acpi/apei/einj.c
index 0431883..db21efe 100644
--- a/drivers/acpi/apei/einj.c
+++ b/drivers/acpi/apei/einj.c
@@ -519,7 +519,7 @@ static int einj_error_inject(u32 type, u32 flags, u64 param1, u64 param2,
u64 param3, u64 param4)
{
int rc;
- unsigned long pfn;
+ u64 base_addr, size;
/* If user manually set "flags", make sure it is legal */
if (flags && (flags &
@@ -545,10 +545,15 @@ static int einj_error_inject(u32 type, u32 flags, u64 param1, u64 param2,
/*
* Disallow crazy address masks that give BIOS leeway to pick
* injection address almost anywhere. Insist on page or
- * better granularity and that target address is normal RAM.
+ * better granularity and that target address is normal RAM or
+ * NVDIMM.
*/
- pfn = PFN_DOWN(param1 & param2);
- if (!page_is_ram(pfn) || ((param2 & PAGE_MASK) != PAGE_MASK))
+ base_addr = param1 & param2;
+ size = (~param2) + 1;
+
+ if (((region_intersects_ram(base_addr, size) != REGION_INTERSECTS) &&
+ (region_intersects_pmem(base_addr, size) != REGION_INTERSECTS)) ||
+ ((param2 & PAGE_MASK) != PAGE_MASK))
return -EINVAL;
inject:
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [next] | [standalone]
| From | "Luck, Tony" <tony.luck@intel.com> |
|---|---|
| Date | 2015-10-26 17:30 +0100 |
| Subject | RE: [PATCH v2 UPDATE 3/3] ACPI/APEI/EINJ: Allow memory error injection to NVDIMM |
| Message-ID | <qnSOL-23f-15@gated-at.bofh.it> |
| In reply to | #1256097 |
- pfn = PFN_DOWN(param1 & param2); - if (!page_is_ram(pfn) || ((param2 & PAGE_MASK) != PAGE_MASK)) + base_addr = param1 & param2; + size = (~param2) + 1; We expect the user will supply us with param2 in the form 0xffffffff[fec8]00000 with various numbers of leading 'f' and trailing '0' ... but I don't think we actually check that anywhere. But we have a bunch of places that assume it is OK, including this new one. It's time to fix that. Maybe even provide a default 0xfffffffffffff000 so I can save myself some typing? -Tony -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Toshi Kani <toshi.kani@hpe.com> |
|---|---|
| Date | 2015-10-26 17:40 +0100 |
| Subject | Re: [PATCH v2 UPDATE 3/3] ACPI/APEI/EINJ: Allow memory error injection to NVDIMM |
| Message-ID | <qnSYr-26p-17@gated-at.bofh.it> |
| In reply to | #1256145 |
On Mon, 2015-10-26 at 16:26 +0000, Luck, Tony wrote:
> - pfn = PFN_DOWN(param1 & param2);
> - if (!page_is_ram(pfn) || ((param2 & PAGE_MASK) != PAGE_MASK))
> + base_addr = param1 & param2;
> + size = (~param2) + 1;
>
> We expect the user will supply us with param2 in the form 0xffffffff[fec8]00000
> with various numbers of leading 'f' and trailing '0' ... but I don't think we actually
> check that anywhere. But we have a bunch of places that assume it is OK, including
> this new one.
>
> It's time to fix that. Maybe even provide a default 0xfffffffffffff000 so I can save
> myself some typing?
+ if (((region_intersects_ram(base_addr, size) != REGION_INTERSECTS) &&
+ (region_intersects_pmem(base_addr, size) != REGION_INTERSECTS)) ||
+ ((param2 & PAGE_MASK) != PAGE_MASK))
return -EINVAL;
The 3rd condition check makes sure that the param2 mask is the page size or less. So, I
think we are OK on this.
Thanks,
-Toshi
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | "Luck, Tony" <tony.luck@intel.com> |
|---|---|
| Date | 2015-10-26 17:50 +0100 |
| Subject | RE: [PATCH v2 UPDATE 3/3] ACPI/APEI/EINJ: Allow memory error injection to NVDIMM |
| Message-ID | <qnT86-29L-9@gated-at.bofh.it> |
| In reply to | #1256149 |
PiArICAgICAgICAgICAoKHBhcmFtMiAmIFBBR0VfTUFTSykgIT0gUEFHRV9NQVNLKSkNCj4gICAg ICAgICAgICAgICAgcmV0dXJuIC1FSU5WQUw7DQo+DQo+IFRoZSAzcmQgY29uZGl0aW9uIGNoZWNr IG1ha2VzIHN1cmUgdGhhdCB0aGUgcGFyYW0yIG1hc2sgaXMgdGhlIHBhZ2Ugc2l6ZSBvciBsZXNz LiAgU28sIEkNCj4gdGhpbmsgd2UgYXJlIE9LIG9uIHRoaXMuDQoNCk9vcHMuIFRoZSBvcmlnaW5h bCB3YXMgZXZlbiBvbiB0aGUgc2NyZWVuIGFzIHBhcnQgb2YgdGhlIGRpZmYgKHdoaWNoIEkgc2ln bmVkIG9mZiBvbiBqdXN0IHR3byB5ZWFycyBhZ28pLg0KDQpJJ2QgYmUgaGFwcGllciBpZiB5b3Ug bWFkZSBpdCB0aGUgMXN0IGNvbmRpdGlvbiB0aG91Z2gsIHNvIHdlIHNraXAgY2FsbGluZyByZWdp b25faW50ZXJzZWN0c18qKCkgd2l0aA0KYSBub25zZW5zZSAic2l6ZSIgYXJndW1lbnQuDQoNCi1U b255DQoNCg== -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Toshi Kani <toshi.kani@hpe.com> |
|---|---|
| Date | 2015-10-26 18:00 +0100 |
| Subject | Re: [PATCH v2 UPDATE 3/3] ACPI/APEI/EINJ: Allow memory error injection to NVDIMM |
| Message-ID | <qnThN-2d0-33@gated-at.bofh.it> |
| In reply to | #1256154 |
On Mon, 2015-10-26 at 16:46 +0000, Luck, Tony wrote: > > + ((param2 & PAGE_MASK) != PAGE_MASK)) > > return -EINVAL; > > > > The 3rd condition check makes sure that the param2 mask is the page size or less. So, > > I think we are OK on this. > > Oops. The original was even on the screen as part of the diff (which I signed off on > just two years ago). > > I'd be happier if you made it the 1st condition though, so we skip calling > region_intersects_*() with a nonsense "size" argument. Agreed. I will send an updated patch 3/3 later today, "[PATCH v2 UPDATE-2 3/3]". Thanks, -Toshi -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web