On 2/6/23 15:09, Robbie Harwood wrote:
Stefan Berger <stef...@linux.ibm.com> writes:

-/* The maximum heap size we're going to claim */
+/* The maximum heap size we're going to claim at boot. Not used by sparc. */
  #ifdef __i386__
  #define HEAP_MAX_SIZE         (unsigned long) (64 * 1024 * 1024)
-#else
+#else /* __powerpc__ */
  #define HEAP_MAX_SIZE         (unsigned long) (32 * 1024 * 1024)
  #endif

In the version of this patch I've been carrying, the max heap is
increased a good bit:

#define HEAP_MAX_SIZE          (unsigned long) (1 * 1024 * 1024 * 1024)

Should it be made larger here as well?

HEAP_MAX_SIZE is only used here and this function is called on initialization 
from grub_machine_init()

static void
grub_claim_heap (void)
{
  grub_err_t err;
  grub_uint32_t total = HEAP_MAX_SIZE;

  err = grub_ieee1275_total_mem (&rmo_top);

  /*
   * If we cannot size the available memory, we can't be sure we're leaving
   * space for the kernel, initrd and things Linux loads early in boot. So only
   * allow further allocations from firmware on success
   */
  if (err == GRUB_ERR_NONE)
    grub_mm_add_region_fn = grub_ieee1275_mm_add_region;

#if defined(__powerpc__)
  if (grub_ieee1275_test_flag (GRUB_IEEE1275_FLAG_CAN_TRY_CAS_FOR_MORE_MEMORY))
    {
      /* if we have an error, don't call CAS, just hope for the best */
      if (err == GRUB_ERR_NONE && rmo_top < (512 * 1024 * 1024))
        grub_ieee1275_ibm_cas ();
    }
#endif

  grub_machine_mmap_iterate (heap_init, &total);
}
#endif


This seems to only be for the *initial* heap size and doesn't matter anymore 
later on for ppc. This is shared code also with ieee1275 i386 ...

  Stefan


Full commit:
https://github.com/rhboot/grub2/commit/e572ccc0edb3423976e8301978617382994ed52a

Be well,
--Robbie

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

Reply via email to