Linux SCSI subsystem development
 help / color / mirror / Atom feed
From: Mathias Krause <minipli@grsecurity.net>
To: Justin Tee <justintee8345@gmail.com>
Cc: Justin Tee <justin.tee@broadcom.com>,
	Paul Ely <paul.ely@broadcom.com>,
	linux-scsi@vger.kernel.org, James Smart <jsmart2021@gmail.com>
Subject: Re: [PATCH] scsi: lpfc: Properly set WC for DPP mapping
Date: Mon, 19 Jan 2026 17:45:39 +0100	[thread overview]
Message-ID: <59933d92-eefe-49f6-ad70-79fe7aef0f3c@grsecurity.net> (raw)
In-Reply-To: <CABPRKS-ongXPqWVpNYiKvy_afVKn999bxtSEfsBVQ7z5JVCgeQ@mail.gmail.com>

Hi Justin,

On 16.01.26 23:33, Justin Tee wrote:
> Hi Mathias,
> 
>>> I don't have any hardware to test this on. I just got the report from a
>>> customer of ours regarding the CONFIG_DEBUG_VIRTUAL BUG_ON(). As I don't
>>> have any spec for the hardware either, I assumed a few things, like:
>>> 1/ DPP regions are only supported on SIL4 devices.
>>> 2/ DPP may be shared with other registers (doorbells?) in the same BAR.
>>
>> Sure, we’ll have close look at this patch and test on real hardware.
>> Will report back on our findings.
> 
> This patch has been tested on real hardware and I/O is stalled when
> using DPP.  We can look for an alternative solution.

Hmm, that's bad. However, that makes me think, making the mapping
write-combining may had been a bad idea from the very beginning?

The thing is, the call to set_memory_wc() won't really do what commit
1351e69fc6db ("scsi: lpfc: Add push-to-adapter support to sli4") wanted
it to do. It does change the PTE flags of the mapping, but it operates
on invalid physical addresses as __pa($VMALLOC_ADDR) just won't work.

Given the time when it was developed, memcpy_{from,to}io() was really
slow on modern systems as these would simply be memcpy() and that was
ASM-alternative'd to a 'rep movsb' if the CPU featured X86_FEATURE_ERMS.

However, the LPFC driver already tries to do "big writes" by making use
of __raw_writeq() instead of memcpy_toio(). That should have solved most
of the latency issues back then already which makes me think, simply
dropping the call to set_memory_wc() is probably the next best option.

> 
> Do we happen to have a dmesg log with the call trace observed?

Unfortunately, we don't. We just have a truncated screenshot with RIP in
__phys_addr(), code and register dump. The surrounding symbolization of
register values we have in grsecurity makes it clear, it's lpfc and, in
fact, the set_memory_wc() call in lpfc_wq_create().

Specifically, it's the call to __pa(addr), which is __phys_addr() under
CONFIG_DEBUG_VIRTUAL, triggering the VIRTUAL_BUG_ON(... ||
!phys_addr_valid(x)) which boils down to BUG_ON() under
CONFIG_DEBUG_VIRTUAL.

> 
> I plan on attempting to reproduce what the customer is observing by
> enabling CONFIG_DEBUG_VIRTUAL, and would be helpful to see context
> from a dmesg log.

Just loading lpfc.ko with enabled CONFIG_DEBUG_VIRTUAL on a DPP
supported platform should trigger the bug as the set_memory_wc() is
unconditionally attempted in this case.

Thanks,
Mathias

> 
> Regards,
> Justin

  reply	other threads:[~2026-01-19 16:45 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-13 22:27 [PATCH] scsi: lpfc: Properly set WC for DPP mapping Mathias Krause
2026-01-16 17:46 ` Justin Tee
2026-01-16 22:33   ` Justin Tee
2026-01-19 16:45     ` Mathias Krause [this message]
2026-01-21  0:44       ` Justin Tee
2026-02-09 18:47         ` Justin Tee
2026-02-11 14:34           ` Mathias Krause
2026-02-12  0:01             ` Justin Tee
2026-02-12  8:03               ` Mathias Krause
2026-02-12 18:43                 ` Justin Tee

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=59933d92-eefe-49f6-ad70-79fe7aef0f3c@grsecurity.net \
    --to=minipli@grsecurity.net \
    --cc=jsmart2021@gmail.com \
    --cc=justin.tee@broadcom.com \
    --cc=justintee8345@gmail.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=paul.ely@broadcom.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