All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sui Jingfeng <sui.jingfeng@linux.dev>
To: Icenowy Zheng <uwu@icenowy.me>, Xi Ruoyao <xry111@xry111.site>,
	WANG Xuerui <kernel@xen0n.name>,
	Huacai Chen <chenhuacai@kernel.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	"Mike Rapoport (IBM)" <rppt@kernel.org>,
	Baoquan He <bhe@redhat.com>,
	"Matthew Wilcox (Oracle)" <willy@infradead.org>,
	David Hildenbrand <david@redhat.com>,
	Zhen Lei <thunder.leizhen@huawei.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Zhihong Dong <donmor3000@hotmail.com>,
	loongarch@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] loongarch/mm: disable WUC for pgprot_writecombine as same as ioremap_wc
Date: Thu, 19 Dec 2024 18:39:26 +0800	[thread overview]
Message-ID: <e32a07c7-18ff-49a4-98bf-dda10ab69f16@linux.dev> (raw)
In-Reply-To: <bdef7b5dcf7c9b20bfb97ef66ee7e66bfcc304d8.camel@icenowy.me>


On 2024/12/19 14:38, Icenowy Zheng wrote:
> 在 2024-12-19星期四的 13:49 +0800,Sui Jingfeng写道:
>> On 2024/12/19 12:49, Icenowy Zheng wrote:
>>> 在 2024-12-19星期四的 10:54 +0800,Sui Jingfeng写道:
>>>> On 2024/12/18 20:43, Icenowy Zheng wrote:
>>>>> For the fact of drm/ast's dramatical drop, it's because write
>>>>> to
>>>>> the
>>>>> framebuffer can no longer be reordered.
>>>> No, your understanding is wrong, very very wrong and a big wrong.
>>>>
>>>> It's not because it can't reorder the write. Rather, it's because
>>>> that the CPU can't do write gathering and can't do burst write
>>>> any
>>>> more.
>>> Write gathering is a kind of write reordering,
>>
>> No, your understanding is broken.
>>
>> Write gathering *isn't* a kind of write reordering.
> It is, it changes the order "write A -> write B -> write C -> write D"
> to "write ABCD concurrently".

  
The reorder mentioned here isn't the main reason that
affect the performance. While the cache-like behavior
and better bandwidth utilizing (burst write) is.


> If one of B/C/D is a register that triggers latching A

Mips/Loonarch CPUs doesn't allow *uncached read* bypass writes.

This means that when you issue a *uncached read*, the former
write operation must have been resolved by the hardware memory.

But this is true only for *uncached read* issued by the *CPU*.

How can the "write B", "write C" and "write D" will trigger the
latching A here?


> in the former case it will latch A correctly but
> in the latter case it will wrongly latch the old value of A instead, so
> write gathering is not strongly-ordered.
>
>
For accesses from the CPU side, registers are mapped with *uncached*.
register access by the CPU are all strong ordered.

All DRM drivers mapped their register with strong order uncached fashion.
Do you ever seen any exceptions?


Even with the command submit approach, registers will not get written to
the hardware until the kickoff command is issued to the hardware.

The write order depend on the occurrence order in the ring buffer,
not the issue order. Commands that rank first in the ring buffer
will get executed first. But there is still no hints that
"write B", "write C" and "write D" will lead to "latch A",

So please stop cheating us by making up cock-and-bull story.


>> Its doesn't have to reorder, it just cache the write operation with
>> the CPU's write buffer.
>>
>>
>>> comparing to strongly
>>> ordered writing (which is literally one byte per write).
>>>
>>>> So do you still think your patch is harmless?
>>> Well, I said that performance w/o correctness is meaningless.
>>
>> The point is that Write-Combine on drm/ast will get both correctness
>> and performance.
>>
>>
-- 
Best regards,
Sui


  reply	other threads:[~2024-12-19 10:39 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-09  4:28 [PATCH v2] loongarch/mm: disable WUC for pgprot_writecombine as same as ioremap_wc Icenowy Zheng
2023-10-09 14:32 ` Sui Jingfeng
2023-10-10  0:15   ` WANG Xuerui
2023-10-10  3:02     ` Sui Jingfeng
2023-10-10 12:26       ` Xi Ruoyao
2023-10-13 11:12         ` Sui Jingfeng
2023-10-13 12:51         ` Sui Jingfeng
2023-10-13 13:15           ` Xi Ruoyao
2023-10-13 13:53             ` Xi Ruoyao
2025-01-21  9:19               ` Sui Jingfeng
2024-12-02 16:23         ` Sui Jingfeng
2024-12-17 18:18           ` Shuah
2024-12-18  3:24             ` Sui Jingfeng
2024-12-18  6:23               ` Icenowy Zheng
2024-12-18 10:05                 ` Sui Jingfeng
2024-12-18 12:37                   ` Icenowy Zheng
2024-12-19  3:17                     ` Sui Jingfeng
2024-12-19  4:54                       ` Icenowy Zheng
2024-12-20 16:43               ` Shuah
2024-12-17 23:44           ` Icenowy Zheng
2024-12-18  3:05             ` Sui Jingfeng
2024-12-18  5:47               ` Icenowy Zheng
2024-12-18 10:29                 ` Sui Jingfeng
2024-12-18 12:43                   ` Icenowy Zheng
2024-12-19  2:54                     ` Sui Jingfeng
2024-12-19  4:49                       ` Icenowy Zheng
2024-12-19  5:49                         ` Sui Jingfeng
2024-12-19  6:34                           ` Icenowy Zheng
2024-12-19  7:46                             ` Sui Jingfeng
2024-12-19  6:38                           ` Icenowy Zheng
2024-12-19 10:39                             ` Sui Jingfeng [this message]
2023-10-10  0:50   ` Icenowy Zheng

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=e32a07c7-18ff-49a4-98bf-dda10ab69f16@linux.dev \
    --to=sui.jingfeng@linux.dev \
    --cc=akpm@linux-foundation.org \
    --cc=bhe@redhat.com \
    --cc=chenhuacai@kernel.org \
    --cc=david@redhat.com \
    --cc=donmor3000@hotmail.com \
    --cc=kernel@xen0n.name \
    --cc=linux-kernel@vger.kernel.org \
    --cc=loongarch@lists.linux.dev \
    --cc=rppt@kernel.org \
    --cc=tglx@linutronix.de \
    --cc=thunder.leizhen@huawei.com \
    --cc=uwu@icenowy.me \
    --cc=willy@infradead.org \
    --cc=xry111@xry111.site \
    /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.