Re: gnulib argp

2010-07-23 Thread Carles Pina i Estany

Hello,

Some time ago we talked about importing argp (to make it easier to add
gettext support for the --help strings):

http://lists.gnu.org/archive/html/grub-devel/2010-03/msg00100.html

I see that Vladimir imported gnulib argp module in revno 2282, so should
be ready to use in Grub.

Colin showed an example:
http://lists.gnu.org/archive/html/grub-devel/2010-03/msg00109.html

http://bazaar.launchpad.net/~cjwatson/man-db/trunk/annotate/head%3A/src/lexgrog_test.c

Any other thoughts about that? I can implement it in some Grub utility
to see how it goes. Actually I thought that Vladimir did but I cannot
find it.

Cheers,

-- 
Carles Pina i Estany
http://pinux.info

___
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel


Re: ZFS on Debian GNU/kFreeBSD

2010-07-23 Thread Seth Goldberg



Quoting Robert Millan, who wrote the following on Fri, 23 Jul 2010:


The problem I see with current zfs.mod is that it integrates with GRUB using
the "filesystem model", i.e. each pool has one
backend (the storage device) and one frontend (the filesystem).

But ZFS is different in both ends: each pool can use N storage devices
and provide M filesystems. In the current representation this yields
two problems
for GRUB:

- zpools where more than one device is essential (i.e. not just
mirror like RAID1)
  aren't accessible.


  Very true, and if non-mirrored root pools are supported in the future, that 
will be a problem.




- To allow more more than one filesystem in a zpool, filesystems are
selected in
  a special manner, e.g.:
  (hd0)/@/
  (hd0)/foo@/
  This collides with an assumption consistently made by GRUB utilities
  and scripts: that you can construct a GRUB path by combining the result
  of make_path_relative_to_its_root() (known at install time) with the device
  that contains this filesystem (usually known at run time).


  Well, that still does work -- you just need to modify 
make_path_relative_to_its_root ;).




My impression is representing ZFS as a filesystem is doable, but not
the best fit.
ZFS is much more like what GRUB calls an "abstraction" (RAID or LVM). In fact
if you take LVM interface:

grub> ls
(hd0) (hd1)
grub> insmod lvm
grub> ls
(hd0) (hd1) (foo) (bar)

the only difference for ZFS is that (foo) and (bar) are provided directly as
filesystems (like pxe.mod does) instead of block devices for GRUB to probe.


  How do you deal with multiple pools each with the same filesystem names?  We 
do need a namespace -- top-level should be () (though keep in mind 
it's possible for different pools with the same pool name to exist, so we'd 
need a uniquifier here also).


So my intention is to readjust zfs.mod to follow this interface. Aside from 
enabling multi-device pools, this will also make it much easier to support 
ZFS in the install utilities and scripts later.


Comments / objections / suggestions?


  Sounds like an interesting experiment, at least :).

 --S

___
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel


Re: ZFS on Debian GNU/kFreeBSD

2010-07-23 Thread Seth Goldberg



Quoting Robert Millan, who wrote the following on Fri, 23 Jul 2010:


2010/7/22 Seth Goldberg 

I guess the API exported by libzfs can serve for this?  But first, I
have some concern about zfs.mod, I'll write a detailed mail about that
later.


 That's how I'm implementing it, though libzfs is technically an uncommitted 
interface.


What are you currently implementing? I just want to make sure I don't
duplicate existing work.


 Sure -- The code I currently have in getroot.c and util.c is ugly (it's 
filesystem-aware), because of the disparity in the design as you mentioned. 
The code currently stat()s the given file, gets the st_dev and uses that to 
correlate the filesystem with the major/minor available via getextmntent(). 
It then looks at mnt_special (which is the zpool/zfs name) and looks up the 
pool via libzfs's zpool_get_physpath() (which only returns one device, 
incidentally, which is fine for now for testing, but is not good enough for a 
fault-tolerant configuration).  I also made modifications to 
grub_make_system_path_relative_to_its_root() to adapt the pathname passed in 
to Vladimir's current zfs design (/@/).  I now have working 
grub-probe and grub-setup (For Solaris's uses, I'm modifying grub-setup to use 
the boot slice in a Solaris partition instead of the zfs filesystem slice 
(because that's where our tools look for the boot loader on disk). Other OSes 
that use zfs can simply embed core into the zfs boot block area (which is over 
3M in size).


I like the idea of having the zfs stuff conform to the abstraction (though I 
think it's unique in its ability to use different-size disks, arbitrary 
partitions, etc, as part of its pool, so assuming that's workable in the GRUB2 
design, I'd much rather see ()/filesyst...@snapshot]/ at the 
top-level than have to deal with the disk partitions individually).  Since 
it's not an abstraction today, the code to deal with it has been a bit ugly -- 
I'm all for clean design here.






Uhm this sounds wrong, grub-setup isn't meant to handle filesystems
(it does something like you describe for RAID1, but only because it
can rely on the storage backend being 1:1).


 [...] To be truly fault-tolerant, if we're booting from a zfs pool, there must 
be an embedded config file that searches for a (non-faulted) root device from 
the pool's mirrors as well.  Separate invocations for each device in the root 
pool mirror are fine, though.


Ah, I understand you now. You want to take advantage of ZFS' fault-tollerancy
for boot blocks. I'm not sure this would make sense, because we have to give
up at some point (e.g. boot.img can't benefit from this), so we're just moving
the line. In any case, I just want the basic functionality to work and it's not


 Actually, that's not true.  Even boot.img can benefit if the system firmware 
cannot read from the disk (then fails over to the next bootable device in the 
device list -- and that's exactly what we do today on BIOS systems, and it 
works well).


 --S___
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel


Re: [PATCH] Optimise memset on i386

2010-07-23 Thread richardvo...@gmail.com
On Fri, Jul 23, 2010 at 2:48 PM, richardvo...@gmail.com <
richardvo...@gmail.com> wrote:

>
>
> On Fri, Jul 23, 2010 at 12:34 PM, Christian Franke <
> christian.fra...@t-online.de> wrote:
>
>> richardvoigt wrote:
>>
>>>
>>> might I suggest:
>>>
>>> unsigned long patternl = pattern8;
>>> patternl |= patternl << 8;
>>> patternl |= patternl << 16;
>>> patternl |= patternl << 32;
>>> patternl |= patternl << 64;
>>>
>>> O(lg N) instead of O(N), no loop, no branches, and the compiler should be
>>> smart enough to optimize away the last two lines on systems with narrower
>>> long.
>>>
>>
>> The latter is unfortunately not the case. At least gcc 4.5.0 prints a
>> warning but still produces code.
>>
>>
> Ok then, a compile-time conditional should fix that.
>
>

Thanks to Seth for pointing out my obvious bug.

unsigned long patternl = pattern8;
if (1 < sizeof patternl) patternl |= patternl << 8;
if (2 < sizeof patternl) patternl |= patternl << 16;
if (4 < sizeof patternl) patternl |= patternl << 32;
if (8 < sizeof patternl) patternl |= patternl << 64;



> I'm pretty confident in gcc's ability to optimize this version.  I hope.
>
___
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel


Re: grub2 on power6 box.

2010-07-23 Thread Lennart Sorensen
On Fri, Jul 23, 2010 at 02:35:48PM -0400, Lennart Sorensen wrote:
> Turns out using nvalias instead of devalias makes it permanent.
> 
> So I now boot to grub directly with an nvalias hd /pci set and
> boot-device set to hd (which means boot the PReP boot partition).
> 
> I now have to set root manually to (md0) and then load /boot/grub/grub.cfg
> as a configfile.  Then I can boot.  The fat partition is now needed
> at all.  The grub image has mdraid, raid and ext modules included in it
> and then dd'd to the PReP partition.
> 
> So how do I convince grub where to look for the config, or should I
> create a small config file that sets the root and loads a config file
> and embed that in the image perhaps?

OK, I am now booting from the disk directly.  Here are the steps I took.
Perhaps someone can help make grub-install actually work out of the box
on the IBM pSeries based on this.

I created a permanent devalias called hd using:
nvalias hd

I set boot-device to hd

The resulting nvram --print-config stuff is:
devalias  valias hd /p...@8002200/pci1014,0...@1/sas/d...@2 



use-nvramrc?=true   


   
boot-device=hd

I have an msdos partition table on my two disks with:
8MB partition1 type 0x41 (PReP boot partition)
140GB partition2 type 0xfd (linux raid autodetect)
6GB partition3 type 0xfd (linux raid autodetect)

This is then turned into md0 (for the 140GB partitions) and md1 (for
the 6GB partitions).  md1 is swap, md0 is root filesystem.

Fixing ofpathname in powerpc-ibm-utils (debian package name) to use find
/sys -type d -name $device makes it able to find the right OF pathnames,
but grub is unable to use those at this time, hence the manual devalias
above.  If grub ever did support the actual path, then the devalias
won't be needed and the ofpathname fix would be required.

I ran grub-install /dev/sda1 after hacking the script to not complain
about /boot/grub not being a seperate partition (that applies to Macs
and such, not the IBM).  I noted what modules it generated /boot/grub/grub
with.  It got the list right (ext2, mdraid, raid in my case) except it
missed that the partition table format is part_msdos.  I added part_msdos
and ram grub-mkimage again manually with the same arguments.  I also
added -p '(md0)/boot/grub' to embed the correct path to /boot/grub into
the image.  This was very important.  I then dd'd /boot/grub/grub to
/dev/sda1 and /dev/sdb1 (the PReP partitions) and set the partitions
bootable (not that I think it matters if they are bootable).

After all that, the IBM pSeries p520 power6 now boots directly from disk.

So how would one explain to grub-install that it needs part_msdos when
the partition tables that the md devices are running on are of type msdos?
How would one make it automatically add the correct prefix (since it
needs either (hd,msdos#)/boot/grub or (md0)/boot/grub or similar added
instead of the default)?  And of course finally it would have to dd to
the target device, rather than just create a file and try to make the
firmware boot that file.  The boot device also has to be the full disk
on the IBM, not a disk,partition,file combination.

But hey, at least it can work with a bit of manual work.

Thanks for the hints everyone.

-- 
Len Sorensen

___
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel


Re: [PATCH] Optimise memset on i386

2010-07-23 Thread richardvo...@gmail.com
On Fri, Jul 23, 2010 at 12:34 PM, Christian Franke <
christian.fra...@t-online.de> wrote:

> richardvoigt wrote:
>
>>
>> might I suggest:
>>
>> unsigned long patternl = pattern8;
>> patternl |= patternl << 8;
>> patternl |= patternl << 16;
>> patternl |= patternl << 32;
>> patternl |= patternl << 64;
>>
>> O(lg N) instead of O(N), no loop, no branches, and the compiler should be
>> smart enough to optimize away the last two lines on systems with narrower
>> long.
>>
>
> The latter is unfortunately not the case. At least gcc 4.5.0 prints a
> warning but still produces code.
>
>
Ok then, a compile-time conditional should fix that.

unsigned long patternl = pattern8;
if (8 < sizeof patternl) patternl |= patternl << 8;
if (16 < sizeof patternl) patternl |= patternl << 16;
if (32 < sizeof patternl) patternl |= patternl << 32;
if (64 < sizeof patternl) patternl |= patternl << 64;

I'm pretty confident in gcc's ability to optimize this version.  I hope.
___
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel


Re: grub2 on power6 box.

2010-07-23 Thread Lennart Sorensen
On Fri, Jul 23, 2010 at 01:56:34PM -0400, Lennart Sorensen wrote:
> Now we are getting somewhere.  So it seems even with a fat12 partition,
> the open firmware on the IBM box still won't boot from a file.
> 
> Unfortunately on reboot, my devalias is gone.  How do I make it remember it?

Turns out using nvalias instead of devalias makes it permanent.

So I now boot to grub directly with an nvalias hd /pci set and
boot-device set to hd (which means boot the PReP boot partition).

I now have to set root manually to (md0) and then load /boot/grub/grub.cfg
as a configfile.  Then I can boot.  The fat partition is now needed
at all.  The grub image has mdraid, raid and ext modules included in it
and then dd'd to the PReP partition.

So how do I convince grub where to look for the config, or should I
create a small config file that sets the root and loads a config file
and embed that in the image perhaps?

-- 
Len Sorensen

___
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel


Re: grub2 on power6 box.

2010-07-23 Thread Lennart Sorensen
On Fri, Jul 23, 2010 at 01:36:08PM -0400, Lennart Sorensen wrote:
> On Fri, Jul 23, 2010 at 07:02:15PM +0200, Vladimir 'φ-coder/phcoder' 
> Serbinenko wrote:
> > Right now grub2 lists only aliased devices. You can either alias your
> > disk or directly use:
> 
> Unfortunately I think IBM doesn't generate aliases at all.  I have no
> idea how to set one (I can't find any documentation on what commands
> are available on IBM's openfirmware).
> 
> > prefix=(/p...@8002200/pci1014\,0...@1/sas/d...@2,4)/
> > I have some code on ls issue but the problem is to reliably determine if 2 
> > nodes are really the same device
> 
> So that syntax should work?
> 
> I tried doing something like:
> ls (/p...@8002200/pci1014\,0...@1/sas/d...@2,4)/
> 
> It didn't like it.
> 
> ls (/p...@8002200/pci1014\,0...@1/sas/d...@2:4)/
> 
> didn't work either as far as I recall.
> 
> I will keep trying though.

OK, so after setting the devalias I tried booting grub from the PReP boot 
partition I dd'd it to.  Now I get:

grub> ls (  


   
Possible devices are:   


   



   
 md0 md1 hd 


   
grub> ls (  


   
Possible devices are:   


   



   
 md0 md1 hd 


   
grub> ls (hd,   


   
Possible partitions are:


   



   
Partition hd,msdos1: Unknown filesystem 


   
Partition hd,msdos2: Filesystem type ext2 - Label "ROOT" - Last 
modification time   

   
2010-07-23 16:19:51 Friday, UUID 43073e86-01fb-4371-8598-863fbd0beddf   


   
Partition hd,msdos3: Unknown filesystem 
 

Re: grub2 on power6 box.

2010-07-23 Thread Lennart Sorensen
On Fri, Jul 23, 2010 at 01:46:57PM -0400, Lennart Sorensen wrote:
> Hmm.  Neat.  I will give that a try.
> 
> So with /dev/sda4 a fat partition, I still didn't have any luck with:
> 
> boot hd:4,\grub
> 
> I just get:
> 
> 0 > boot hd:4,\grub  ok   
>   
>   
>  
> 0 >

So right now I have this state:

If I go to the open firmware prompt and do:

devalias hd /p...@8002200/pci1014,0...@1/sas/d...@2
boot hd

Then I can boot the grub image I dd'd to the /dev/sda1 PReP boot
partition.  I can then boot linux after loading the configfile manually
(grub doesn't seem to know /dev/sda4 is where to look for it since it
booted from /dev/sda1 I guess).

The devalias won't stay across reboots (Rather annoying).

So I can now boot from disk with some manual intervention.  That's getting
really close then.

-- 
Len Sorensen

___
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel


Re: grub2 on power6 box.

2010-07-23 Thread Lennart Sorensen
On Fri, Jul 23, 2010 at 02:28:55PM -0300, Manoel Rebelo Abraches wrote:
> OF can read FAT12 filesystem.

FAT12, but not FAT16?  How convinient.  Must try that.

> you could format it with fat 12 and then mount it at /boot/grub.
> then you can use grub-install and grub-mkconfig to create a grub.cfg
>  I think the easiest way  is to set a devalias in OF to point to you
> device:
> devalias hd /p...@8002200/pci1014,0...@1/sas/d...@2 
> then it should appear when you use the 'ls' command.
> you could also set boot-device to
> hd:,grub 
> since OF can read FAT12 filesystem it will be able to find grub there.

Hmm.  Neat.  I will give that a try.

So with /dev/sda4 a fat partition, I still didn't have any luck with:

boot hd:4,\grub

I just get:

0 > boot hd:4,\grub  ok 


   
0 >

-- 
Len Sorensen

___
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel


Re: [PATCH] Optimise memset on i386

2010-07-23 Thread Christian Franke

richardvoigt wrote:


might I suggest:

unsigned long patternl = pattern8;
patternl |= patternl << 8;
patternl |= patternl << 16;
patternl |= patternl << 32;
patternl |= patternl << 64;

O(lg N) instead of O(N), no loop, no branches, and the compiler should 
be smart enough to optimize away the last two lines on systems with 
narrower long.


The latter is unfortunately not the case. At least gcc 4.5.0 prints a 
warning but still produces code.


$ cat = width of type
x.c:4: warning: left shift count >= width of type

$ cat f.s
...
pushl   %ebp
movl$32, %ecx
movl%esp, %ebp
movl8(%ebp), %eax
popl%ebp
movl%eax, %edx
sall%cl, %edx
movl$64, %ecx
orl %eax, %edx
movl%edx, %eax
sall%cl, %eax
orl %edx, %eax
ret


--
Regards,
Christian Franke


___
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel


Re: grub2 on power6 box.

2010-07-23 Thread Lennart Sorensen
On Fri, Jul 23, 2010 at 07:02:15PM +0200, Vladimir 'φ-coder/phcoder' Serbinenko 
wrote:
> Right now grub2 lists only aliased devices. You can either alias your
> disk or directly use:

Unfortunately I think IBM doesn't generate aliases at all.  I have no
idea how to set one (I can't find any documentation on what commands
are available on IBM's openfirmware).

> prefix=(/p...@8002200/pci1014\,0...@1/sas/d...@2,4)/
> I have some code on ls issue but the problem is to reliably determine if 2 
> nodes are really the same device

So that syntax should work?

I tried doing something like:
ls (/p...@8002200/pci1014\,0...@1/sas/d...@2,4)/

It didn't like it.

ls (/p...@8002200/pci1014\,0...@1/sas/d...@2:4)/

didn't work either as far as I recall.

I will keep trying though.

-- 
Len Sorensen

___
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel


Re: grub2 on power6 box.

2010-07-23 Thread Manoel Rebelo Abraches
On Fri, 2010-07-23 at 11:39 -0400, Lennart Sorensen wrote:
> On Fri, Jul 23, 2010 at 09:57:37AM -0400, Lennart Sorensen wrote:
> > On Fri, Jul 23, 2010 at 07:56:27AM +0200, Vladimir 'φ-coder/phcoder' 
> > Serbinenko wrote:
> > > On 07/22/2010 11:23 PM, Lennart Sorensen wrote:
> > > > I am trying to use grub2 to boot an IBM p520 power6 box.  I know yaboot
> > > > can do the job, but it doesn't deal with software raid, ext4, LVM or
> > > > anything else useful.
> > > >
> > > > I have managed to get as far as booting to a grub prompt from disk.
> > > > Unfortunately it doesn't appear to be seeing any disks at that point.
> > > >
> > > > The way I got it this far was to create an 8MB (smallest cfdisk would
> > > > make) PReP boot partition, and then run grub-mkimage -n -o /tmp/grub -O
> > > > powerpc-ieee1275 *.mod in the ieee1275 grub directory.  I then dd'd
> > > > /tmp/grub to /dev/sda1 (the PReP boot partition).
> > > >
> > > >   
> > > You need to add -p "". Also avoid the
> > > raid and lvm-related modules you don't need. OFW exposes ghost devices
> > > so assembling raids which involves looking at all devices is slow
> > 
> > I will try that (although I think I did).
> > 
> > I can't even get it to do ls on any disk or anything.  It really seems
> > to be behaving as if it doesn't detect any disks.
> 
> So I fixed ofpathname (it was not working because it did find /sys -name
> $device, which mathes multiple things on modern kernels).  I changed the
> find to find /sys -type d -name $device and now that works.  So now I
> can run grub-install, but of course that just creates a /boot/grub/grub
> file with the main grub and a filesystem module attached.  It doesn't
> actually boot.
> 
> It set the
> boot_device=/p...@8002200/pci1014,0...@1/sas/d...@2:4,\grub
> 
> /dev/sda4 is a fat16 partition mounted as /boot/grub.  Unfortunately I
> am not convinced the IBM boxes know how to read filesystems or boot
> files.  It seems it only wants to read raw from a PReP boot partition.
OF can read FAT12 filesystem.
you could format it with fat 12 and then mount it at /boot/grub.
then you can use grub-install and grub-mkconfig to create a grub.cfg
 I think the easiest way  is to set a devalias in OF to point to you
device:
devalias hd /p...@8002200/pci1014,0...@1/sas/d...@2 
then it should appear when you use the 'ls' command.
you could also set boot-device to
hd:,grub 
since OF can read FAT12 filesystem it will be able to find grub there.


> So when I dd /boot/grub/grub to /dev/sda1 (an 8MB PReP boot partition)
> the system does start grub, but of course since grub was only the core
> plus the fat module, it just says:
> 
> Welcome to GRUB!  
>   
>   
>  
>   
>   
>   
>  
> error: no device is set.
> Entering rescue mode...   
>   
>   
>  
> grub rescue>
> 
> So what do I do then to get it to know what device to use?
> 

-- 
Best Regards,

Manoel Rebelo Abranches
Software engineer
IBM - Linux Technology Center - Brazil


___
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel


Re: grub2 on power6 box.

2010-07-23 Thread Vladimir 'φ-coder/phcoder' Serbinenko
On 07/23/2010 05:39 PM, Lennart Sorensen wrote:
> On Fri, Jul 23, 2010 at 09:57:37AM -0400, Lennart Sorensen wrote:
>   
>> On Fri, Jul 23, 2010 at 07:56:27AM +0200, Vladimir 'φ-coder/phcoder' 
>> Serbinenko wrote:
>> 
>>> On 07/22/2010 11:23 PM, Lennart Sorensen wrote:
>>>   
 I am trying to use grub2 to boot an IBM p520 power6 box.  I know yaboot
 can do the job, but it doesn't deal with software raid, ext4, LVM or
 anything else useful.

 I have managed to get as far as booting to a grub prompt from disk.
 Unfortunately it doesn't appear to be seeing any disks at that point.

 The way I got it this far was to create an 8MB (smallest cfdisk would
 make) PReP boot partition, and then run grub-mkimage -n -o /tmp/grub -O
 powerpc-ieee1275 *.mod in the ieee1275 grub directory.  I then dd'd
 /tmp/grub to /dev/sda1 (the PReP boot partition).

   
 
>>> You need to add -p "". Also avoid the
>>> raid and lvm-related modules you don't need. OFW exposes ghost devices
>>> so assembling raids which involves looking at all devices is slow
>>>   
>> I will try that (although I think I did).
>>
>> I can't even get it to do ls on any disk or anything.  It really seems
>> to be behaving as if it doesn't detect any disks.
>> 
> So I fixed ofpathname (it was not working because it did find /sys -name
> $device, which mathes multiple things on modern kernels).  I changed the
> find to find /sys -type d -name $device and now that works.  So now I
> can run grub-install, but of course that just creates a /boot/grub/grub
> file with the main grub and a filesystem module attached.  It doesn't
> actually boot.
>
> It set the
> boot_device=/p...@8002200/pci1014,0...@1/sas/d...@2:4,\grub
>
> /dev/sda4 is a fat16 partition mounted as /boot/grub.  Unfortunately I
> am not convinced the IBM boxes know how to read filesystems or boot
> files.  It seems it only wants to read raw from a PReP boot partition.
> So when I dd /boot/grub/grub to /dev/sda1 (an 8MB PReP boot partition)
> the system does start grub, but of course since grub was only the core
> plus the fat module, it just says:
>
> Welcome to GRUB!  
>   
>   
>  
>   
>   
>   
>  
> error: no device is set.
> Entering rescue mode...   
>   
>   
>  
> grub rescue>
>
> So what do I do then to get it to know what device to use?
>
>   
Right now grub2 lists only aliased devices. You can either alias your
disk or directly use:

prefix=(/p...@8002200/pci1014\,0...@1/sas/d...@2,4)/
I have some code on ls issue but the problem is to reliably determine if 2 
nodes are really the same device




-- 
Regards
Vladimir 'φ-coder/phcoder' Serbinenko




signature.asc
Description: OpenPGP digital signature
___
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel


Re: [PATCH] Optimise memset on i386

2010-07-23 Thread richardvo...@gmail.com
[snip]

> +  unsigned long patternl = 0;
> +  grub_size_t i;
> +
> +  for (i = 0; i < sizeof (unsigned long); i++)
> +   patternl |= ((unsigned long) pattern8) << (8 * i);
> +
>

might I suggest:

unsigned long patternl = pattern8;
patternl |= patternl << 8;
patternl |= patternl << 16;
patternl |= patternl << 32;
patternl |= patternl << 64;

O(lg N) instead of O(N), no loop, no branches, and the compiler should be
smart enough to optimize away the last two lines on systems with narrower
long.
___
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel


Re: grub2 on power6 box.

2010-07-23 Thread Lennart Sorensen
On Fri, Jul 23, 2010 at 09:57:37AM -0400, Lennart Sorensen wrote:
> On Fri, Jul 23, 2010 at 07:56:27AM +0200, Vladimir 'φ-coder/phcoder' 
> Serbinenko wrote:
> > On 07/22/2010 11:23 PM, Lennart Sorensen wrote:
> > > I am trying to use grub2 to boot an IBM p520 power6 box.  I know yaboot
> > > can do the job, but it doesn't deal with software raid, ext4, LVM or
> > > anything else useful.
> > >
> > > I have managed to get as far as booting to a grub prompt from disk.
> > > Unfortunately it doesn't appear to be seeing any disks at that point.
> > >
> > > The way I got it this far was to create an 8MB (smallest cfdisk would
> > > make) PReP boot partition, and then run grub-mkimage -n -o /tmp/grub -O
> > > powerpc-ieee1275 *.mod in the ieee1275 grub directory.  I then dd'd
> > > /tmp/grub to /dev/sda1 (the PReP boot partition).
> > >
> > >   
> > You need to add -p "". Also avoid the
> > raid and lvm-related modules you don't need. OFW exposes ghost devices
> > so assembling raids which involves looking at all devices is slow
> 
> I will try that (although I think I did).
> 
> I can't even get it to do ls on any disk or anything.  It really seems
> to be behaving as if it doesn't detect any disks.

So I fixed ofpathname (it was not working because it did find /sys -name
$device, which mathes multiple things on modern kernels).  I changed the
find to find /sys -type d -name $device and now that works.  So now I
can run grub-install, but of course that just creates a /boot/grub/grub
file with the main grub and a filesystem module attached.  It doesn't
actually boot.

It set the
boot_device=/p...@8002200/pci1014,0...@1/sas/d...@2:4,\grub

/dev/sda4 is a fat16 partition mounted as /boot/grub.  Unfortunately I
am not convinced the IBM boxes know how to read filesystems or boot
files.  It seems it only wants to read raw from a PReP boot partition.
So when I dd /boot/grub/grub to /dev/sda1 (an 8MB PReP boot partition)
the system does start grub, but of course since grub was only the core
plus the fat module, it just says:

Welcome to GRUB!


   



   
error: no device is set.
Entering rescue mode... 


   
grub rescue>

So what do I do then to get it to know what device to use?

-- 
Len Sorensen

___
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel


Re: grub2 on power6 box.

2010-07-23 Thread Lennart Sorensen
On Fri, Jul 23, 2010 at 07:56:27AM +0200, Vladimir 'φ-coder/phcoder' Serbinenko 
wrote:
> On 07/22/2010 11:23 PM, Lennart Sorensen wrote:
> > I am trying to use grub2 to boot an IBM p520 power6 box.  I know yaboot
> > can do the job, but it doesn't deal with software raid, ext4, LVM or
> > anything else useful.
> >
> > I have managed to get as far as booting to a grub prompt from disk.
> > Unfortunately it doesn't appear to be seeing any disks at that point.
> >
> > The way I got it this far was to create an 8MB (smallest cfdisk would
> > make) PReP boot partition, and then run grub-mkimage -n -o /tmp/grub -O
> > powerpc-ieee1275 *.mod in the ieee1275 grub directory.  I then dd'd
> > /tmp/grub to /dev/sda1 (the PReP boot partition).
> >
> >   
> You need to add -p "". Also avoid the
> raid and lvm-related modules you don't need. OFW exposes ghost devices
> so assembling raids which involves looking at all devices is slow

I will try that (although I think I did).

I can't even get it to do ls on any disk or anything.  It really seems
to be behaving as if it doesn't detect any disks.

-- 
Len Sorensen

___
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel


Re: ZFS on Debian GNU/kFreeBSD

2010-07-23 Thread Robert Millan
The problem I see with current zfs.mod is that it integrates with GRUB using
the "filesystem model", i.e. each pool has one
backend (the storage device) and one frontend (the filesystem).

But ZFS is different in both ends: each pool can use N storage devices
and provide M filesystems. In the current representation this yields
two problems
for GRUB:

 - zpools where more than one device is essential (i.e. not just
mirror like RAID1)
   aren't accessible.

 - To allow more more than one filesystem in a zpool, filesystems are
selected in
   a special manner, e.g.:
   (hd0)/@/
   (hd0)/foo@/
   This collides with an assumption consistently made by GRUB utilities
   and scripts: that you can construct a GRUB path by combining the result
   of make_path_relative_to_its_root() (known at install time) with the device
   that contains this filesystem (usually known at run time).

My impression is representing ZFS as a filesystem is doable, but not
the best fit.
ZFS is much more like what GRUB calls an "abstraction" (RAID or LVM). In fact
if you take LVM interface:

grub> ls
(hd0) (hd1)
grub> insmod lvm
grub> ls
(hd0) (hd1) (foo) (bar)

the only difference for ZFS is that (foo) and (bar) are provided directly as
filesystems (like pxe.mod does) instead of block devices for GRUB to probe.

So my intention is to readjust zfs.mod to follow this interface. Aside
from enabling
multi-device pools, this will also make it much easier to support ZFS
in the install
utilities and scripts later.

Comments / objections / suggestions?

___
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel


Re: ZFS on Debian GNU/kFreeBSD

2010-07-23 Thread Robert Millan
2010/7/21 Tuco :
> Is this a known problem? Should I investigate? Can you give some guideline?

If you want to help, you could have a look at porting libzfs over to
GNU/kFreeBSD.
It's likely that GRUB will need it, and in either case the Debian
folks definitely will.

___
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel


Re: ZFS on Debian GNU/kFreeBSD

2010-07-23 Thread Robert Millan
2010/7/22 Seth Goldberg 
>> I guess the API exported by libzfs can serve for this?  But first, I
>> have some concern about zfs.mod, I'll write a detailed mail about that
>> later.
>
>  That's how I'm implementing it, though libzfs is technically an uncommitted 
> interface.

What are you currently implementing? I just want to make sure I don't
duplicate existing work.

>> Uhm this sounds wrong, grub-setup isn't meant to handle filesystems
>> (it does something like you describe for RAID1, but only because it
>> can rely on the storage backend being 1:1).
>
>  [...] To be truly fault-tolerant, if we're booting from a zfs pool, there 
> must be an embedded config file that searches for a (non-faulted) root device 
> from the pool's mirrors as well.  Separate invocations for each device in the 
> root pool mirror are fine, though.

Ah, I understand you now. You want to take advantage of ZFS' fault-tollerancy
for boot blocks. I'm not sure this would make sense, because we have to give
up at some point (e.g. boot.img can't benefit from this), so we're just moving
the line. In any case, I just want the basic functionality to work and it's not
currently in my plan to implement this (sorry ;-)).

>  BTW, I've run into a similar issue (comparing major/minors) in updating 
> grub-probe to deal with zfs -- grub_make_system_path_relative_to_its_root() 
> compares st_dev with the st_dev's of each path component.  This won't work on 
> ZFS either because GRUB files are stored in the top-level filesystem and 
> because the root filesystem (for the purposes of GRUB2's $root) is a 
> different filesystem than the top-level filesystem.  GRUB2 was never designed 
> to deal with this kind of disparity (even at the RAID level).

Can you map st_dev to zpool name (and later to zpool devices) using libzfs?

___
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel


Re: [PATCH] Optimise memset on i386

2010-07-23 Thread Colin Watson
On Fri, Jun 25, 2010 at 08:27:20PM +0200, Vladimir 'φ-coder/phcoder' Serbinenko 
wrote:
> > +void *
> > +grub_memset (void *s, int c, grub_size_t n)
> > +{
> > +  unsigned char *p = (unsigned char *) s;
> > +
> > +  while (n--)
> > +*p++ = (unsigned char) c;
> > +
> > +  return s;
> > +}
> 
> Attached is a possible generic implementation. Not even compile-tested.
> Could you test it and compare disasm of this version on i386 and glibc
> i386 version. Perhaps they are equivalent. If they are for maintainance
> reasons it's better to always use generic one.

Thanks for this, and sorry for my delay.

I haven't compared the disassembly, but once I fixed up your code it
performed within about 10% of the optimised version I posted before, so
about 640ms original, 160ms with i386-specific memset, and 176ms with
your generic memset.  Even though that isn't quite equivalent, I don't
think that 16ms is going to be a major problem, and so I would suggest
going with the generic version.  Please check the following.

2010-07-23  Vladimir Serbinenko  
2010-07-23  Colin Watson  

* kern/misc.c (grub_memset): Optimise to reduce cache stalls.

=== modified file 'kern/misc.c'
--- kern/misc.c 2010-07-02 17:35:07 +
+++ kern/misc.c 2010-07-23 11:05:32 +
@@ -518,12 +518,39 @@ grub_strndup (const char *s, grub_size_t
 }
 
 void *
-grub_memset (void *s, int c, grub_size_t n)
+grub_memset (void *s, int c, grub_size_t len)
 {
-  unsigned char *p = (unsigned char *) s;
+  void *p = s;
+  grub_uint8_t pattern8 = c;
 
-  while (n--)
-*p++ = (unsigned char) c;
+  if (len >= 3 * sizeof (unsigned long))
+{
+  unsigned long patternl = 0;
+  grub_size_t i;
+
+  for (i = 0; i < sizeof (unsigned long); i++)
+   patternl |= ((unsigned long) pattern8) << (8 * i);
+
+  while (len > 0 && (((grub_addr_t) p) & (sizeof (unsigned long) - 1)))
+   {
+ *(grub_uint8_t *) p = pattern8;
+ p = (grub_uint8_t *) p + 1;
+ len--;
+   }
+  while (len >= sizeof (unsigned long))
+   {
+ *(unsigned long *) p = patternl;
+ p = (unsigned long *) p + 1;
+ len -= sizeof (unsigned long);
+   }
+}
+
+  while (len > 0)
+{
+  *(grub_uint8_t *) p = pattern8;
+  p = (grub_uint8_t *) p + 1;
+  len--;
+}
 
   return s;
 }

-- 
Colin Watson   [cjwat...@ubuntu.com]

___
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel