Changeset c626117 in mainline
- Timestamp:
- 2025-04-10T17:31:25Z (4 days ago)
- Branches:
- master
- Children:
- 9f2f5ee
- Parents:
- 0b47781
- git-author:
- Jiří Zárevúcky <zarevucky.jiri@…> (2025-04-10 16:34:47)
- git-committer:
- Jiří Zárevúcky <zarevucky.jiri@…> (2025-04-10 17:31:25)
- Location:
- kernel/generic/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/src/mm/frame.c
r0b47781 rc626117 72 72 * available. 73 73 */ 74 static MUTEX_INITIALIZE(mem_avail_mtx, MUTEX_ACTIVE);74 static IRQ_SPINLOCK_INITIALIZE(mem_avail_lock); 75 75 static CONDVAR_INITIALIZE(mem_avail_cv); 76 76 static size_t mem_avail_req = 0; /**< Number of frames requested. */ … … 951 951 #endif 952 952 953 /* 954 * Since the mem_avail_mtx is an active mutex, we need to 955 * disable interrupts to prevent deadlock with TLB shootdown. 956 */ 957 ipl_t ipl = interrupts_disable(); 958 mutex_lock(&mem_avail_mtx); 953 /* Disabled interrupts needed to prevent deadlock with TLB shootdown. */ 954 irq_spinlock_lock(&mem_avail_lock, true); 959 955 960 956 if (mem_avail_req > 0) … … 966 962 967 963 while (gen == mem_avail_gen) 968 condvar_wait(&mem_avail_cv, &mem_avail_mtx); 969 970 mutex_unlock(&mem_avail_mtx); 971 interrupts_restore(ipl); 964 condvar_wait(&mem_avail_cv, &mem_avail_lock); 965 966 irq_spinlock_unlock(&mem_avail_lock, true); 972 967 973 968 #ifdef CONFIG_DEBUG … … 1027 1022 irq_spinlock_unlock(&zones.lock, true); 1028 1023 1029 /* 1030 * Signal that some memory has been freed. 1031 * Since the mem_avail_mtx is an active mutex, 1032 * we need to disable interruptsto prevent deadlock 1033 * with TLB shootdown. 1034 */ 1035 1036 ipl_t ipl = interrupts_disable(); 1037 mutex_lock(&mem_avail_mtx); 1024 /* Signal that some memory has been freed. */ 1025 1026 /* Disabled interrupts needed to prevent deadlock with TLB shootdown. */ 1027 irq_spinlock_lock(&mem_avail_lock, true); 1038 1028 1039 1029 if (mem_avail_req > 0) … … 1045 1035 } 1046 1036 1047 mutex_unlock(&mem_avail_mtx); 1048 interrupts_restore(ipl); 1037 irq_spinlock_unlock(&mem_avail_lock, true); 1049 1038 1050 1039 if (!(flags & FRAME_NO_RESERVE)) -
kernel/generic/src/sysinfo/sysinfo.c
r0b47781 rc626117 57 57 58 58 /** Sysinfo lock */ 59 static MUTEX_INITIALIZE(sysinfo_lock, MUTEX_ACTIVE);59 static IRQ_SPINLOCK_INITIALIZE(sysinfo_lock); 60 60 61 61 /** Sysinfo item constructor … … 327 327 { 328 328 /* Protect sysinfo tree consistency */ 329 mutex_lock(&sysinfo_lock);329 irq_spinlock_lock(&sysinfo_lock, true); 330 330 331 331 if (root == NULL) … … 340 340 } 341 341 342 mutex_unlock(&sysinfo_lock);342 irq_spinlock_unlock(&sysinfo_lock, true); 343 343 } 344 344 … … 360 360 { 361 361 /* Protect sysinfo tree consistency */ 362 mutex_lock(&sysinfo_lock);362 irq_spinlock_lock(&sysinfo_lock, true); 363 363 364 364 if (root == NULL) … … 374 374 } 375 375 376 mutex_unlock(&sysinfo_lock);376 irq_spinlock_unlock(&sysinfo_lock, true); 377 377 } 378 378 … … 390 390 { 391 391 /* Protect sysinfo tree consistency */ 392 mutex_lock(&sysinfo_lock);392 irq_spinlock_lock(&sysinfo_lock, true); 393 393 394 394 if (root == NULL) … … 404 404 } 405 405 406 mutex_unlock(&sysinfo_lock);406 irq_spinlock_unlock(&sysinfo_lock, true); 407 407 } 408 408 … … 425 425 { 426 426 /* Protect sysinfo tree consistency */ 427 mutex_lock(&sysinfo_lock);427 irq_spinlock_lock(&sysinfo_lock, true); 428 428 429 429 if (root == NULL) … … 439 439 } 440 440 441 mutex_unlock(&sysinfo_lock);441 irq_spinlock_unlock(&sysinfo_lock, true); 442 442 } 443 443 … … 452 452 { 453 453 /* Protect sysinfo tree consistency */ 454 mutex_lock(&sysinfo_lock);454 irq_spinlock_lock(&sysinfo_lock, true); 455 455 456 456 if (root == NULL) … … 463 463 printf("Could not set sysinfo item %s.\n", name); 464 464 465 mutex_unlock(&sysinfo_lock);465 irq_spinlock_unlock(&sysinfo_lock, true); 466 466 } 467 467 … … 479 479 { 480 480 /* Protect sysinfo tree consistency */ 481 mutex_lock(&sysinfo_lock);481 irq_spinlock_lock(&sysinfo_lock, true); 482 482 483 483 if (root == NULL) … … 498 498 } 499 499 500 mutex_unlock(&sysinfo_lock);500 irq_spinlock_unlock(&sysinfo_lock, true); 501 501 } 502 502 … … 596 596 * while we are dumping it 597 597 */ 598 mutex_lock(&sysinfo_lock);598 irq_spinlock_lock(&sysinfo_lock, true); 599 599 600 600 if (root == NULL) … … 603 603 sysinfo_dump_internal(root, 0); 604 604 605 mutex_unlock(&sysinfo_lock);605 irq_spinlock_unlock(&sysinfo_lock, true); 606 606 } 607 607 … … 695 695 * are reading it. 696 696 */ 697 mutex_lock(&sysinfo_lock);697 irq_spinlock_lock(&sysinfo_lock, true); 698 698 ret = sysinfo_get_item(path, NULL, dry_run); 699 mutex_unlock(&sysinfo_lock);699 irq_spinlock_unlock(&sysinfo_lock, true); 700 700 } 701 701 … … 806 806 * are reading it. 807 807 */ 808 mutex_lock(&sysinfo_lock);808 irq_spinlock_lock(&sysinfo_lock, true); 809 809 ret = sysinfo_get_keys(path, NULL, dry_run); 810 mutex_unlock(&sysinfo_lock);810 irq_spinlock_unlock(&sysinfo_lock, true); 811 811 } 812 812
Note:
See TracChangeset
for help on using the changeset viewer.