All of lore.kernel.org
 help / color / mirror / Atom feed
From: Barret Rhoden <brho@google.com>
To: "Chen, Yian" <yian.chen@intel.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
	"H. Peter Anvin" <hpa@zytor.com>,
	David Woodhouse <dwmw2@infradead.org>,
	Joerg Roedel <joro@8bytes.org>,
	Sohil Mehta <sohil.mehta@intel.com>
Cc: linux-kernel@vger.kernel.org, iommu@lists.linux-foundation.org,
	x86@kernel.org
Subject: Re: [PATCH 1/3] iommu/vt-d: skip RMRR entries that fail the sanity check
Date: Mon, 23 Dec 2019 15:27:54 -0500	[thread overview]
Message-ID: <14ccbc00-7451-bd2e-d861-01c422cad53a@google.com> (raw)
In-Reply-To: <4c24f2d2-03fd-a6cb-f950-391f3f7837cb@intel.com>

On 12/17/19 2:19 PM, Chen, Yian wrote:
>> Regardless, I have two other patches in this series that could resolve 
>> the problem for me and probably other people.  I'd just like at least 
>> one of the three patches to get merged so that my machine boots when 
>> the original commit f036c7fa0ab6 ("iommu/vt-d: Check VT-d RMRR region 
>> in BIOS is reported as reserved") gets released.
>>
> when a firmware bug appears, the potential problem may beyond the scope 
> of its visible impacts so that introducing a workaround in official 
> implementation should be considered very carefully.

Agreed.  I think that in the RMRR case, it wouldn't surprise me if these 
problems are already occurring, and we just didn't know about it, so I'd 
like to think about sane workarounds.  I only noticed it on a kexec. 
Not sure how many people with similarly-broken firmware are kexecing 
kernels on linus/master kernels yet.

Specifically, my firmware reports an RMRR with start == 0 and end == 0 
(end should be page-aligned-minus-one).  The only reason commit 
f036c7fa0ab6 didn't catch it on a full reboot is that trim_bios_range() 
reserved the first page, assuming that the BIOS meant to reserve it but 
just didn't tell us in the e820 map.  My firmware didn't mark that first 
page E820_RESERVED.  On a kexec, the range that got trimmed was 
0x100-0xfff instead of 0x000-0xfff.  In both cases, the kernel won't use 
the region the broken RMRR points to, but in the kexec case, it wasn't 
E820_RESERVED, so the new commit aborted the DMAR setup.

> If the workaround is really needed at this point, I would recommend 
> adding a WARN_TAINT with TAINT_FIRMWARE_WORKAROUND, to tell the 
> workaround is in the place.

Sounds good.  I can rework the patchset so that whenever I skip an RMRR 
entry or whatnot, I'll put in a WARN_TAINT.  I see a few other examples 
in dmar.c to work from.

If any of the three changes are too aggressive, I'm OK with you all 
taking just one of them.  I'd like to be able to kexec with the new 
kernel.  I'm likely not the only one with bad firmware, and any bug that 
only shows up on a kexec often a pain to detect.

Thanks,

Barret


WARNING: multiple messages have this Message-ID (diff)
From: Barret Rhoden via iommu <iommu@lists.linux-foundation.org>
To: "Chen, Yian" <yian.chen@intel.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	 Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
	"H. Peter Anvin" <hpa@zytor.com>,
	David Woodhouse <dwmw2@infradead.org>,
	Joerg Roedel <joro@8bytes.org>,
	Sohil Mehta <sohil.mehta@intel.com>
Cc: iommu@lists.linux-foundation.org, x86@kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/3] iommu/vt-d: skip RMRR entries that fail the sanity check
Date: Mon, 23 Dec 2019 15:27:54 -0500	[thread overview]
Message-ID: <14ccbc00-7451-bd2e-d861-01c422cad53a@google.com> (raw)
In-Reply-To: <4c24f2d2-03fd-a6cb-f950-391f3f7837cb@intel.com>

On 12/17/19 2:19 PM, Chen, Yian wrote:
>> Regardless, I have two other patches in this series that could resolve 
>> the problem for me and probably other people.  I'd just like at least 
>> one of the three patches to get merged so that my machine boots when 
>> the original commit f036c7fa0ab6 ("iommu/vt-d: Check VT-d RMRR region 
>> in BIOS is reported as reserved") gets released.
>>
> when a firmware bug appears, the potential problem may beyond the scope 
> of its visible impacts so that introducing a workaround in official 
> implementation should be considered very carefully.

Agreed.  I think that in the RMRR case, it wouldn't surprise me if these 
problems are already occurring, and we just didn't know about it, so I'd 
like to think about sane workarounds.  I only noticed it on a kexec. 
Not sure how many people with similarly-broken firmware are kexecing 
kernels on linus/master kernels yet.

Specifically, my firmware reports an RMRR with start == 0 and end == 0 
(end should be page-aligned-minus-one).  The only reason commit 
f036c7fa0ab6 didn't catch it on a full reboot is that trim_bios_range() 
reserved the first page, assuming that the BIOS meant to reserve it but 
just didn't tell us in the e820 map.  My firmware didn't mark that first 
page E820_RESERVED.  On a kexec, the range that got trimmed was 
0x100-0xfff instead of 0x000-0xfff.  In both cases, the kernel won't use 
the region the broken RMRR points to, but in the kexec case, it wasn't 
E820_RESERVED, so the new commit aborted the DMAR setup.

> If the workaround is really needed at this point, I would recommend 
> adding a WARN_TAINT with TAINT_FIRMWARE_WORKAROUND, to tell the 
> workaround is in the place.

Sounds good.  I can rework the patchset so that whenever I skip an RMRR 
entry or whatnot, I'll put in a WARN_TAINT.  I see a few other examples 
in dmar.c to work from.

If any of the three changes are too aggressive, I'm OK with you all 
taking just one of them.  I'd like to be able to kexec with the new 
kernel.  I'm likely not the only one with bad firmware, and any bug that 
only shows up on a kexec often a pain to detect.

Thanks,

Barret

_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

  reply	other threads:[~2019-12-23 20:28 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-11 19:46 [PATCH 0/3] iommu/vt-d bad RMRR workarounds Barret Rhoden
2019-12-11 19:46 ` Barret Rhoden via iommu
2019-12-11 19:46 ` [PATCH 1/3] iommu/vt-d: skip RMRR entries that fail the sanity check Barret Rhoden
2019-12-11 19:46   ` Barret Rhoden via iommu
2019-12-16 19:07   ` Chen, Yian
2019-12-16 19:07     ` Chen, Yian
2019-12-16 19:35     ` Barret Rhoden
2019-12-16 19:35       ` Barret Rhoden via iommu
2019-12-17 19:19       ` Chen, Yian
2019-12-17 19:19         ` Chen, Yian
2019-12-23 20:27         ` Barret Rhoden [this message]
2019-12-23 20:27           ` Barret Rhoden via iommu
2019-12-11 19:46 ` [PATCH 2/3] iommu/vt-d: treat unmapped RMRR entries as sane Barret Rhoden
2019-12-11 19:46   ` Barret Rhoden via iommu
2019-12-11 19:46 ` [PATCH 3/3] iommu/vt-d: skip invalid RMRR entries Barret Rhoden
2019-12-11 19:46   ` Barret Rhoden via iommu
2019-12-12  2:43 ` [PATCH 0/3] iommu/vt-d bad RMRR workarounds Lu Baolu
2019-12-12  2:43   ` Lu Baolu
2019-12-13 14:31   ` Barret Rhoden
2019-12-13 14:31     ` Barret Rhoden via iommu
2019-12-14  1:52     ` Lu Baolu
2019-12-14  1:52       ` Lu Baolu
2019-12-16 19:11       ` Chen, Yian
2019-12-16 19:11         ` Chen, Yian

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=14ccbc00-7451-bd2e-d861-01c422cad53a@google.com \
    --to=brho@google.com \
    --cc=bp@alien8.de \
    --cc=dwmw2@infradead.org \
    --cc=hpa@zytor.com \
    --cc=iommu@lists.linux-foundation.org \
    --cc=joro@8bytes.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=sohil.mehta@intel.com \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    --cc=yian.chen@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.