Re: [PATCH] libmachdev: Install as translator when bootstrapping && fix rumpdisk injection
Hi, On 15/11/20 11:33 am, Damien Zammit wrote: > I will test again without it. It works in both modes with current master! Damien
Re: [PATCH] libmachdev: Install as translator when bootstrapping && fix rumpdisk injection
Damien Zammit, le dim. 15 nov. 2020 11:33:06 +1100, a ecrit: > On 14/11/20 9:09 pm, Samuel Thibault wrote: > > This looks odd to me. The "@/dev/master:" part should rather be > > dropped way before, by the code that opens /dev/master to access the > > master device port before calling device_open() on it: the translators > > shouldn't have to grok which way they were accessed. > > There are two cases to think about here: > 1) rumpdisk was booted as a bootstrapped task > 2) rumpdisk was called from a userspace translator > In both cases, you need @/dev/rumpdisk:/dev/X to be recognised as a valid > access rule. Yes, but in both cases the piece of code that is interpreting @/dev/rumpdisk should also be eating it. Samuel
Re: [PATCH] libmachdev: Install as translator when bootstrapping && fix rumpdisk injection
Damien Zammit, le dim. 15 nov. 2020 11:26:03 +1100, a ecrit: > By the way, should we keep the device right stored in struct block_device *bd, > so we can give already open devices the same right? I'm not sure of the details since I haven't been looking at the ports doc for a long time, but AIUI it cannot be the same right that the other process is getting anyway, so making a ports_get_right call makes sense. Samuel
Re: [PATCH] libmachdev: Install as translator when bootstrapping && fix rumpdisk injection
Hi, On 14/11/20 9:09 pm, Samuel Thibault wrote: > This looks odd to me. The "@/dev/master:" part should rather be > dropped way before, by the code that opens /dev/master to access the > master device port before calling device_open() on it: the translators > shouldn't have to grok which way they were accessed. There are two cases to think about here: 1) rumpdisk was booted as a bootstrapped task 2) rumpdisk was called from a userspace translator In both cases, you need @/dev/rumpdisk:/dev/X to be recognised as a valid access rule. Perhaps I confused myself and maybe it is not needed, you could be correct. I will test again without it. Damien
Re: [PATCH] libmachdev: Install as translator when bootstrapping && fix rumpdisk injection
On 14/11/20 8:17 pm, Samuel Thibault wrote: > Hello, > > Damien Zammit, le sam. 14 nov. 2020 14:37:37 +1100, a ecrit: >> Previous problems mentioned with 2x rumpdisk partitions all fixed. > > Congrats! > > What was the issue? The logic around default behaviour when the device was already open was broken, causing D_ALREADY_OPEN from being returned I think gave EBUSY but the send right was still being set? I'm not exactly sure, but after I fixed the device_open logic it worked correctly. By the way, should we keep the device right stored in struct block_device *bd, so we can give already open devices the same right? Or is it okay to continue calling ports_get_right(bd) every time we reopen? Damien
Re: [PATCH] libmachdev: Install as translator when bootstrapping && fix rumpdisk injection
jbra...@dismail.de, le sam. 14 nov. 2020 20:48:07 +, a ecrit: > Are you trying to replace the Hurd's > extfs server with a rump driver? Not exactly: replace the gnumach disk drivers with the rump disk drivers. Samuel
Re: [PATCH] libmachdev: Install as translator when bootstrapping && fix rumpdisk injection
Yeah! AWESOME WORK! Also, what did you just do? Are you trying to replace the Hurd's extfs server with a rump driver? November 14, 2020 4:17 AM, "Samuel Thibault" wrote: > Hello, > > Damien Zammit, le sam. 14 nov. 2020 14:37:37 +1100, a ecrit: > >> Previous problems mentioned with 2x rumpdisk partitions all fixed. > > Congrats! > > What was the issue? > > Samuel
Re: [PATCH] libmachdev: Install as translator when bootstrapping && fix rumpdisk injection
I have simplified rumpdisk's device_open. Samuel
Re: [PATCH] libmachdev: Install as translator when bootstrapping && fix rumpdisk injection
Samuel Thibault, le sam. 14 nov. 2020 11:09:48 +0100, a ecrit: > Damien Zammit, le sam. 14 nov. 2020 14:37:37 +1100, a ecrit: > > /* BSD name of whole disk device is /dev/wdXd > > - * but we will receive /dev/wdX as the name */ > > + * but we will receive /dev/wdX as the name > > + * or @/dev/master:/dev/wdX */ > > This looks odd to me. The "@/dev/master:" part should rather be > dropped way before, by the code that opens /dev/master to access the > master device port before calling device_open() on it: the translators > shouldn't have to grok which way they were accessed. AIUI 0f77ef36b53b ("libstore: Add ability to pass custom master device with format @master:/dev/device") should already doing it, I guess there is another place that needs to be fixed as well, and we want to do that instead of papering over it. Samuel
Re: [PATCH] libmachdev: Install as translator when bootstrapping && fix rumpdisk injection
Damien Zammit, le sam. 14 nov. 2020 14:37:37 +1100, a ecrit: > @@ -53,7 +53,7 @@ struct block_data >char name[DISK_NAME_LEN]; /* eg /dev/wd0 */ >off_t media_size; /* total block device size */ >uint32_t block_size; /* size in bytes of 1 sector */ > - bool taken;/* simple refcount */ > + bool opening; /* simple lock */ >struct block_data *next; > }; > + bd = search_bd (dev_name); >if (!bd) > { >err = machdev_create_device_port (sizeof (*bd), &bd); > > - snprintf (bd->name, DISK_NAME_LEN, "%s", name); > + snprintf (bd->name, DISK_NAME_LEN, "%s", dev_name); > + bd->opening = true; >bd->mode = mode; >bd->device.emul_data = bd; >bd->device.emul_ops = &rump_block_emulation_ops; > @@ -253,6 +284,9 @@ device_write (void *d, mach_port_t reply_port, >if ((bd->mode & D_WRITE) == 0) > return D_INVALID_OPERATION; > > + if (bd->opening) > +return D_WOULD_BLOCK; > + ? That cannot happen: the only period during which opening would be true is during the device_open call in case the disk is getting opened for the first time. But during that period, no port has been returned yet that could be used to call device_write/read on it... Samuel
Re: pci-arbiter + rumpdisk
Damien Zammit, le sam. 14 nov. 2020 17:59:30 +1100, a ecrit: > > youpi: pci-arbiter could be exposed as a device name in the master device > > port and the userland pci-arbiter running on /server/bus/pci can try to > > open that > > youpi: just like netdde tries to open eth0 to check whether there are > > already device drivers in gnumach, in which case it shouldn't handle > > network cards > > youpi: in the end, when we know for sure that pci-arbiter is run as a > > bootstrap translator, we can make /server/bus/pci a mere device node > > How do i make a bootstrap translator such as pci-arbiter expose a device name > in the master device port? By registering it with machdev_register, like you already did for rumpdisk. The idea is that the "master device port" that applications see is just a chain of master. Applications get it from the / ext2fs, but ext2fs got it from rumpdisk, whose ds_device_open catchs device_open calls on wd*, and otherwise calls device_open on its own master port, gotten from the previous translator in the bootstrap chain, which will now be pci-arbiter, which itself will catch device_open calls on pci, and otherwise calls device_open on its own master port, gotten from the kernel. Samuel
Re: [PATCH] libmachdev: Install as translator when bootstrapping && fix rumpdisk injection
Damien Zammit, le sam. 14 nov. 2020 14:37:37 +1100, a ecrit: > /* BSD name of whole disk device is /dev/wdXd > - * but we will receive /dev/wdX as the name */ > + * but we will receive /dev/wdX as the name > + * or @/dev/master:/dev/wdX */ This looks odd to me. The "@/dev/master:" part should rather be dropped way before, by the code that opens /dev/master to access the master device port before calling device_open() on it: the translators shouldn't have to grok which way they were accessed. Samuel
Re: [PATCH] libmachdev: Install as translator when bootstrapping && fix rumpdisk injection
Hello, Damien Zammit, le sam. 14 nov. 2020 14:37:37 +1100, a ecrit: > Previous problems mentioned with 2x rumpdisk partitions all fixed. Congrats! What was the issue? Samuel