diff --git a/arch/misoc/src/lm32/lm32_idle.c b/arch/misoc/src/lm32/lm32_idle.c index bf9a0fc0ef..627de0945f 100644 --- a/arch/misoc/src/lm32/lm32_idle.c +++ b/arch/misoc/src/lm32/lm32_idle.c @@ -69,28 +69,5 @@ void up_idle(void) */ nxsched_process_timer(); -#else - - /* This would be an appropriate place to put some MCU-specific logic to - * sleep in a reduced power mode until an interrupt occurs to save power - */ - - /* This is a kludge that I still don't understand. The call to kmm_trysemaphore() - * in the nx_start.c IDLE loop seems necessary for the good health of the IDLE - * loop. When the work queue is enabled, this logic is removed from the IDLE - * loop and it appears that we are somehow left idling with interrupts non- - * functional. The following should be no-op, it just disables then re-enables - * interrupts. But it fixes the problem and will stay here until I understand - * the problem/fix better. - * - * And no, the contents of the CP0 status register are not incorrect. But for - * some reason the status register needs to be re-written again on this thread - * for it to take effect. This might be a PIC32-only issue? - */ - -#ifdef CONFIG_SCHED_WORKQUEUE - irqstate_t flags = enter_critical_section(); - leave_critical_section(flags); -#endif #endif } diff --git a/arch/misoc/src/minerva/minerva_idle.c b/arch/misoc/src/minerva/minerva_idle.c index ed78703093..21ea0af2c6 100644 --- a/arch/misoc/src/minerva/minerva_idle.c +++ b/arch/misoc/src/minerva/minerva_idle.c @@ -69,26 +69,5 @@ void up_idle(void) */ nxsched_process_timer(); -#else - - /* This would be an appropriate place to put some MCU-specific logic to - * sleep in a reduced power mode until an interrupt occurs to save power - * - * This is a kludge that I still don't understand. The call to - * kmm_trysemaphore() in the nx_start.c IDLE loop seems necessary for the - * good health of the IDLE loop. When the work queue is enabled, this logic - * is removed from the IDLE loop and it appears that we are somehow left - * idling with interrupts non- functional. The following should be no-op, - * it just disables then re-enables interrupts. But it fixes the problem - * and will stay here until I understand the problem/fix better. And no, - * the contents of the CP0 status register are not incorrect. But for some - * reason the status register needs to be re-written again on this thread - * for it to take effect. - */ - -#ifdef CONFIG_SCHED_WORKQUEUE - irqstate_t flags = enter_critical_section(); - leave_critical_section(flags); -#endif #endif } diff --git a/arch/risc-v/src/common/riscv_idle.c b/arch/risc-v/src/common/riscv_idle.c index fa339a67ec..38a09de392 100644 --- a/arch/risc-v/src/common/riscv_idle.c +++ b/arch/risc-v/src/common/riscv_idle.c @@ -68,24 +68,4 @@ void up_idle(void) */ nxsched_process_timer(); -#else - - /* This would be an appropriate place to put some MCU-specific logic to - * sleep in a reduced power mode until an interrupt occurs to save power - */ - - /* This is a kludge that I still don't understand. The call to - * kmm_trysemaphore() in the nx_start.c IDLE loop seems necessary for the - * good health of the IDLE loop. When the work queue is enabled, this - * logic is removed from the IDLE loop and it appears that we are somehow - * left idling with interrupts non-functional. The following should be - * no-op, it just disables then re-enables interrupts. But it fixes the - * problem and will stay here until I understand the problem/fix better. - */ - -#ifdef CONFIG_SCHED_WORKQUEUE - irqstate_t flags = enter_critical_section(); - leave_critical_section(flags); -#endif -#endif } diff --git a/boards/arm/imxrt/imxrt1050-evk/scripts/user-space.ld b/boards/arm/imxrt/imxrt1050-evk/scripts/user-space.ld index 531426f8d7..c1eb732713 100644 --- a/boards/arm/imxrt/imxrt1050-evk/scripts/user-space.ld +++ b/boards/arm/imxrt/imxrt1050-evk/scripts/user-space.ld @@ -29,8 +29,6 @@ EXTERN(umm_initialize) EXTERN(umm_addregion) -EXTERN(umm_trysemaphore) -EXTERN(umm_givesemaphore) EXTERN(malloc) EXTERN(realloc) diff --git a/boards/arm/imxrt/imxrt1060-evk/scripts/user-space.ld b/boards/arm/imxrt/imxrt1060-evk/scripts/user-space.ld index 11e928f5bf..bf675a6907 100644 --- a/boards/arm/imxrt/imxrt1060-evk/scripts/user-space.ld +++ b/boards/arm/imxrt/imxrt1060-evk/scripts/user-space.ld @@ -45,8 +45,6 @@ EXTERN(umm_initialize) EXTERN(umm_addregion) -EXTERN(umm_trysemaphore) -EXTERN(umm_givesemaphore) EXTERN(malloc) EXTERN(realloc) diff --git a/boards/arm/samv7/same70-xplained/scripts/user-space.ld b/boards/arm/samv7/same70-xplained/scripts/user-space.ld index 763f8b0470..bf32b45c7c 100644 --- a/boards/arm/samv7/same70-xplained/scripts/user-space.ld +++ b/boards/arm/samv7/same70-xplained/scripts/user-space.ld @@ -29,8 +29,6 @@ EXTERN(umm_initialize) EXTERN(umm_addregion) -EXTERN(umm_trysemaphore) -EXTERN(umm_givesemaphore) EXTERN(malloc) EXTERN(realloc) diff --git a/boards/arm/samv7/samv71-xult/scripts/user-space.ld b/boards/arm/samv7/samv71-xult/scripts/user-space.ld index 284e454691..edd0150fbf 100644 --- a/boards/arm/samv7/samv71-xult/scripts/user-space.ld +++ b/boards/arm/samv7/samv71-xult/scripts/user-space.ld @@ -29,8 +29,6 @@ EXTERN(umm_initialize) EXTERN(umm_addregion) -EXTERN(umm_trysemaphore) -EXTERN(umm_givesemaphore) EXTERN(malloc) EXTERN(realloc) diff --git a/boards/arm/stm32/axoloti/scripts/user-space.ld b/boards/arm/stm32/axoloti/scripts/user-space.ld index 7ee833ae7f..6b716d8533 100644 --- a/boards/arm/stm32/axoloti/scripts/user-space.ld +++ b/boards/arm/stm32/axoloti/scripts/user-space.ld @@ -29,8 +29,6 @@ EXTERN(umm_initialize) EXTERN(umm_addregion) -EXTERN(umm_trysemaphore) -EXTERN(umm_givesemaphore) EXTERN(malloc) EXTERN(realloc) diff --git a/boards/arm/stm32/nucleo-f429zi/scripts/user-space.ld b/boards/arm/stm32/nucleo-f429zi/scripts/user-space.ld index ac2786384f..7bbc3accc7 100644 --- a/boards/arm/stm32/nucleo-f429zi/scripts/user-space.ld +++ b/boards/arm/stm32/nucleo-f429zi/scripts/user-space.ld @@ -29,8 +29,6 @@ EXTERN(umm_initialize) EXTERN(umm_addregion) -EXTERN(umm_trysemaphore) -EXTERN(umm_givesemaphore) EXTERN(malloc) EXTERN(realloc) diff --git a/boards/arm/stm32/olimex-stm32-p407/scripts/user-space.ld b/boards/arm/stm32/olimex-stm32-p407/scripts/user-space.ld index 4bb97de754..72381a1c68 100644 --- a/boards/arm/stm32/olimex-stm32-p407/scripts/user-space.ld +++ b/boards/arm/stm32/olimex-stm32-p407/scripts/user-space.ld @@ -29,8 +29,6 @@ EXTERN(umm_initialize) EXTERN(umm_addregion) -EXTERN(umm_trysemaphore) -EXTERN(umm_givesemaphore) EXTERN(malloc) EXTERN(realloc) diff --git a/boards/arm/stm32/stm32f429i-disco/scripts/user-space.ld b/boards/arm/stm32/stm32f429i-disco/scripts/user-space.ld index c5945fdf1a..1752130e1c 100644 --- a/boards/arm/stm32/stm32f429i-disco/scripts/user-space.ld +++ b/boards/arm/stm32/stm32f429i-disco/scripts/user-space.ld @@ -29,8 +29,6 @@ EXTERN(umm_initialize) EXTERN(umm_addregion) -EXTERN(umm_trysemaphore) -EXTERN(umm_givesemaphore) EXTERN(malloc) EXTERN(realloc) diff --git a/include/nuttx/kmalloc.h b/include/nuttx/kmalloc.h index 89e8e08ba2..d75e8457ff 100644 --- a/include/nuttx/kmalloc.h +++ b/include/nuttx/kmalloc.h @@ -70,8 +70,6 @@ extern "C" #define kumm_initialize(h,s) umm_initialize(h,s) #define kumm_addregion(h,s) umm_addregion(h,s) -#define kumm_trysemaphore() umm_trysemaphore() -#define kumm_givesemaphore() umm_givesemaphore() #define kumm_calloc(n,s) calloc(n,s); #define kumm_malloc(s) malloc(s) @@ -91,8 +89,6 @@ extern "C" # define kmm_initialize(h,s) /* Initialization done by kumm_initialize */ # define kmm_addregion(h,s) umm_addregion(h,s) -# define kmm_trysemaphore() umm_trysemaphore() -# define kmm_givesemaphore() umm_givesemaphore() # define kmm_calloc(n,s) calloc(n,s); # define kmm_malloc(s) malloc(s) diff --git a/include/nuttx/mm/mm.h b/include/nuttx/mm/mm.h index 4235090669..c0cf54f397 100644 --- a/include/nuttx/mm/mm.h +++ b/include/nuttx/mm/mm.h @@ -29,8 +29,6 @@ #include #include -#include -#include /**************************************************************************** * Pre-processor Definitions @@ -185,25 +183,6 @@ void umm_addregion(FAR void *heapstart, size_t heapsize); void kmm_addregion(FAR void *heapstart, size_t heapsize); #endif -/* Functions contained in mm_sem.c ******************************************/ - -void mm_seminitialize(FAR struct mm_heap_s *heap); -void mm_takesemaphore(FAR struct mm_heap_s *heap); -int mm_trysemaphore(FAR struct mm_heap_s *heap); -void mm_givesemaphore(FAR struct mm_heap_s *heap); - -/* Functions contained in umm_sem.c *****************************************/ - -int umm_trysemaphore(void); -void umm_givesemaphore(void); - -/* Functions contained in kmm_sem.c *****************************************/ - -#ifdef CONFIG_MM_KERNEL_HEAP -int kmm_trysemaphore(void); -void kmm_givesemaphore(void); -#endif - /* Functions contained in mm_malloc.c ***************************************/ FAR void *mm_malloc(FAR struct mm_heap_s *heap, size_t size); diff --git a/mm/kmm_heap/Make.defs b/mm/kmm_heap/Make.defs index 68d91861b5..d7b3433935 100644 --- a/mm/kmm_heap/Make.defs +++ b/mm/kmm_heap/Make.defs @@ -22,7 +22,7 @@ ifeq ($(CONFIG_MM_KERNEL_HEAP),y) -CSRCS += kmm_initialize.c kmm_addregion.c kmm_sem.c +CSRCS += kmm_initialize.c kmm_addregion.c CSRCS += kmm_brkaddr.c kmm_calloc.c kmm_extend.c kmm_free.c kmm_mallinfo.c CSRCS += kmm_malloc.c kmm_memalign.c kmm_realloc.c kmm_zalloc.c kmm_heapmember.c diff --git a/mm/kmm_heap/kmm_sem.c b/mm/kmm_heap/kmm_sem.c deleted file mode 100644 index 609fb11869..0000000000 --- a/mm/kmm_heap/kmm_sem.c +++ /dev/null @@ -1,73 +0,0 @@ -/**************************************************************************** - * mm/kmm_heap/kmm_sem.c - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. The - * ASF licenses this file to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance with the - * License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - * - ****************************************************************************/ - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include - -#include - -#ifdef CONFIG_MM_KERNEL_HEAP - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: kmm_trysemaphore - * - * Description: - * Try to take the kernel heap semaphore. - * - * Input Parameters: - * None - * - * Returned Value: - * OK on success; a negated errno on failure - * - ****************************************************************************/ - -int kmm_trysemaphore(void) -{ - return mm_trysemaphore(&g_kmmheap); -} - -/**************************************************************************** - * Name: kmm_givesemaphore - * - * Description: - * Give the kernel heap semaphore. - * - * Input Parameters: - * None - * - * Returned Value: - * OK on success; a negated errno on failure - * - ****************************************************************************/ - -void kmm_givesemaphore(void) -{ - return mm_givesemaphore(&g_kmmheap); -} - -#endif /* CONFIG_MM_KERNEL_HEAP */ diff --git a/mm/mm_heap/mm.h b/mm/mm_heap/mm.h index 2aef1551e1..987ddfaf9f 100644 --- a/mm/mm_heap/mm.h +++ b/mm/mm_heap/mm.h @@ -111,6 +111,8 @@ * Public Types ****************************************************************************/ +struct mm_heap_s; + /* Determines the size of the chunk size/offset type */ #ifdef CONFIG_MM_SMALL @@ -203,9 +205,14 @@ struct mm_heap_impl_s FAR struct mm_delaynode_s *mm_delaylist; }; -/* Functions contained in mm_shrinkchunk.c **********************************/ +/* Functions contained in mm_sem.c ******************************************/ -struct mm_heap_s; +void mm_seminitialize(FAR struct mm_heap_s *heap); +void mm_takesemaphore(FAR struct mm_heap_s *heap); +int mm_trysemaphore(FAR struct mm_heap_s *heap); +void mm_givesemaphore(FAR struct mm_heap_s *heap); + +/* Functions contained in mm_shrinkchunk.c **********************************/ void mm_shrinkchunk(FAR struct mm_heap_s *heap, FAR struct mm_allocnode_s *node, size_t size); diff --git a/mm/umm_heap/Make.defs b/mm/umm_heap/Make.defs index ceb0607900..ea6ebda640 100644 --- a/mm/umm_heap/Make.defs +++ b/mm/umm_heap/Make.defs @@ -20,7 +20,7 @@ # User heap allocator -CSRCS += umm_initialize.c umm_addregion.c umm_sem.c +CSRCS += umm_initialize.c umm_addregion.c CSRCS += umm_brkaddr.c umm_calloc.c umm_extend.c umm_free.c umm_mallinfo.c CSRCS += umm_malloc.c umm_memalign.c umm_realloc.c umm_zalloc.c umm_heapmember.c CSRCS += umm_globals.c umm_valloc.c umm_aligned_alloc.c umm_posix_memalign.c diff --git a/mm/umm_heap/umm_sem.c b/mm/umm_heap/umm_sem.c deleted file mode 100644 index 8bfee07782..0000000000 --- a/mm/umm_heap/umm_sem.c +++ /dev/null @@ -1,75 +0,0 @@ -/**************************************************************************** - * mm/umm_heap/umm_sem.c - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. The - * ASF licenses this file to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance with the - * License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - * - ****************************************************************************/ - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include - -#include - -#include "umm_heap/umm_heap.h" - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: umm_trysemaphore - * - * Description: - * This is a simple wrapper for the mm_trysemaphore() function. This - * function is exported from the user-space blob so that the kernel - * can manage the user-mode allocator. - * - * Input Parameters: - * None - * - * Returned Value: - * OK on success; a negated errno on failure - * - ****************************************************************************/ - -int umm_trysemaphore(void) -{ - return mm_trysemaphore(USR_HEAP); -} - -/**************************************************************************** - * Name: umm_givesemaphore - * - * Description: - * This is a simple wrapper for the mm_givesemaphore() function. This - * function is exported from the user-space blob so that the kernel - * can manage the user-mode allocator. - * - * Input Parameters: - * None - * - * Returned Value: - * OK on success; a negated errno on failure - * - ****************************************************************************/ - -void umm_givesemaphore(void) -{ - mm_givesemaphore(USR_HEAP); -} diff --git a/sched/init/nx_start.c b/sched/init/nx_start.c index 067d9db952..74f0c06230 100644 --- a/sched/init/nx_start.c +++ b/sched/init/nx_start.c @@ -762,12 +762,6 @@ void nx_start(void) DEBUGASSERT(this_cpu() == 0 && CONFIG_MAX_TASKS > CONFIG_SMP_NCPUS); - /* Take the memory manager semaphore on this CPU so that it will not be - * available on the other CPUs until we have finished initialization. - */ - - DEBUGVERIFY(kmm_trysemaphore()); - /* Then start the other CPUs */ DEBUGVERIFY(nx_smp_start()); @@ -784,13 +778,6 @@ void nx_start(void) DEBUGVERIFY(nx_bringup()); -#ifdef CONFIG_SMP - /* Let other threads have access to the memory manager */ - - kmm_givesemaphore(); - -#endif /* CONFIG_SMP */ - /* The IDLE Loop **********************************************************/ /* When control is return to this point, the system is idle. */