IRC channel logs
2024-11-02.log
back to list of logs
<damo22>why would mig be generating this massive message size? _Static_assert(sizeof(drm_version_t) == 4 * 1545, "expected drm_version_t to be size 4 * 1545"); <lakeblue>just got the cross compilation environment for hurd working. yay! <lakeblue>i'm amazed the web server worked first try on hurd <damo22>im having trouble setting a mig struct type as an "out" parameter, it seems to not understand its length <solid_black>I don't think you can use it as a struct field like that <solid_black>and I'd expect MIG to complain loudly when you do try to use it, instead of just generating broken code <solid_black>you could ask Flavio to make it error out earlier about this <solid_black>where do you even expect this 'name' pointer to point? OOL data in the message? what about the ioctl? <solid_black>or is it supposed to be an inline variable-size array, prefixed by its length? <solid_black>in any case, the glibc-side ioctl implementation cannot grok anything complex like that <solid_black>my intuition would be to implement drm APIs as a poper RPC subsystem rather than mimicing Linux ioctls, and have a separate Hurd backend in libdrm <damo22>cant you put a pointer into an ioctl? <solid_black>I don't think so, where do you expect it will point? <solid_black>might be a good idea to check how it works on Linux first indeed :) <solid_black>see, in Mach IPC, it's OK for data to just appear in recepient's address space, as new pages where nothing else was mapped <damo22>i think it expects the caller to write to the address pointing to kernel memory? <damo22>the caller sends a pointer to its local address space and the ioctl writes to the buffer? <solid_black>that could work (on Linux), but is it how it actually works? <damo22>err = drm_copy_field(version->name, &version->name_len, <solid_black>in any case, the Hurd ioctl implementation in glibc can only deal with simple structures of (char, int16, int32, int64) <damo22>how do i implement a compatible interface then? <solid_black>write a backend for libdrm that calls those routines <damo22>its mostly compatible, just not the pointers <solid_black>ioctl is really not a good API for anything, Linux just uses it 'cause they don't have a better API to do RPC / extensible syscalls; we do, it's called Mach IPC :) <damo22>can i reuse my code? i have implemented most of the ioctl way <solid_black>yeah I imagine most of the implementation doesn't care whether the RPC is supposed to be usable as an ioctl <damo22>but i still have a problem, dont i need to implement mig types? <damo22>so mig can generate the interface <damo22>so i need to stick to simpler structures <damo22>then, it doesnt even matter if its an ioctl or not <solid_black>in no-ioctl MIG, you could just do routine drm_get_version(port: drm_t; out version_major: int; out version_min: int; ... out name: string_t; ...); <damo22>oh i dont need to stuff everything into a simpler struct <solid_black>or maybe you _can_ put data_t into a new-style struct? <solid_black>there are classic structs, which are only structs in the name but really arrays of integers <damo22>type io_statbuf_spare_int = struct[8] of int; <damo22>so you can nest the types, but you probably cant put pointers in there <solid_black>but if you got a static assertion failure once you've tried, it's a good indication that it doesn't work <damo22>but what good would a pointer be from the other side of the rpc? <solid_black>i.e. it's not just a pointer, it's a buffer which gets copied, and the receiver gets a pointer in its own adress space pointing to the received data <solid_black>you wouldn't need spearate _len parameters at the MIG level <damo22>how do you specify a pointer type <solid_black>I gotta run, but look at how strings are passed around elsehwere, in other subsystems <azert>damo22: I think it is a bad idea to drift away from the Linux implementation api wise <azert>Just keep it the same and improve mig/glibc instead <azert>If something is not usable as an ioctl, use it as an rpc for the moment <azert>But adding parameters is a bad idea <damo22>that contradicts the other advice i got, and ive already been refactoring it <azert>damo22: it’s not clear why you want to change the api <azert>If it’s just that glibc cannot handle such complex ioctl then use them as rpc: they are rpcs <damo22>the kernel isnt sharing the address space? <damo22>mig understands how to copy 2048 byte strings <damo22>it passes around virtual kernel addresses <damo22>unless it defers the writes to the kernel itself and just stores the pointers for later <azert>You can do the same in the hurd <azert>Give an example of these kernel address uses <damo22> int count; /**< Length of the buffer list */ <damo22> void __user *virtual; /**< Mmap'd area in user-virtual */ <damo22> struct drm_buf_pub __user *list; /**< Buffer information */ <azert>btw a pointer is just an integer <damo22>yes i mean i can pass pointers anywhere <damo22>but dereferencing them from kernel -> user is not allowed <azert>I think gnumach allows mapping the page in the server address space <azert>That is what io_read and io_write rpc do <damo22>nested structs are a pain to deal with in mig <azert>On the other hand, you probably want an Hurd api to be totally different using memory objects and such <damo22>so i have been flattening some of them <damo22>but sometimes there are arrays of structs <damo22>i dont know what to do with them <azert>I don’t think flattening is the solution <azert>Either one works on mig to make him understand these things, which may be impossible, or one redesign the api in the hurdish sense <azert>But I’m not sure everything is in place even.. <damo22>the point of drm is to abstract the hardware specific detail of 3d acceleration to a common api <damo22>the cards need to allocate memory on themselves and transfer pixel data to and from the card <azert>That’s why I was pointing out the pager gnumach api <damo22>but for our dummy driver, it should be a trivial implementation <damo22>the problem is there are ~200 stubs <azert>I think that if you formulate the issues clearly, solid_black and youpi have the solutions <damo22>i need to choose a better subsystem id <damo22>crw-rw-r-- 1 demo demo 0, 0 Nov 2 21:22 c <damo22>-rwxrwxr-x 1 demo demo 170828 Nov 2 21:20 drm <almuhs>the party has finished? I forgot Spain changing timezone