From b1b16ba19c41b70be0039d6a00a0a0c80297ad00 Mon Sep 17 00:00:00 2001 From: Max Wash Date: Sun, 9 Apr 2023 17:14:19 +0100 Subject: [PATCH] kernel: reduce log message spam during boot --- arch/x86_64/acpi/apic.cpp | 8 ++------ arch/x86_64/pmap.c | 2 -- obj/namespace.c | 8 +++----- sched/core.c | 1 - vm/bootstrap.c | 1 - vm/kmalloc.c | 2 -- vm/sparse.c | 14 ++++++-------- vm/zone.c | 10 +++++----- 8 files changed, 16 insertions(+), 30 deletions(-) diff --git a/arch/x86_64/acpi/apic.cpp b/arch/x86_64/acpi/apic.cpp index 2661225..cc43982 100644 --- a/arch/x86_64/acpi/apic.cpp +++ b/arch/x86_64/acpi/apic.cpp @@ -84,7 +84,6 @@ kern_status_t local_apic_enable(void) lapic.write(0xF0, 0x1FF); lapic.ack(); - printk("acpi: enabled local APIC on core %u", this_cpu()); return KERN_OK; } @@ -101,7 +100,7 @@ static io_apic *get_ioapic_for_irq(unsigned int vec) static void configure_legacy_pic(void) { - printk("acpi: APIC unavailable, using 8259 PIC"); + printk("acpi: APIC unavailable"); pit_start(10); } @@ -110,7 +109,7 @@ static void ioapic_init(uintptr_t base, unsigned int int_base) uint32_t *base_vaddr = (uint32_t *)vm_phys_to_virt(base); io_apic *apic = kmalloc_object(io_apic, VM_NORMAL, base_vaddr, int_base); - printk("acpi: I/O APIC at 0x%llx; base=%u, irqs=%u", base, int_base, apic->io_nr_irq); + //printk("acpi: I/O APIC at 0x%llx; base=%u, irqs=%u", base, int_base, apic->io_nr_irq); for (unsigned int i = 0; i < apic->io_nr_irq; i++) { apic->map_irq(i, 32 + int_base + i); @@ -134,7 +133,6 @@ void local_apic_config_timer(void) uint32_t total_ticks = 0xFFFFFFFF - lapic.read(local_apic::TIMER_CURCOUNT); total_ticks /= 100; - printk("total_ticks=%u", total_ticks); lapic.write(local_apic::LVT_TIMER, IRQ0 | APIC_LVT_TIMER_MODE_PERIODIC); lapic.write(local_apic::TIMER_DIV, 0x3); @@ -154,7 +152,6 @@ static void parse_legacy_irq_override(struct acpi_madt *madt) switch (rec->r_type) { case ACPI_MADT_IRQSRC_OVERRIDE: irq = (struct acpi_madt_irqsrc_override *)(rec + 1); - printk("acpi: irq src=%u, dest=%u", irq->irq_srcvec, irq->irq_destvec); handler = get_ioapic_for_irq(irq->irq_srcvec); handler->map_irq(irq->irq_srcvec, 32 + irq->irq_destvec); break; @@ -220,7 +217,6 @@ kern_status_t apic_init(void) pit_start(1000); local_apic_config_timer(); - printk("acpi: all APIC online"); return KERN_OK; } diff --git a/arch/x86_64/pmap.c b/arch/x86_64/pmap.c index 09615a6..8851ecf 100644 --- a/arch/x86_64/pmap.c +++ b/arch/x86_64/pmap.c @@ -262,7 +262,6 @@ void pmap_bootstrap(void) } } - printk("pmap: initialising direct physical memory mappings"); vbase = VM_PAGEMAP_BASE; for (size_t i = 0; i < pmem_limit; i += hugepage_sz) { do_pmap_add(kernel_pmap, @@ -272,7 +271,6 @@ void pmap_bootstrap(void) } pmap_switch(kernel_pmap); - printk("pmap: kernel pmap initialised (0x%llx)", kernel_pmap); } pmap_t pmap_create(void) diff --git a/obj/namespace.c b/obj/namespace.c index 986e363..72b95a4 100644 --- a/obj/namespace.c +++ b/obj/namespace.c @@ -1,5 +1,4 @@ #include -#include static object_namespace_t *global_ns; @@ -42,7 +41,6 @@ void init_global_namespace(void) { object_type_register(&ns_type); global_ns = object_namespace_create(); - printk("obj: initialised global namespace"); } object_namespace_t *global_namespace(void) @@ -115,7 +113,7 @@ kern_status_t object_publish(object_namespace_t *ns, const char *path, object_t if (!rpath) { return KERN_NO_MEMORY; } - + memcpy(rpath, path, path_len); cleanup_object_path(rpath, path_len, &parts); @@ -136,7 +134,7 @@ kern_status_t object_publish(object_namespace_t *ns, const char *path, object_t kfree(rpath); return KERN_NO_MEMORY; } - + status = set_add_object(cur, next); } @@ -152,7 +150,7 @@ kern_status_t object_publish(object_namespace_t *ns, const char *path, object_t } kfree(rpath); - + return set_add_object(cur, obj); } diff --git a/sched/core.c b/sched/core.c index 5ae953a..ab95a0c 100644 --- a/sched/core.c +++ b/sched/core.c @@ -33,6 +33,5 @@ kern_status_t sched_init(void) this_cpu->c_current_thread = this_thread; put_cpu(this_cpu); - printk("sched: initialised"); return status; } diff --git a/vm/bootstrap.c b/vm/bootstrap.c index 4a9520c..d1feaae 100644 --- a/vm/bootstrap.c +++ b/vm/bootstrap.c @@ -17,7 +17,6 @@ kern_status_t vm_bootstrap(const vm_zone_descriptor_t *zones, size_t nr_zones) /* we're only worrying about UMA systems for now */ node_data = memblock_alloc(sizeof(vm_pg_data_t) * numa_count, 8); - printk("vm: initialising %u node%s", numa_count, numa_count > 1 ? "s" : ""); /* TODO select which memory model to use automatically, and add a kernel boot parameter to override the choice */ diff --git a/vm/kmalloc.c b/vm/kmalloc.c index 8444f2b..fac5593 100644 --- a/vm/kmalloc.c +++ b/vm/kmalloc.c @@ -2,7 +2,6 @@ #include #include #include -#include #include #define SIZE_N_CACHE(s) \ @@ -39,7 +38,6 @@ void kmalloc_init(void) } kmalloc_initialised = 1; - printk("vm: kmalloc size-N caches online"); } void *kmalloc(size_t count, vm_flags_t flags) diff --git a/vm/sparse.c b/vm/sparse.c index 1a15339..00c32ea 100644 --- a/vm/sparse.c +++ b/vm/sparse.c @@ -44,7 +44,7 @@ static vm_sector_t *phys_addr_to_sector_and_index(phys_addr_t addr, size_t *sect if (sector_id) { *sector_id = sector; } - + if (index) { *index = addr; } @@ -58,7 +58,7 @@ static vm_page_t *get_or_create_page(phys_addr_t addr) phys_addr_to_sector_and_index(addr, §or_number, &page_number); vm_sector_t *sector = §or_array[sector_number]; - + if (!sector->s_pages) { size_t nr_pages = vm_page_order_to_pages(sector->s_size); sector->s_pages = kzalloc(nr_pages * sizeof(vm_page_t), 0); @@ -146,8 +146,6 @@ static void calculate_sector_size_and_count(size_t pmem_size, size_t reserved_si void vm_sparse_init(void) { - printk("vm: using sparse memory model"); - size_t pmem_size = 0, reserved_size = 0; memblock_iter_t it; @@ -186,7 +184,7 @@ void vm_sparse_init(void) it.it_base &= ~VM_PAGE_MASK; it.it_base += VM_PAGE_SIZE; } - + for (uintptr_t i = it.it_base; i < it.it_limit; i += VM_PAGE_SIZE) { vm_page_t *pg = get_or_create_page(i); pg->p_flags = 0; @@ -198,7 +196,7 @@ void vm_sparse_init(void) it.it_base &= ~VM_PAGE_MASK; it.it_base += VM_PAGE_SIZE; } - + for (uintptr_t i = it.it_base; i < it.it_limit; i += VM_PAGE_SIZE) { vm_page_t *pg = vm_page_get(i); @@ -213,7 +211,7 @@ void vm_sparse_init(void) } } - printk("vm: initialised %zu sectors of size %s", nr_sectors, sector_size_str); + printk("vm: [sparse] initialised %zu sectors of size %s", nr_sectors, sector_size_str); } vm_page_t *vm_page_get_sparse(phys_addr_t addr) @@ -225,7 +223,7 @@ vm_page_t *vm_page_get_sparse(phys_addr_t addr) } vm_sector_t *sector = §or_array[sector_number]; - + if (!sector->s_pages || page_number >= vm_page_order_to_pages(sector->s_size)) { return NULL; } diff --git a/vm/zone.c b/vm/zone.c index 2ff22e5..54679fc 100644 --- a/vm/zone.c +++ b/vm/zone.c @@ -58,7 +58,7 @@ static void convert_region_to_blocks(vm_zone_t *zone, order--; continue; } - + phys_addr_t block_limit = base + (order_frames * VM_PAGE_SIZE) - 1; vm_page_t *block_page = group_pages_into_block(zone, base, block_limit, order); @@ -159,7 +159,7 @@ void vm_zone_init(vm_zone_t *z, const vm_zone_descriptor_t *zone_info) char free_bytes_str[64]; data_size_to_string(free_bytes, free_bytes_str, sizeof free_bytes_str); - printk("vm: node %u/zone %s: %s of memory online.", z->z_info.zd_node, z->z_info.zd_name, free_bytes_str); + printk("vm: zone %u/%s: %s of memory online.", z->z_info.zd_node, z->z_info.zd_name, free_bytes_str); } static int replenish_free_page_list(vm_zone_t *z, vm_page_order_t order) @@ -168,12 +168,12 @@ static int replenish_free_page_list(vm_zone_t *z, vm_page_order_t order) /* we already have pages available. */ return 0; } - + if (order == VM_PAGE_MAX_ORDER) { /* there are no larger pages to split, so just give up. */ return -1; } - + /* the lowest page order that is >= `order` and still has pages available */ vm_page_order_t first_order_with_free = VM_MAX_PAGE_ORDERS; @@ -221,7 +221,7 @@ vm_page_t *vm_zone_alloc_page(vm_zone_t *z, vm_page_order_t order, vm_flags_t fl spin_unlock_irqrestore(&z->z_lock, irq_flags); return NULL; } - + queue_entry_t *pg_entry = queue_pop_front(&z->z_free_pages[order]); vm_page_t *pg = QUEUE_CONTAINER(vm_page_t, p_list, pg_entry); vm_page_foreach (pg, i) {