sorear changed the topic of #riscv to: RISC-V instruction set architecture | https://riscv.org | Logs: https://libera.irclog.whitequark.org/riscv | Matrix: #riscv:catircservices.org
<JohnHenry> I guess I don't know what "no protections" means. Does that mean the RWX bits?
<JohnHenry> sorear: thank you again, that's very helpful :)
naoki has quit [Quit: naoki]
<heat> JohnHenry, PROT_NONE is an mmap thing. basically you can set certain pages to not be accessible
iooi has joined #riscv
<JohnHenry> this is gonna get into filesystem stuff isn't it
<heat> nope
<JohnHenry> Are there things I need to look out for when _PAGE_PRESENT is 0 but _PAGE_PROT_NONE is 1? Are daemons going to come around and screw around with that page?
<JohnHenry> But yeah setting a page to be inaccessible (i.e. foiling the hardware page walker) is exactly what I want to do
<heat> the trick here is that linux uses the page tables to store the backing pages directly. which, if you set to PROT_NONE, you need to do V=0 but still "keep" the page address around, for when munmap comes to reap pages
<heat> so basically when you set a range to PROT_NONE you'll see !pte_present but pte_protnone
<heat> and you need _PAGE_PROT_NONE to distinguish PROT_NONE from other types of special page table entries (swap entries, for instance)
<JohnHenry> that makes sense
<JohnHenry> so I guess I'm trying to make a new kind of special page table entry that won't collide with the others
<heat> what are you doing, and why can't that use the existing stuff?
<JohnHenry> and I'm trying to tell if using _PAGE_PROT_NONE is the right thing to do
<JohnHenry> I have some TLB manipulation registers
<JohnHenry> and I want to designate a VMA as an area I'm gonna watch closely
<JohnHenry> to track the TLB-residence of its PTEs
<JohnHenry> so I'll madvise to mark the VMA, and it will flush all those PTEs from the TLB and mark them invalid
<JohnHenry> now accesses to that VMA will fault
<JohnHenry> I'll use my TLB manipulation registers to soft-load the TLB and mark their presence in my FSM
<heat> oh, just clear the A bits?
<JohnHenry> and then if/when shootdown time comes, I have extra data I can use to filter shootdown requirements
<heat> hmm, riscv has hardware A bits right? maybe that doesn't quite work if you *need* it to fault
<JohnHenry> It's not clear to me that clearing the A bit is sufficient on the particular machine I have (Milk-V Pioneer with the Sophgo 64-core thing)
<Tenkawa> JohnHenry: nice
<sorear> with rva23 you can force A=0 to fault by setting menvcfg.ADUE=0
<JohnHenry> yeah sadly the SG2042 doesn't follow rva23, it's... like 2019 or so
<JohnHenry> and my understanding from emailing Thead is that the hardware page walker Just Does Everything
<JohnHenry> which is why I wanted V=0 so I get faults
<JohnHenry> Tenkawa: Thank you, this is my master's project so hopefully it works :)
<Tenkawa> I hope this Spacemit-K1 I'm working with will get more mainline attention sooner than later
<heat> JohnHenry, cant you just poll the A bits from time to time?
<JohnHenry> That doesn't tell me which core looked at it though
<JohnHenry> It's essentially a wager that a given VMA's pages will be looked at by only one or a few harts despite the process running on lots of harts
<JohnHenry> that's why I'm using madvise to pick the VMA, that's the kind of thing a programmer should know about
<heat> right, i guess you do need to fault then
<JohnHenry> but then I have to keep careful track of the TLB residency so that they can't sneak one past me and get a stale TLB entry somewhere
<JohnHenry> it's the best I've got so far
<JohnHenry> if this masters project goes well I want the follow-on project to be a hardware extension that makes this kind of work less agonizing
<JohnHenry> I am learning to appreciate the MIPS software-loaded TLB with this stuff
<JohnHenry> anyway thank you sorear and heat
<heat> you're welcome
<heat> it's possible you can squeeze a bit off of swap ptes or work around it in some way, but you'll need to dig a little deep into linux mm
<heat> it's probably not exactly a trivial modification, but so it goes ;)
<JohnHenry> indeed. that's why I'm looking at PROT_NONE and it seems similar to what I want to but it seems like there might be baggage I'm not understanding right away
<JohnHenry> I wish Lorenzo Stoakes' publisher would hurry up, I need that book so I can understand WTF is going on
<heat> well the trick is distinguishing real PROT_NONE ptes from your fake "PROT_NONE"
<JohnHenry> That would be one good way, but it might also just be good to use it as-is, and know that the machine will actually be accessing the PROT_NONE pages as long as it's TLB-resident?
<heat> i don't understand your question
<heat> PROT_NONE accesses /will/ page fault, that's its whole shtick
Trifton has joined #riscv
<JohnHenry> right
<JohnHenry> and then I soft-load the massaged-to-set-Valid entry into the TLB
<JohnHenry> and the user program hums long none the wiser
<JohnHenry> I just need to make sure the kernel isn't going to see I've marked this otherwise-normal page as PROT_NONE and do something surprising to it
<heat> i would not do that, unless you have a clear understand that that is your vma
<heat> so, madvise MADV_JOHNHENRY and then mprotect it PROT_NONE
<JohnHenry> my plan was to have the user programmer madvise the area they want this to happen to
<JohnHenry> so they should be pretty sure it's their VMA
<JohnHenry> ah, belt-and-suspenders
<JohnHenry> does it break something for me to PROT_NONE it at the madvise step?
<heat> it'll be very confusing when you start faulting things in and perms come out uneven or somtehing :)
<JohnHenry> ah now I see the collision between RWX and my special PROT_NONE you were talking about
<JohnHenry> I don't want to look like that at the user level, so perhaps I should use different bits... will have to look more closely
<JohnHenry> thanks again
heat_ has joined #riscv
heat has quit [Read error: Connection reset by peer]
<heat_> JohnHenry, i'd advise you to join #mm on oftc (at some other time, its late!)
<heat_> you might get better help there (we're a little offtopic here too)
Trifton has quit [Read error: Connection reset by peer]
Trifton has joined #riscv
iooi has quit [Read error: Connection reset by peer]
iooi has joined #riscv
Tenkawa has quit [Quit: Was I really ever here?]
Trifton has quit [Remote host closed the connection]
Trifton has joined #riscv
davidlt__ has joined #riscv
davidlt__ has quit [Client Quit]
jacklsw has joined #riscv
heat_ has quit [Ping timeout: 248 seconds]
paulk has quit [Ping timeout: 260 seconds]
paulk has joined #riscv
paulk has quit [Changing host]
paulk has joined #riscv
TMM has quit [Quit: https://quassel-irc.org - Chat comfortably. Anywhere.]
TMM has joined #riscv
sakman_ is now known as sakman
iooi has quit [Ping timeout: 260 seconds]
iooi has joined #riscv
iooi has quit [Read error: Connection reset by peer]
iooi has joined #riscv
prabhakalad has quit [Ping timeout: 252 seconds]
indy has joined #riscv
prabhakalad has joined #riscv
BootLayer has joined #riscv
iooi has quit [Quit: iooi]
jacklsw has quit [Quit: Back to the real world]
coldfeet has joined #riscv
balrog has quit [Ping timeout: 260 seconds]
balrog has joined #riscv
fuwei has joined #riscv
klb73 has joined #riscv
stolen has joined #riscv
rlittl has joined #riscv
fuwei has quit [Read error: Connection reset by peer]
fuwei has joined #riscv
fuwei has quit [Ping timeout: 255 seconds]
fuwei has joined #riscv
Ellenor has quit [Remote host closed the connection]
iooi has joined #riscv
Ellenor has joined #riscv
jfsimon1981_c has quit [Ping timeout: 248 seconds]
jfsimon1981 has joined #riscv
jfsimon1981 has quit [Remote host closed the connection]
jfsimon1981 has joined #riscv
jfsimon1981 has quit [Ping timeout: 245 seconds]
Stat_headcrabed has joined #riscv
memset has quit [Ping timeout: 260 seconds]
heat_ has joined #riscv
Stat_headcrabed has quit [Quit: Stat_headcrabed]
memset has joined #riscv
jfsimon1981 has joined #riscv
heat_ has quit [Read error: Connection reset by peer]
heat_ has joined #riscv
jfsimon1981 has quit [Remote host closed the connection]
jfsimon1981 has joined #riscv
heat_ has quit [Read error: Connection reset by peer]
heat_ has joined #riscv
jfsimon1981 has quit [Remote host closed the connection]
jfsimon1981 has joined #riscv
<conchuod> Tenkawa it's WIP at the moment, 6.12 or 6.13 for rudimentary support.
psydroid2 has joined #riscv
psydroid2 has quit [Client Quit]
psydroid2 has joined #riscv
heat_ has quit [Read error: Connection reset by peer]
stolen has quit [Quit: Connection closed for inactivity]
heat_ has joined #riscv
Trifton has quit [Quit: ~~~RiDiN tHe WaVeS~~~]
Andre_Z has joined #riscv
coldfeet has quit [Remote host closed the connection]
iooi has quit [Quit: iooi]
Stat_headcrabed has joined #riscv
Tenkawa has joined #riscv
Stat_headcrabed has quit [Quit: Stat_headcrabed]
iooi has joined #riscv
iooi has quit [Quit: iooi]
iooi has joined #riscv
iooi has quit [Client Quit]
bjoto has quit [Remote host closed the connection]
Stat_headcrabed has joined #riscv
pbsds3 has quit [Quit: The Lounge - https://thelounge.chat]
pbsds3 has joined #riscv
Andre_Z has quit [Ping timeout: 255 seconds]
coldfeet has joined #riscv
Andre_Z has joined #riscv
Narrat has joined #riscv
Andre_Z has quit [Ping timeout: 248 seconds]
arcade_droid has quit [Quit: Quit]
arcade_droid has joined #riscv
Stat_headcrabed has quit [Quit: Stat_headcrabed]
coldfeet has quit [Remote host closed the connection]
bjoto has joined #riscv
davidlt has joined #riscv
SpaceCoaster_ has joined #riscv
SpaceCoaster has quit [Ping timeout: 252 seconds]
SpaceCoaster_ is now known as SpaceCoaster
jfsimon1981 has quit [Ping timeout: 252 seconds]
Stat_headcrabed has joined #riscv
somlo_ has joined #riscv
kaaliakahn3 has joined #riscv
zv_ has joined #riscv
smaeul_ has joined #riscv
[jimbzy] has joined #riscv
Noisytoot has quit [Killed (tantalum.libera.chat (Nickname regained by services))]
Noisytoot has joined #riscv
tux3_ has joined #riscv
nmeum_ has joined #riscv
jrjsmrtn has joined #riscv
jfsimon1981_b has joined #riscv
nmeum has quit [*.net *.split]
kaaliakahn2 has quit [*.net *.split]
jimbzy has quit [*.net *.split]
khem has quit [*.net *.split]
markh has quit [*.net *.split]
jrjsmrtn_ has quit [*.net *.split]
valerius has quit [*.net *.split]
FL4SHK has quit [*.net *.split]
smaeul has quit [*.net *.split]
vigneshr has quit [*.net *.split]
zv has quit [*.net *.split]
somlo has quit [*.net *.split]
Amanieu has quit [*.net *.split]
SanchayanMaity has quit [*.net *.split]
crest has quit [*.net *.split]
drewfustini has quit [*.net *.split]
moto-timo has quit [*.net *.split]
mobius has quit [*.net *.split]
JSharp has quit [*.net *.split]
tux3 has quit [*.net *.split]
arnd has quit [*.net *.split]
cwittlut has quit [*.net *.split]
khem has joined #riscv
valerius has joined #riscv
markh has joined #riscv
FL4SHK has joined #riscv
vigneshr has joined #riscv
Amanieu has joined #riscv
SanchayanMaity has joined #riscv
crest has joined #riscv
drewfustini has joined #riscv
mobius has joined #riscv
JSharp has joined #riscv
moto-timo has joined #riscv
arnd has joined #riscv
cwittlut has joined #riscv
markh has quit [Read error: Connection reset by peer]
markh has joined #riscv
FL4SHK has quit [Ping timeout: 265 seconds]
heat_ is now known as heat
FL4SHK has joined #riscv
Narrat has quit [Quit: They say a little knowledge is a dangerous thing, but it's not one half so bad as a lot of ignorance.]
lhp22 has joined #riscv
Stat_headcrabed has quit [Quit: Stat_headcrabed]
lhp22 has quit [Client Quit]
Starfoxxes has joined #riscv
coldfeet has joined #riscv
heat has quit [Read error: Connection reset by peer]
heat has joined #riscv
TMM has quit [Quit: https://quassel-irc.org - Chat comfortably. Anywhere.]
TMM has joined #riscv
iooi has joined #riscv
iooi has quit [Client Quit]
davidlt has quit [Ping timeout: 252 seconds]
psydroid2 has quit [Quit: KVIrc 5.0.0 Aria http://www.kvirc.net/]
BootLayer has quit [Quit: Leaving]
coldfeet has quit [Remote host closed the connection]
Starfoxxes has quit [Read error: Connection reset by peer]
drmpeg has quit [Ping timeout: 276 seconds]
drmpeg has joined #riscv
jfsimon1981_c has joined #riscv
jfsimon1981_b has quit [Read error: Connection reset by peer]
sajattack has quit [Ping timeout: 260 seconds]
sajattack has joined #riscv
jfsimon1981_c is now known as jfsimon
jfsimon has quit [Remote host closed the connection]
jfsimon has joined #riscv
prabhakalad has quit [Quit: Konversation terminated!]
prabhakalad has joined #riscv
naoki has joined #riscv
DesRoin has quit [Ping timeout: 276 seconds]
DesRoin has joined #riscv
Tenkawa has quit [Quit: Was I really ever here?]
Tenkawa has joined #riscv
pavelow has quit [Quit: No Ping reply in 180 seconds.]
pavelow has joined #riscv