Skip to content

Commit f010f99

Browse files
vijaydhanrajacrnsi
authored andcommitted
DM: Decouple and increase kernel boot args length
Currently, we use STR_LEN for all checking the size of all the acrn-dm parameters. But some parameters like kernel boot args can grow based on different needs. For example, when kata launches guest VM using acrn, the kernel boot args increases by 256 bytes (i.e 1024 +256). Just increasing STR_LEN will unnecessarily increase allocations for other acrn-dm parameters. So decoupling only boot_args length and increasing it to 2048. PS: If other parameters like ramdisk path, kernel path, elf_path etc. don't need 1024 bytes, we can reduce STR_LEN to 256 or 512 bytes. Tracked-On: #3138 Signed-off-by: Vijay Dhanraj <vijay.dhanraj@intel.com> Acked-by: Anthony Xu <anthony.xu@intel.com>
1 parent f2fe354 commit f010f99

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

devicemodel/core/sw_load_common.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
#include "pci_core.h"
3737

3838
int with_bootargs;
39-
static char bootargs[STR_LEN];
39+
static char bootargs[BOOT_ARG_LEN];
4040

4141
/*
4242
* Default e820 mem map:
@@ -106,9 +106,9 @@ const struct e820_entry e820_default_entries[NUM_E820_ENTRIES] = {
106106
int
107107
acrn_parse_bootargs(char *arg)
108108
{
109-
size_t len = strnlen(arg, STR_LEN);
109+
size_t len = strnlen(arg, BOOT_ARG_LEN);
110110

111-
if (len < STR_LEN) {
111+
if (len < BOOT_ARG_LEN) {
112112
strncpy(bootargs, arg, len + 1);
113113
with_bootargs = 1;
114114
printf("SW_LOAD: get bootargs %s\n", bootargs);

devicemodel/include/sw_load.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
#define _CORE_SW_LOAD_
3030

3131
#define STR_LEN 1024
32+
#define BOOT_ARG_LEN 2048
3233

3334
/* E820 memory types */
3435
#define E820_TYPE_RAM 1 /* EFI 1, 2, 3, 4, 5, 6, 7 */

0 commit comments

Comments
 (0)