Skip to content

sem:remove sem default protocl#7344

Closed
anjiahao1 wants to merge 1 commit into
apache:masterfrom
anjiahao1:sem_defult
Closed

sem:remove sem default protocl#7344
anjiahao1 wants to merge 1 commit into
apache:masterfrom
anjiahao1:sem_defult

Conversation

@anjiahao1

@anjiahao1 anjiahao1 commented Oct 18, 2022

Copy link
Copy Markdown
Contributor

Summary

step 1
step 2
this is step 3, remove all defult nxsem_set_protocol with SEM_PRIO_NONE,and then add it in nxsem_init & nxmutex_init

Impact

nothing

Testing

ostest

@masayuki2009 masayuki2009 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@anjiahao1
A deadlock happened with qemu-intel64:ostest

+ /home/ishikawa/opensource/QEMU/qemu-7.1/build/qemu-system-x86_64 -cpu host -enable-kvm -m 256M -cdrom boot.iso -nographic -serial mon:stdio
SeaBIOS (version rel-1.16.0-0-gd239552ce722-prebuilt.qemu.org)


iPXE (http://ipxe.org) 00:03.0 CA00 PCI2.10 PnP PMM+0FF91160+0FEF1160 CA00



Booting from Hard Disk...
Boot failed: could not read the boot disk

Booting from Floppy...
Boot failed: could not read the boot disk

Booting from DVD/CD...
stdio_test: write fd=1
stdio_test: Standard I/O Check: printf
stdio_test: write fd=2
...
priority_inheritance: Waiting...
lowpri_thread-1: Started
lowpri_thread-1: initial priority: 1
lowpri_thread-1: Waiting for the midle pri task to run
    g_middlestate:  0
    g_highstate[0]: 0
    I still have a count on the semaphore
lowpri_thread-2: Started
lowpri_thread-2: initial priority: 1
lowpri_thread-2: Waiting for the midle pri task to run
    g_middlestate:  0
    g_highstate[0]: 0
    I still have a count on the semaphore
lowpri_thread-3: Started
lowpri_thread-3: initial priority: 1
lowpri_thread-3: Waiting for the midle pri task to run
    g_middlestate:  0
    g_highstate[0]: 0
    I still have a count on the semaphore
lowpri_thread-1: Waiting for the midle pri task to run
    g_middlestate:  0
    g_highstate[0]: 0
    I still have a count on the semaphore
lowpri_thread-2: Waiting for the midle pri task to run
    g_middlestate:  0
    g_highstate[0]: 0
    I still have a count on the semaphore
lowpri_thread-3: Waiting for the midle pri task to run
    g_middlestate:  0
    g_highstate[0]: 0
    I still have a count on the semaphore
priority_inheritance: Starting medpri_thread at 99
priority_inheritance: Set medpri_thread priority to 99
priority_inheritance: Waiting...
medpri_thread: Started ... I won't let go of the CPU!
priority_inheritance: Starting highpri_thread-1 (of 1) at 255
priority_inheritance: Set highpri_thread-1 priority to 255
highpri_thread-1: Started
priority_inheritance: Waiting for highpri_thread-1 to complete
highpri_thread-1: Calling sem_wait()
Traceback (most recent call last):

@anjiahao1

Copy link
Copy Markdown
Contributor Author

@anjiahao1 A deadlock happened with qemu-intel64:ostest

+ /home/ishikawa/opensource/QEMU/qemu-7.1/build/qemu-system-x86_64 -cpu host -enable-kvm -m 256M -cdrom boot.iso -nographic -serial mon:stdio
SeaBIOS (version rel-1.16.0-0-gd239552ce722-prebuilt.qemu.org)


iPXE (http://ipxe.org) 00:03.0 CA00 PCI2.10 PnP PMM+0FF91160+0FEF1160 CA00



Booting from Hard Disk...
Boot failed: could not read the boot disk

Booting from Floppy...
Boot failed: could not read the boot disk

Booting from DVD/CD...
stdio_test: write fd=1
stdio_test: Standard I/O Check: printf
stdio_test: write fd=2
...
priority_inheritance: Waiting...
lowpri_thread-1: Started
lowpri_thread-1: initial priority: 1
lowpri_thread-1: Waiting for the midle pri task to run
    g_middlestate:  0
    g_highstate[0]: 0
    I still have a count on the semaphore
lowpri_thread-2: Started
lowpri_thread-2: initial priority: 1
lowpri_thread-2: Waiting for the midle pri task to run
    g_middlestate:  0
    g_highstate[0]: 0
    I still have a count on the semaphore
lowpri_thread-3: Started
lowpri_thread-3: initial priority: 1
lowpri_thread-3: Waiting for the midle pri task to run
    g_middlestate:  0
    g_highstate[0]: 0
    I still have a count on the semaphore
lowpri_thread-1: Waiting for the midle pri task to run
    g_middlestate:  0
    g_highstate[0]: 0
    I still have a count on the semaphore
lowpri_thread-2: Waiting for the midle pri task to run
    g_middlestate:  0
    g_highstate[0]: 0
    I still have a count on the semaphore
lowpri_thread-3: Waiting for the midle pri task to run
    g_middlestate:  0
    g_highstate[0]: 0
    I still have a count on the semaphore
priority_inheritance: Starting medpri_thread at 99
priority_inheritance: Set medpri_thread priority to 99
priority_inheritance: Waiting...
medpri_thread: Started ... I won't let go of the CPU!
priority_inheritance: Starting highpri_thread-1 (of 1) at 255
priority_inheritance: Set highpri_thread-1 priority to 255
highpri_thread-1: Started
priority_inheritance: Waiting for highpri_thread-1 to complete
highpri_thread-1: Calling sem_wait()
Traceback (most recent call last):

ok,i check it now

@anjiahao1

Copy link
Copy Markdown
Contributor Author

@masayuki2009 apache/nuttx-apps#1358 this is fix patch

@anjiahao1

Copy link
Copy Markdown
Contributor Author

this pr just remove defult protocl, #5070 this pr change sem defult behavior

Signed-off-by: anjiahao <anjiahao@xiaomi.com>
@masayuki2009

masayuki2009 commented Oct 18, 2022

Copy link
Copy Markdown
Contributor

@masayuki2009 apache/nuttx-apps#1358 this is fix patch

@anjiahao1
Please update the impact in the summary and commit log.

@anjiahao1 anjiahao1 changed the title sem:change sem default behavior sem:remove sem default protocl Oct 19, 2022
@xiaoxiang781216

xiaoxiang781216 commented Oct 19, 2022

Copy link
Copy Markdown
Contributor

@anjiahao1 let move this patch to the pr#5070, and close this pr.

@davids5

davids5 commented Oct 19, 2022

Copy link
Copy Markdown
Contributor

@anjiahao1 Is there documentation added to the docs for this change documenting the new mutex and sem symantics and usage?

@anjiahao1

Copy link
Copy Markdown
Contributor Author

use #5070 to submit patch,so close current PR

@anjiahao1 anjiahao1 closed this Oct 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Replace all place which use semaphore as lock with mutex wrapper

4 participants