grub-devel.gnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 1/2] Make grub_error() more verbose
@ 2025-09-23 23:33 Leo Sandoval via Grub-devel
  2025-09-23 23:33 ` [PATCH v2 2/2] Include function name on debug and error print functions Leo Sandoval via Grub-devel
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Leo Sandoval via Grub-devel @ 2025-09-23 23:33 UTC (permalink / raw)
  To: grub-devel; +Cc: Leo Sandoval

From: Peter Jones <pjones@redhat.com>

Signed-off-by: Peter Jones <pjones@redhat.com>
---
 grub-core/kern/err.c | 13 +++++++++++--
 include/grub/err.h   |  8 ++++++--
 2 files changed, 17 insertions(+), 4 deletions(-)

diff --git a/grub-core/kern/err.c b/grub-core/kern/err.c
index 53c734de70..aebfe0cf83 100644
--- a/grub-core/kern/err.c
+++ b/grub-core/kern/err.c
@@ -33,15 +33,24 @@ static struct grub_error_saved grub_error_stack_items[GRUB_ERROR_STACK_SIZE];
 static int grub_error_stack_pos;
 static int grub_error_stack_assert;
 
+#ifdef grub_error
+#undef grub_error
+#endif
+
 grub_err_t
-grub_error (grub_err_t n, const char *fmt, ...)
+grub_error (grub_err_t n, const char *file, const int line, const char *fmt, ...)
 {
   va_list ap;
+  int m;
 
   grub_errno = n;
 
+  m = grub_snprintf (grub_errmsg, sizeof (grub_errmsg), "%s:%d:", file, line);
+  if (m < 0)
+    m = 0;
+
   va_start (ap, fmt);
-  grub_vsnprintf (grub_errmsg, sizeof (grub_errmsg), _(fmt), ap);
+  grub_vsnprintf (grub_errmsg + m, sizeof (grub_errmsg) - m, _(fmt), ap);
   va_end (ap);
 
   return n;
diff --git a/include/grub/err.h b/include/grub/err.h
index 202fa8a7ae..7530f58b29 100644
--- a/include/grub/err.h
+++ b/include/grub/err.h
@@ -88,8 +88,12 @@ struct grub_error_saved
 extern grub_err_t EXPORT_VAR(grub_errno);
 extern char EXPORT_VAR(grub_errmsg)[GRUB_MAX_ERRMSG];
 
-grub_err_t EXPORT_FUNC(grub_error) (grub_err_t n, const char *fmt, ...)
-    __attribute__ ((format (GNU_PRINTF, 2, 3)));
+grub_err_t EXPORT_FUNC(grub_error) (grub_err_t n, const char *file, const int line, const char *fmt, ...)
+	__attribute__ ((format (GNU_PRINTF, 4, 5)));
+
+#define grub_error(n, fmt, ...) grub_error (n, __FILE__, __LINE__, fmt, ##__VA_ARGS__)
+
+
 void EXPORT_FUNC(grub_fatal) (const char *fmt, ...) __attribute__ ((noreturn));
 void EXPORT_FUNC(grub_error_push) (void);
 int EXPORT_FUNC(grub_error_pop) (void);
-- 
2.50.1


_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH v2 2/2] Include function name on debug and error print functions
  2025-09-23 23:33 [PATCH v2 1/2] Make grub_error() more verbose Leo Sandoval via Grub-devel
@ 2025-09-23 23:33 ` Leo Sandoval via Grub-devel
  2025-09-24 19:49 ` [PATCH v2 1/2] Make grub_error() more verbose Daniel Kiper
  2025-09-24 19:55 ` Vladimir 'phcoder' Serbinenko
  2 siblings, 0 replies; 10+ messages in thread
From: Leo Sandoval via Grub-devel @ 2025-09-23 23:33 UTC (permalink / raw)
  To: grub-devel; +Cc: Leo Sandoval

With the following change, we see standard (grub_dprintf) and
error (grub_error) logs with the function name embedded (see below)
into the log which is particular useful when debugging

    commands/efi/tpm.c:grub_tpm_measure:281:tpm: log_event, pcr = 8, size = 0xb,

Including one more field on the print log impacts the binary sizes
and in turn their respective distro packages; for Fedora rpm packages
the increase is 20k approximately.

Signed-off-by: Leo Sandoval <lsandova@redhat.com>
---
 grub-core/kern/err.c  | 4 ++--
 grub-core/kern/misc.c | 4 ++--
 include/grub/err.h    | 6 +++---
 include/grub/misc.h   | 5 +++--
 4 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/grub-core/kern/err.c b/grub-core/kern/err.c
index aebfe0cf83..ba04b57fb7 100644
--- a/grub-core/kern/err.c
+++ b/grub-core/kern/err.c
@@ -38,14 +38,14 @@ static int grub_error_stack_assert;
 #endif
 
 grub_err_t
-grub_error (grub_err_t n, const char *file, const int line, const char *fmt, ...)
+grub_error (grub_err_t n, const char *file, const char *function, const int line, const char *fmt, ...)
 {
   va_list ap;
   int m;
 
   grub_errno = n;
 
-  m = grub_snprintf (grub_errmsg, sizeof (grub_errmsg), "%s:%d:", file, line);
+  m = grub_snprintf (grub_errmsg, sizeof (grub_errmsg), "%s:%s:%d:", file, function, line);
   if (m < 0)
     m = 0;
 
diff --git a/grub-core/kern/misc.c b/grub-core/kern/misc.c
index 258f918935..b9ac86c186 100644
--- a/grub-core/kern/misc.c
+++ b/grub-core/kern/misc.c
@@ -231,14 +231,14 @@ grub_debug_enabled (const char * condition)
 }
 
 void
-grub_real_dprintf (const char *file, const int line, const char *condition,
+grub_real_dprintf (const char *file, const char *function, const int line, const char *condition,
 		   const char *fmt, ...)
 {
   va_list args;
 
   if (grub_debug_enabled (condition))
     {
-      grub_printf ("%s:%d:%s: ", file, line, condition);
+      grub_printf ("%s:%s:%d:%s: ", file, function, line, condition);
       va_start (args, fmt);
       grub_vprintf (fmt, args);
       va_end (args);
diff --git a/include/grub/err.h b/include/grub/err.h
index 7530f58b29..6379a6baf8 100644
--- a/include/grub/err.h
+++ b/include/grub/err.h
@@ -88,10 +88,10 @@ struct grub_error_saved
 extern grub_err_t EXPORT_VAR(grub_errno);
 extern char EXPORT_VAR(grub_errmsg)[GRUB_MAX_ERRMSG];
 
-grub_err_t EXPORT_FUNC(grub_error) (grub_err_t n, const char *file, const int line, const char *fmt, ...)
-	__attribute__ ((format (GNU_PRINTF, 4, 5)));
+grub_err_t EXPORT_FUNC(grub_error) (grub_err_t n, const char *file, const char *function, const int line, const char *fmt, ...)
+	__attribute__ ((format (GNU_PRINTF, 5, 6)));
 
-#define grub_error(n, fmt, ...) grub_error (n, __FILE__, __LINE__, fmt, ##__VA_ARGS__)
+#define grub_error(n, fmt, ...) grub_error (n, __FILE__, __FUNCTION__, __LINE__, fmt, ##__VA_ARGS__)
 
 
 void EXPORT_FUNC(grub_fatal) (const char *fmt, ...) __attribute__ ((noreturn));
diff --git a/include/grub/misc.h b/include/grub/misc.h
index 9522d7305a..0d2bab7dd7 100644
--- a/include/grub/misc.h
+++ b/include/grub/misc.h
@@ -35,7 +35,7 @@
 #define ARRAY_SIZE(array) (sizeof (array) / sizeof (array[0]))
 #define COMPILE_TIME_ASSERT(cond) switch (0) { case 1: case !(cond): ; }
 
-#define grub_dprintf(condition, ...) grub_real_dprintf(GRUB_FILE, __LINE__, condition, __VA_ARGS__)
+#define grub_dprintf(condition, ...) grub_real_dprintf(GRUB_FILE, __FUNCTION__, __LINE__, condition, __VA_ARGS__)
 
 void *EXPORT_FUNC(grub_memmove) (void *dest, const void *src, grub_size_t n);
 char *EXPORT_FUNC(grub_strcpy) (char *dest, const char *src);
@@ -413,9 +413,10 @@ grub_puts (const char *s)
 int EXPORT_FUNC(grub_puts_) (const char *s);
 int EXPORT_FUNC(grub_debug_enabled) (const char *condition);
 void EXPORT_FUNC(grub_real_dprintf) (const char *file,
+				     const char *function,
                                      const int line,
                                      const char *condition,
-                                     const char *fmt, ...) __attribute__ ((format (GNU_PRINTF, 4, 5)));
+                                     const char *fmt, ...) __attribute__ ((format (GNU_PRINTF, 5, 6)));
 int EXPORT_FUNC(grub_printf) (const char *fmt, ...) __attribute__ ((format (GNU_PRINTF, 1, 2)));
 int EXPORT_FUNC(grub_printf_) (const char *fmt, ...) __attribute__ ((format (GNU_PRINTF, 1, 2)));
 int EXPORT_FUNC(grub_vprintf) (const char *fmt, va_list args);
-- 
2.50.1


_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH v2 1/2] Make grub_error() more verbose
  2025-09-23 23:33 [PATCH v2 1/2] Make grub_error() more verbose Leo Sandoval via Grub-devel
  2025-09-23 23:33 ` [PATCH v2 2/2] Include function name on debug and error print functions Leo Sandoval via Grub-devel
@ 2025-09-24 19:49 ` Daniel Kiper
  2025-09-24 19:55 ` Vladimir 'phcoder' Serbinenko
  2 siblings, 0 replies; 10+ messages in thread
From: Daniel Kiper @ 2025-09-24 19:49 UTC (permalink / raw)
  To: grub-devel; +Cc: Leo Sandoval

On Tue, Sep 23, 2025 at 05:33:31PM -0600, Leo Sandoval via Grub-devel wrote:
> From: Peter Jones <pjones@redhat.com>
>
> Signed-off-by: Peter Jones <pjones@redhat.com>

For both patches Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>...

Next time please add a cover letter to the patch series...

Daniel

_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v2 1/2] Make grub_error() more verbose
  2025-09-23 23:33 [PATCH v2 1/2] Make grub_error() more verbose Leo Sandoval via Grub-devel
  2025-09-23 23:33 ` [PATCH v2 2/2] Include function name on debug and error print functions Leo Sandoval via Grub-devel
  2025-09-24 19:49 ` [PATCH v2 1/2] Make grub_error() more verbose Daniel Kiper
@ 2025-09-24 19:55 ` Vladimir 'phcoder' Serbinenko
  2025-09-25 18:04   ` Leo Sandoval via Grub-devel
  2025-09-29 11:07   ` Daniel Kiper
  2 siblings, 2 replies; 10+ messages in thread
From: Vladimir 'phcoder' Serbinenko @ 2025-09-24 19:55 UTC (permalink / raw)
  To: The development of GNU GRUB; +Cc: Leo Sandoval


[-- Attachment #1.1: Type: text/plain, Size: 2535 bytes --]

What is the influence on core.img size on i386-pc? Are we still within our
promises for supporting 31K gaps with simple config?

Regards
Vladimir 'phcoder' Serbinenko

Le mer. 24 sept. 2025, 02:34, Leo Sandoval via Grub-devel <
grub-devel@gnu.org> a écrit :

> From: Peter Jones <pjones@redhat.com>
>
> Signed-off-by: Peter Jones <pjones@redhat.com>
> ---
>  grub-core/kern/err.c | 13 +++++++++++--
>  include/grub/err.h   |  8 ++++++--
>  2 files changed, 17 insertions(+), 4 deletions(-)
>
> diff --git a/grub-core/kern/err.c b/grub-core/kern/err.c
> index 53c734de70..aebfe0cf83 100644
> --- a/grub-core/kern/err.c
> +++ b/grub-core/kern/err.c
> @@ -33,15 +33,24 @@ static struct grub_error_saved
> grub_error_stack_items[GRUB_ERROR_STACK_SIZE];
>  static int grub_error_stack_pos;
>  static int grub_error_stack_assert;
>
> +#ifdef grub_error
> +#undef grub_error
> +#endif
> +
>  grub_err_t
> -grub_error (grub_err_t n, const char *fmt, ...)
> +grub_error (grub_err_t n, const char *file, const int line, const char
> *fmt, ...)
>  {
>    va_list ap;
> +  int m;
>
>    grub_errno = n;
>
> +  m = grub_snprintf (grub_errmsg, sizeof (grub_errmsg), "%s:%d:", file,
> line);
> +  if (m < 0)
> +    m = 0;
> +
>    va_start (ap, fmt);
> -  grub_vsnprintf (grub_errmsg, sizeof (grub_errmsg), _(fmt), ap);
> +  grub_vsnprintf (grub_errmsg + m, sizeof (grub_errmsg) - m, _(fmt), ap);
>    va_end (ap);
>
>    return n;
> diff --git a/include/grub/err.h b/include/grub/err.h
> index 202fa8a7ae..7530f58b29 100644
> --- a/include/grub/err.h
> +++ b/include/grub/err.h
> @@ -88,8 +88,12 @@ struct grub_error_saved
>  extern grub_err_t EXPORT_VAR(grub_errno);
>  extern char EXPORT_VAR(grub_errmsg)[GRUB_MAX_ERRMSG];
>
> -grub_err_t EXPORT_FUNC(grub_error) (grub_err_t n, const char *fmt, ...)
> -    __attribute__ ((format (GNU_PRINTF, 2, 3)));
> +grub_err_t EXPORT_FUNC(grub_error) (grub_err_t n, const char *file, const
> int line, const char *fmt, ...)
> +       __attribute__ ((format (GNU_PRINTF, 4, 5)));
> +
> +#define grub_error(n, fmt, ...) grub_error (n, __FILE__, __LINE__, fmt,
> ##__VA_ARGS__)
> +
> +
>  void EXPORT_FUNC(grub_fatal) (const char *fmt, ...) __attribute__
> ((noreturn));
>  void EXPORT_FUNC(grub_error_push) (void);
>  int EXPORT_FUNC(grub_error_pop) (void);
> --
> 2.50.1
>
>
> _______________________________________________
> Grub-devel mailing list
> Grub-devel@gnu.org
> https://lists.gnu.org/mailman/listinfo/grub-devel
>

[-- Attachment #1.2: Type: text/html, Size: 3400 bytes --]

[-- Attachment #2: Type: text/plain, Size: 141 bytes --]

_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v2 1/2] Make grub_error() more verbose
  2025-09-24 19:55 ` Vladimir 'phcoder' Serbinenko
@ 2025-09-25 18:04   ` Leo Sandoval via Grub-devel
  2025-09-26 15:57     ` Vladimir 'phcoder' Serbinenko
  2025-09-29 11:07   ` Daniel Kiper
  1 sibling, 1 reply; 10+ messages in thread
From: Leo Sandoval via Grub-devel @ 2025-09-25 18:04 UTC (permalink / raw)
  To: Vladimir 'phcoder' Serbinenko
  Cc: Leo Sandoval, The development of GNU GRUB


[-- Attachment #1.1: Type: text/plain, Size: 2922 bytes --]

On Wed, Sep 24, 2025 at 1:55 PM Vladimir 'phcoder' Serbinenko <
phcoder@gmail.com> wrote:

> What is the influence on core.img size on i386-pc? Are we still within our
> promises for supporting 31K gaps with simple config?
>

running this in both grub versions

$ grub2-mkimage -O i386-pc -p /tmp -o core.img biosdisk part_msdos ext2

core.img file increases from  34538 to 35132 bytes, so the increase is
about 0.6K.

Regards
> Vladimir 'phcoder' Serbinenko
>
> Le mer. 24 sept. 2025, 02:34, Leo Sandoval via Grub-devel <
> grub-devel@gnu.org> a écrit :
>
>> From: Peter Jones <pjones@redhat.com>
>>
>> Signed-off-by: Peter Jones <pjones@redhat.com>
>> ---
>>  grub-core/kern/err.c | 13 +++++++++++--
>>  include/grub/err.h   |  8 ++++++--
>>  2 files changed, 17 insertions(+), 4 deletions(-)
>>
>> diff --git a/grub-core/kern/err.c b/grub-core/kern/err.c
>> index 53c734de70..aebfe0cf83 100644
>> --- a/grub-core/kern/err.c
>> +++ b/grub-core/kern/err.c
>> @@ -33,15 +33,24 @@ static struct grub_error_saved
>> grub_error_stack_items[GRUB_ERROR_STACK_SIZE];
>>  static int grub_error_stack_pos;
>>  static int grub_error_stack_assert;
>>
>> +#ifdef grub_error
>> +#undef grub_error
>> +#endif
>> +
>>  grub_err_t
>> -grub_error (grub_err_t n, const char *fmt, ...)
>> +grub_error (grub_err_t n, const char *file, const int line, const char
>> *fmt, ...)
>>  {
>>    va_list ap;
>> +  int m;
>>
>>    grub_errno = n;
>>
>> +  m = grub_snprintf (grub_errmsg, sizeof (grub_errmsg), "%s:%d:", file,
>> line);
>> +  if (m < 0)
>> +    m = 0;
>> +
>>    va_start (ap, fmt);
>> -  grub_vsnprintf (grub_errmsg, sizeof (grub_errmsg), _(fmt), ap);
>> +  grub_vsnprintf (grub_errmsg + m, sizeof (grub_errmsg) - m, _(fmt), ap);
>>    va_end (ap);
>>
>>    return n;
>> diff --git a/include/grub/err.h b/include/grub/err.h
>> index 202fa8a7ae..7530f58b29 100644
>> --- a/include/grub/err.h
>> +++ b/include/grub/err.h
>> @@ -88,8 +88,12 @@ struct grub_error_saved
>>  extern grub_err_t EXPORT_VAR(grub_errno);
>>  extern char EXPORT_VAR(grub_errmsg)[GRUB_MAX_ERRMSG];
>>
>> -grub_err_t EXPORT_FUNC(grub_error) (grub_err_t n, const char *fmt, ...)
>> -    __attribute__ ((format (GNU_PRINTF, 2, 3)));
>> +grub_err_t EXPORT_FUNC(grub_error) (grub_err_t n, const char *file,
>> const int line, const char *fmt, ...)
>> +       __attribute__ ((format (GNU_PRINTF, 4, 5)));
>> +
>> +#define grub_error(n, fmt, ...) grub_error (n, __FILE__, __LINE__, fmt,
>> ##__VA_ARGS__)
>> +
>> +
>>  void EXPORT_FUNC(grub_fatal) (const char *fmt, ...) __attribute__
>> ((noreturn));
>>  void EXPORT_FUNC(grub_error_push) (void);
>>  int EXPORT_FUNC(grub_error_pop) (void);
>> --
>> 2.50.1
>>
>>
>> _______________________________________________
>> Grub-devel mailing list
>> Grub-devel@gnu.org
>> https://lists.gnu.org/mailman/listinfo/grub-devel
>>
>

[-- Attachment #1.2: Type: text/html, Size: 4227 bytes --]

[-- Attachment #2: Type: text/plain, Size: 141 bytes --]

_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v2 1/2] Make grub_error() more verbose
  2025-09-25 18:04   ` Leo Sandoval via Grub-devel
@ 2025-09-26 15:57     ` Vladimir 'phcoder' Serbinenko
  2025-09-26 16:14       ` Leo Sandoval via Grub-devel
  0 siblings, 1 reply; 10+ messages in thread
From: Vladimir 'phcoder' Serbinenko @ 2025-09-26 15:57 UTC (permalink / raw)
  To: Leo Sandoval; +Cc: The development of GNU GRUB


[-- Attachment #1.1: Type: text/plain, Size: 1540 bytes --]

Le jeu. 25 sept. 2025, 21:04, Leo Sandoval <lsandova@redhat.com> a écrit :

>
>
> On Wed, Sep 24, 2025 at 1:55 PM Vladimir 'phcoder' Serbinenko <
> phcoder@gmail.com> wrote:
>
>> What is the influence on core.img size on i386-pc? Are we still within
>> our promises for supporting 31K gaps with simple config?
>>
>
> running this in both grub versions
>
> $ grub2-mkimage -O i386-pc -p /tmp -o core.img biosdisk part_msdos ext2
>
> core.img file increases from  34538 to 35132 bytes, so the increase is
> about 0.6K.
>

0.6K out of 31K is a lot. Is there a way to decrease this overhead?


>>>  extern grub_err_t EXPORT_VAR(grub_errno);
>>>  extern char EXPORT_VAR(grub_errmsg)[GRUB_MAX_ERRMSG];
>>>
>>> -grub_err_t EXPORT_FUNC(grub_error) (grub_err_t n, const char *fmt, ...)
>>> -    __attribute__ ((format (GNU_PRINTF, 2, 3)));
>>> +grub_err_t EXPORT_FUNC(grub_error) (grub_err_t n, const char *file,
>>> const int line, const char *fmt, ...)
>>> +       __attribute__ ((format (GNU_PRINTF, 4, 5)));
>>> +
>>> +#define grub_error(n, fmt, ...) grub_error (n, __FILE__, __LINE__, fmt,
>>> ##__VA_ARGS__)
>>> +
>>> +
>>>  void EXPORT_FUNC(grub_fatal) (const char *fmt, ...) __attribute__
>>> ((noreturn));
>>>  void EXPORT_FUNC(grub_error_push) (void);
>>>  int EXPORT_FUNC(grub_error_pop) (void);
>>> --
>>> 2.50.1
>>>
>>>
>>> _______________________________________________
>>> Grub-devel mailing list
>>> Grub-devel@gnu.org
>>> https://lists.gnu.org/mailman/listinfo/grub-devel
>>>
>>

[-- Attachment #1.2: Type: text/html, Size: 3071 bytes --]

[-- Attachment #2: Type: text/plain, Size: 141 bytes --]

_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v2 1/2] Make grub_error() more verbose
  2025-09-26 15:57     ` Vladimir 'phcoder' Serbinenko
@ 2025-09-26 16:14       ` Leo Sandoval via Grub-devel
  2025-09-26 16:51         ` Andrew Hamilton
  0 siblings, 1 reply; 10+ messages in thread
From: Leo Sandoval via Grub-devel @ 2025-09-26 16:14 UTC (permalink / raw)
  To: Vladimir 'phcoder' Serbinenko
  Cc: Leo Sandoval, The development of GNU GRUB


[-- Attachment #1.1: Type: text/plain, Size: 1970 bytes --]

On Fri, Sep 26, 2025 at 9:58 AM Vladimir 'phcoder' Serbinenko <
phcoder@gmail.com> wrote:

>
>
> Le jeu. 25 sept. 2025, 21:04, Leo Sandoval <lsandova@redhat.com> a écrit :
>
>>
>>
>> On Wed, Sep 24, 2025 at 1:55 PM Vladimir 'phcoder' Serbinenko <
>> phcoder@gmail.com> wrote:
>>
>>> What is the influence on core.img size on i386-pc? Are we still within
>>> our promises for supporting 31K gaps with simple config?
>>>
>>
>> running this in both grub versions
>>
>> $ grub2-mkimage -O i386-pc -p /tmp -o core.img biosdisk part_msdos ext2
>>
>> core.img file increases from  34538 to 35132 bytes, so the increase is
>> about 0.6K.
>>
>
> 0.6K out of 31K is a lot. Is there a way to decrease this overhead?
>

I forgot to indicate that this increase includes this patch and the other
in the series, which includes the function name also. In general, this 0.6K
increase includes the file:function:line_number on the logs.

No idea how to decrease it. Any suggestion to try?


>
>
>>>>  extern grub_err_t EXPORT_VAR(grub_errno);
>>>>  extern char EXPORT_VAR(grub_errmsg)[GRUB_MAX_ERRMSG];
>>>>
>>>> -grub_err_t EXPORT_FUNC(grub_error) (grub_err_t n, const char *fmt, ...)
>>>> -    __attribute__ ((format (GNU_PRINTF, 2, 3)));
>>>> +grub_err_t EXPORT_FUNC(grub_error) (grub_err_t n, const char *file,
>>>> const int line, const char *fmt, ...)
>>>> +       __attribute__ ((format (GNU_PRINTF, 4, 5)));
>>>> +
>>>> +#define grub_error(n, fmt, ...) grub_error (n, __FILE__, __LINE__,
>>>> fmt, ##__VA_ARGS__)
>>>> +
>>>> +
>>>>  void EXPORT_FUNC(grub_fatal) (const char *fmt, ...) __attribute__
>>>> ((noreturn));
>>>>  void EXPORT_FUNC(grub_error_push) (void);
>>>>  int EXPORT_FUNC(grub_error_pop) (void);
>>>> --
>>>> 2.50.1
>>>>
>>>>
>>>> _______________________________________________
>>>> Grub-devel mailing list
>>>> Grub-devel@gnu.org
>>>> https://lists.gnu.org/mailman/listinfo/grub-devel
>>>>
>>>

[-- Attachment #1.2: Type: text/html, Size: 3990 bytes --]

[-- Attachment #2: Type: text/plain, Size: 141 bytes --]

_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v2 1/2] Make grub_error() more verbose
  2025-09-26 16:14       ` Leo Sandoval via Grub-devel
@ 2025-09-26 16:51         ` Andrew Hamilton
  2025-09-26 22:52           ` Leo Sandoval via Grub-devel
  0 siblings, 1 reply; 10+ messages in thread
From: Andrew Hamilton @ 2025-09-26 16:51 UTC (permalink / raw)
  To: The development of GNU GRUB
  Cc: Vladimir 'phcoder' Serbinenko, Leo Sandoval


[-- Attachment #1.1: Type: text/plain, Size: 2475 bytes --]

How large is the i386 pc user base, do you think including a conditional
compile to only add for uefi 64-bit covers most cases?

Just a thought.

Thanks,
Andrew

On Fri, Sep 26, 2025 at 11:16 AM Leo Sandoval via Grub-devel <
grub-devel@gnu.org> wrote:

>
>
> On Fri, Sep 26, 2025 at 9:58 AM Vladimir 'phcoder' Serbinenko <
> phcoder@gmail.com> wrote:
>
>>
>>
>> Le jeu. 25 sept. 2025, 21:04, Leo Sandoval <lsandova@redhat.com> a
>> écrit :
>>
>>>
>>>
>>> On Wed, Sep 24, 2025 at 1:55 PM Vladimir 'phcoder' Serbinenko <
>>> phcoder@gmail.com> wrote:
>>>
>>>> What is the influence on core.img size on i386-pc? Are we still within
>>>> our promises for supporting 31K gaps with simple config?
>>>>
>>>
>>> running this in both grub versions
>>>
>>> $ grub2-mkimage -O i386-pc -p /tmp -o core.img biosdisk part_msdos ext2
>>>
>>> core.img file increases from  34538 to 35132 bytes, so the increase is
>>> about 0.6K.
>>>
>>
>> 0.6K out of 31K is a lot. Is there a way to decrease this overhead?
>>
>
> I forgot to indicate that this increase includes this patch and the other
> in the series, which includes the function name also. In general, this 0.6K
> increase includes the file:function:line_number on the logs.
>
> No idea how to decrease it. Any suggestion to try?
>
>
>>
>>
>>>>>  extern grub_err_t EXPORT_VAR(grub_errno);
>>>>>  extern char EXPORT_VAR(grub_errmsg)[GRUB_MAX_ERRMSG];
>>>>>
>>>>> -grub_err_t EXPORT_FUNC(grub_error) (grub_err_t n, const char *fmt,
>>>>> ...)
>>>>> -    __attribute__ ((format (GNU_PRINTF, 2, 3)));
>>>>> +grub_err_t EXPORT_FUNC(grub_error) (grub_err_t n, const char *file,
>>>>> const int line, const char *fmt, ...)
>>>>> +       __attribute__ ((format (GNU_PRINTF, 4, 5)));
>>>>> +
>>>>> +#define grub_error(n, fmt, ...) grub_error (n, __FILE__, __LINE__,
>>>>> fmt, ##__VA_ARGS__)
>>>>> +
>>>>> +
>>>>>  void EXPORT_FUNC(grub_fatal) (const char *fmt, ...) __attribute__
>>>>> ((noreturn));
>>>>>  void EXPORT_FUNC(grub_error_push) (void);
>>>>>  int EXPORT_FUNC(grub_error_pop) (void);
>>>>> --
>>>>> 2.50.1
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> Grub-devel mailing list
>>>>> Grub-devel@gnu.org
>>>>> https://lists.gnu.org/mailman/listinfo/grub-devel
>>>>>
>>>> _______________________________________________
> Grub-devel mailing list
> Grub-devel@gnu.org
> https://lists.gnu.org/mailman/listinfo/grub-devel
>

[-- Attachment #1.2: Type: text/html, Size: 5365 bytes --]

[-- Attachment #2: Type: text/plain, Size: 141 bytes --]

_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v2 1/2] Make grub_error() more verbose
  2025-09-26 16:51         ` Andrew Hamilton
@ 2025-09-26 22:52           ` Leo Sandoval via Grub-devel
  0 siblings, 0 replies; 10+ messages in thread
From: Leo Sandoval via Grub-devel @ 2025-09-26 22:52 UTC (permalink / raw)
  To: Andrew Hamilton
  Cc: Leo Sandoval, The development of GNU GRUB,
	Vladimir 'phcoder' Serbinenko


[-- Attachment #1.1: Type: text/plain, Size: 2747 bytes --]

On Fri, Sep 26, 2025 at 10:51 AM Andrew Hamilton <adhamilt@gmail.com> wrote:

> How large is the i386 pc user base, do you think including a conditional
> compile to only add for uefi 64-bit covers most cases?
>

Great idea, thanks! I will bump then the series' version including the
related changes


>
> Just a thought.
>
> Thanks,
> Andrew
>
> On Fri, Sep 26, 2025 at 11:16 AM Leo Sandoval via Grub-devel <
> grub-devel@gnu.org> wrote:
>
>>
>>
>> On Fri, Sep 26, 2025 at 9:58 AM Vladimir 'phcoder' Serbinenko <
>> phcoder@gmail.com> wrote:
>>
>>>
>>>
>>> Le jeu. 25 sept. 2025, 21:04, Leo Sandoval <lsandova@redhat.com> a
>>> écrit :
>>>
>>>>
>>>>
>>>> On Wed, Sep 24, 2025 at 1:55 PM Vladimir 'phcoder' Serbinenko <
>>>> phcoder@gmail.com> wrote:
>>>>
>>>>> What is the influence on core.img size on i386-pc? Are we still within
>>>>> our promises for supporting 31K gaps with simple config?
>>>>>
>>>>
>>>> running this in both grub versions
>>>>
>>>> $ grub2-mkimage -O i386-pc -p /tmp -o core.img biosdisk part_msdos ext2
>>>>
>>>> core.img file increases from  34538 to 35132 bytes, so the increase is
>>>> about 0.6K.
>>>>
>>>
>>> 0.6K out of 31K is a lot. Is there a way to decrease this overhead?
>>>
>>
>> I forgot to indicate that this increase includes this patch and the other
>> in the series, which includes the function name also. In general, this 0.6K
>> increase includes the file:function:line_number on the logs.
>>
>> No idea how to decrease it. Any suggestion to try?
>>
>>
>>>
>>>
>>>>>>  extern grub_err_t EXPORT_VAR(grub_errno);
>>>>>>  extern char EXPORT_VAR(grub_errmsg)[GRUB_MAX_ERRMSG];
>>>>>>
>>>>>> -grub_err_t EXPORT_FUNC(grub_error) (grub_err_t n, const char *fmt,
>>>>>> ...)
>>>>>> -    __attribute__ ((format (GNU_PRINTF, 2, 3)));
>>>>>> +grub_err_t EXPORT_FUNC(grub_error) (grub_err_t n, const char *file,
>>>>>> const int line, const char *fmt, ...)
>>>>>> +       __attribute__ ((format (GNU_PRINTF, 4, 5)));
>>>>>> +
>>>>>> +#define grub_error(n, fmt, ...) grub_error (n, __FILE__, __LINE__,
>>>>>> fmt, ##__VA_ARGS__)
>>>>>> +
>>>>>> +
>>>>>>  void EXPORT_FUNC(grub_fatal) (const char *fmt, ...) __attribute__
>>>>>> ((noreturn));
>>>>>>  void EXPORT_FUNC(grub_error_push) (void);
>>>>>>  int EXPORT_FUNC(grub_error_pop) (void);
>>>>>> --
>>>>>> 2.50.1
>>>>>>
>>>>>>
>>>>>> _______________________________________________
>>>>>> Grub-devel mailing list
>>>>>> Grub-devel@gnu.org
>>>>>> https://lists.gnu.org/mailman/listinfo/grub-devel
>>>>>>
>>>>> _______________________________________________
>> Grub-devel mailing list
>> Grub-devel@gnu.org
>> https://lists.gnu.org/mailman/listinfo/grub-devel
>>
>

[-- Attachment #1.2: Type: text/html, Size: 5693 bytes --]

[-- Attachment #2: Type: text/plain, Size: 141 bytes --]

_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v2 1/2] Make grub_error() more verbose
  2025-09-24 19:55 ` Vladimir 'phcoder' Serbinenko
  2025-09-25 18:04   ` Leo Sandoval via Grub-devel
@ 2025-09-29 11:07   ` Daniel Kiper
  1 sibling, 0 replies; 10+ messages in thread
From: Daniel Kiper @ 2025-09-29 11:07 UTC (permalink / raw)
  To: Vladimir 'phcoder' Serbinenko
  Cc: The development of GNU GRUB, Leo Sandoval

On Wed, Sep 24, 2025 at 10:55:11PM +0300, Vladimir 'phcoder' Serbinenko wrote:
> What is the influence on core.img size on i386-pc? Are we still within our
> promises for supporting 31K gaps with simple config?

Vladimir, long time ago we stated that this setup is not recommended [1]
and I think we should not care about it because simply it makes GRUB
maintainers and developers live more difficult. Additionally, IIRC we at
least once talked about that at FOSDEM during GRUB Project Status Update
presentation. So, I am against making conditional builds or other tricks
to support outdated configs. I think we should take Leo's patch as is.

Daniel

[1] https://www.gnu.org/software/grub/manual/grub/grub.html#BIOS-installation

_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2025-09-29 11:08 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-23 23:33 [PATCH v2 1/2] Make grub_error() more verbose Leo Sandoval via Grub-devel
2025-09-23 23:33 ` [PATCH v2 2/2] Include function name on debug and error print functions Leo Sandoval via Grub-devel
2025-09-24 19:49 ` [PATCH v2 1/2] Make grub_error() more verbose Daniel Kiper
2025-09-24 19:55 ` Vladimir 'phcoder' Serbinenko
2025-09-25 18:04   ` Leo Sandoval via Grub-devel
2025-09-26 15:57     ` Vladimir 'phcoder' Serbinenko
2025-09-26 16:14       ` Leo Sandoval via Grub-devel
2025-09-26 16:51         ` Andrew Hamilton
2025-09-26 22:52           ` Leo Sandoval via Grub-devel
2025-09-29 11:07   ` Daniel Kiper

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).