#
✕ nick:arnd
#asahi · 2021-03-04 19:49
arndmarcan: yes, that's fine, or alternatively split the readl() section from the ioremap() section since I wrote most of the first and you wrote most of the second
#asahi · 2021-03-04 12:19
arnd"tlb -L 2048" reports a tlb size of 1558 pages
#asahi · 2021-03-04 12:10
arndinside a Linux guest running in macos, lmbench reports 146 TLB entries when running a 4KB page size kernel, but 73 entries for a 16KB kernel
#asahi · 2021-03-04 12:00
arndkettenis: in case you want to find out, lmbench can normally find out the cache and tlb sizes through timing: http://lmbench.sourceforge.net/man/tlb.8.html
#asahi · 2021-03-01 08:55
arndI think the correct explanation would be that both readl() and readl_relaxed() are fully ordered against spinlocks, while writel() and writel_relaxed() can be posted (depending on the device and mapping flags), which results in the store completion not being ordered against locking at all
#asahi · 2021-03-01 08:54
arndmarcan: ok, sorry about my mistake. memory-barriers.txt is correct here. I had changed the writel() description to clarify that it is not ordered against spinlocks after cross-checking, but forgot to update the writel_relaxed() description
#asahi · 2021-02-25 10:00
arndmodwizcode: maybe ask about dmb vs dsb on #armlinux, someone there likely knows the answer
#asahi · 2021-02-24 09:50
arnd16KB obviously won't be as bad as 64KB for either the extra memory usage, or the extra I/O per swap operation, but it will still be very noticeable
#asahi · 2021-02-24 09:50
arndthe slowdown was worse because of the extra I/O required while paging
#asahi · 2021-02-24 09:49
arndI did some experiments on Amazon Graviton guests a while ago and found that while the memory usage explosion from 64KB pages compared to 4KB wasn't as bad as I had expected,
#asahi · 2021-02-24 09:48
arnd- the swap problem is likely made worse by the use of 16KB pages, compared to the 4KB pages that macos on x86, and (most) Linux on arm use
#asahi · 2021-02-24 09:47
arnd- if I only log in remotely to macos and there is no local user, the 16GB are usually sufficient for what I do, even when running an 8GB linux VM guest, and it doesn't swap at all as long as there is free memory (this is what is supposed to happen, but it wasn't obvious that there was no bug here)
#asahi · 2021-02-24 09:46
arndI haven't tried that, but I expect it would not be particularly stable. Regarding the heavy swap usage I have two other observations though:
#asahi · 2021-02-23 16:22
arndmarcan: that might be something only wildea01 fully understands
#asahi · 2021-02-23 13:47
arndah, that is probably easier then, it must have come after I last looked at it
#asahi · 2021-02-23 13:43
arndIn Documentation/core-api/timekeeping.rst, I used "c:function::" annotations for the function prototypes, which may be good here as well, but is a lot to type for the dozens of mmio accessors
#asahi · 2021-02-23 13:41
arndok
#asahi · 2021-02-23 13:40
arndtwo more things: I'm trying to fit the IORESOURCE_MEM_NONPOSTED flag into the ioremap_np() description, and I'd want to make sure that it compiles into html/pdf form from rst
#asahi · 2021-02-23 13:36
arndmarcan: I clarified the ioremap_np() PCI portion to say that this is about memory space (as I/O space is also non-posted), and rephrased last paragraph for ioremap_wc
#asahi · 2021-02-23 13:27
arndit's unfortunate how the rules for both ioremap_wc and ioremap_np() depend on the resource flags and on the bus type (pci vs local), but in different ways
#asahi · 2021-02-23 13:24
arndyes, please do
#asahi · 2021-02-23 13:16
arndright
#asahi · 2021-02-23 13:15
arndI think it makes sense, but it's still a bit unclear what should happen on PCIe, where every mmio write is posted regardless of the flag
#asahi · 2021-02-23 13:13
arndI mean an architecture on which every MMIO write is non-posted can implement ioremap_np() as an alias for ioremap(), while another architecture on which MMIO writes are posted would return NULL
#asahi · 2021-02-23 13:11
arndthat would probably be architecture specific again, depending on how the default ioremap areas behave
#asahi · 2021-02-23 13:06
arndmarcan: indeed, the two are incompatible, if we treat the dt property as "required" as it has to be on the mac, then it wouldn't be an opt-out for drivers
#asahi · 2021-02-23 10:31
arndmarcan: the AXI3 and AXI4 buses have a 'bufferable' flag in a write transaction that determines whether it's posted or not
#asahi · 2021-02-23 10:20
arndFor the apple platform, I would expect that none of the internal I/O is posted, and this is likely true for many other SoCs. I can try to find what the AXI and AHB specs say about it
#asahi · 2021-02-23 10:17
arndmarcan: About other platforms, my thinking was that the DT flag could be used to make the behavior portable. Clearly a driver can just ask for a NP mapping regardless of the resource type and still work correctly, but that would be a non-portable driver if it relies it the stores being non-posted
#asahi · 2021-02-23 10:02
arndthat would even make it portable to architectures on which all on-chip I/O is nonposted by definition, so a portable driver can simply check the flag and either fall back to inserting dummy reads or refuse the probe when it is absent
#asahi · 2021-02-23 10:02
arndright, but if we document it along the lines of the new IORESOURCE flag, it could be phrased to explain that the flag can be set by platforms to indicate that it is safe to rely on them being nonposted
#asahi · 2021-02-23 10:00
arndI wonder if the ioremap_np() description should be rephrased to explain under which conditions it is safe to rely on writes being non-posted, rather than just warning that it might not be
#asahi · 2021-02-23 09:57
arndmarcan: I didn't really get any replies
#asahi · 2021-02-22 14:58
arndI found a post from torvalds on the opic of write-combining: https://ipfs.io/ipfs/QmdA5WkDNALetBn4iFeSepHjdLGJdxPBwZyY47ir1bZGAK/comp/linux/write_barriers.html
#asahi · 2021-02-22 14:39
arndkettenis: that would explain the in-kernel interface, but not the user space side
#asahi · 2021-02-22 14:31
arndit's an invitation-only channel, I could never figure out who exactly qualifies to get invited
#asahi · 2021-02-22 14:30
arndmarcan: do you mind if I share the current draft on another channel with more kernel developers? I'd like to find out if anyone else knows why mapping a prefetchable PCI resource from user space uses a _wc mapping while pci_ioremap_bar() doesn't
#asahi · 2021-02-22 14:28
arndok
#asahi · 2021-02-22 14:15
arndmarcan: ok, let's assume that is the sensible behavior then. Without this, you could end up never seeing a framebuffer update
#asahi · 2021-02-22 14:13
arndkettenis: good point, no reason to throw away your dcache when filling a 4K framebuffer
#asahi · 2021-02-22 13:59
arndI mean for write-back cached mappings there isn't, because nothing necessarily enforces the writeback, but for a normal write-buffer I would assume that it gets flushed out as soon as there is bandwidth avaiable on the bus
#asahi · 2021-02-22 13:58
arndisn't there an implementation specific upper bound on the write buffer?
#asahi · 2021-02-22 13:57
arndI would assume so, but I don't know for sure
#asahi · 2021-02-22 13:56
arndmarcan: my understanding is that normal ioremap() being posted already requires a read-back to flush it (as you write there), so that would be the same with _wc
#asahi · 2021-02-22 13:54
arndso no guarantees about completion with _wc
#asahi · 2021-02-22 13:53
arndmarcan: as far as I can tell, the use of a store buffer is what does the write-combining, so you can't have one without the other
#asahi · 2021-02-22 13:35
arndOur mac mini on a 27" screen randomly comes up with text much too small or much too big. Changing the resolution from 4K to 1080p and back usually gets it into the other mode. There is probably a setting somewhere to change the font size to the desired value, but I have never found that. "many years ahead of the industry" ;-)
#asahi · 2021-02-22 12:54
arndis the frame buffer part of the normal LP-DDR4X or separate?
#asahi · 2021-02-22 12:24
arndok, then I probably remembered correctly, as they have been talking about RISC-V in their GPUs but seem to favor ARM for applications cores
#asahi · 2021-02-22 12:21
arndnever_released: what about the GPUs?

plus ›