Event: Zephyr Project: APIs - 09/14/2021
#cal-reminder
devel@lists.zephyrproject.org Calendar <noreply@...>
Reminder: Zephyr Project: APIs When: Where: Organizer: devel@... An RSVP is requested. Click here to RSVP Description: Meeting decisions/discussions in their respective PRs, tracked here: https://github.com/zephyrproject-rtos/zephyr/projects/18 ________________________________________________________________________________
+1 321-558-6518 United States, Orlando (Toll)
Conference ID: 317 990 129#
Local numbers | Reset PIN | Learn more about Teams | Meeting options
________________________________________________________________________________
|
|
Re: Why do_swap() sets cpu.current before context switch?
Katsuhiro Suzuki
Hello,
On 2021/09/09 10:41, Yasushi SHOJI wrote: Hi,Hmm... It seems that in CONFIG_USE_SWITCH=n case (ex. aarch32(*)) _current_cpu.current is updated by software interrupt handler. (*) arch/arm/core/aarch32/swap_helper.S So I wonder that why CONFIG_USE_SWITCH=y changed strategy to update current thread. At an IRQ, you know the `_current` is the currently executing thread and you canRight and agree with you. If this is intentional behavior and we encourage CONFIG_USE_SWITCH=y case to separate from old code, I want to follow it. I don't have any claim to current context switching specification, just want to know "why changed?". I agree that we need to do similar things for arch_switch and irq, andYeah, this is Zephyr. Not Linux :) just my 2 cents,Best Regards, Katsuhiro Suzuki
|
|
Re: Why do_swap() sets cpu.current before context switch?
Katsuhiro Suzuki
Hello,
On 2021/09/09 1:14, Andy Ross wrote: On 9/8/2021 8:08 AM, Katsuhiro Suzuki wrote:I can check it directly. I think this is future work to achieve more faster switchingRISC-V's FPU arch has the flag to permit/forbid using FPU. In Zephyr, this flag is set toCan't you just check that flag in the context switch code? It seems like that would be faster on average (most DSP workloads try very hard to avoid doing synchronous context switches to avoid the need to spill all that state), and have much better latency guarantees (taking an exception is REALLY expensive!). than now. At this point, I want to implement most conservative one.. AndyBest Regards, Katsuhiro Suzuki
|
|
API meeting: agenda
Carles Cufi
Hi all,
Agenda for today: - Pinctrl: Side-by-side comparison of two (similar) approaches proposed - PR #1: https://github.com/zephyrproject-rtos/zephyr/pull/37572 - PR #2: https://github.com/zephyrproject-rtos/zephyr/pull/37621 - Discussion, specifically Devicetree layout format: https://github.com/zephyrproject-rtos/zephyr/discussions/35077#discussioncomment-1201394 If you have additional items please let me know. Teams link: https://teams.microsoft.com/l/meetup-join/19%3ameeting_NWU2MjZlYWEtZDcwMi00MWQzLTgwMjEtNDdkYjQwMjBjMmFj%40thread.v2/0?context=%7b%22Tid%22%3a%22af0096d9-700c-411a-b795-b3dd7122bad2%22%2c%22Oid%22%3a%22841a7c92-7816-4faf-9887-5e334e88f6d8%22%7d https://lists.zephyrproject.org/g/devel/calendar https://github.com/zephyrproject-rtos/zephyr/projects/18 Minutes: https://docs.google.com/document/d/1lv-8B5QE2m4FjBcvfqAXFIgQfW5oz6306zJ7GIZIWCk/edit Regards, Carles
|
|
Event: Zephyr Memory Footprint - biweekly discussion - 09/13/2021
#cal-reminder
devel@lists.zephyrproject.org Calendar <noreply@...>
Reminder: Zephyr Memory Footprint - biweekly discussion When: Where: Organizer: devel@... An RSVP is requested. Click here to RSVP Description: ______________________________
Microsoft Teams meeting
Join on your computer or mobile app
Click here to join the meetingOr call in (audio only)
+1 321-558-6518,,546018126# United States, Orlando
______________________________
|
|
Re: Event: Zephyr Memory Footprint - biweekly discussion - 08/30/2021
#cal-reminder
Rob Woolley
Here are the minutes from our last meeting: https://docs.google.com/document/d/1bnQLJKVhgI3zkk3MsSXun8onEsA8z1Rf5ohdbCHASmU/edit#
I don’t have any agenda items for today. As we discussed last week, I propose we cancel today’s meeting in favour of meeting again on September 27th.
Have a great day, Rob
From: devel@... <devel@...>
On Behalf Of devel@... Calendar
Sent: August 30, 2021 10:45 AM To: devel@... Subject: [Zephyr-devel] Event: Zephyr Memory Footprint - biweekly discussion - 08/30/2021 #cal-reminder
[Please note: This e-mail is from an EXTERNAL e-mail address] Reminder: Zephyr Memory Footprint - biweekly discussion When: Where: Organizer: devel@... An RSVP is requested. Click here to RSVP Description: ________________________________________________________________________________ Microsoft Teams meeting Join on your computer or mobile app Or call in (audio only) +1 321-558-6518,,546018126# United States, Orlando Phone Conference ID: 546 018 126#
________________________________________________________________________________
|
|
HX711 support
Carles Cufi
Hi all,
Today during a Discord conversation a user mentioned that support for the HX711 is currently in Pull Request form, but progress has stalled. I glanced through the PR and it seems to me that it needs a bit of work, but other users mention that they would like to see this merged. If anyone with access to the hardware and the willingness to push this forward is up to the task, here is the original PR from Georgios: https://github.com/zephyrproject-rtos/zephyr/pull/24295 Thanks, Carles
|
|
Re: Unknown origin of error
lairdjm
Hi Markus,
Do you have the include at the top of the driver you're developing which incluces the spi-device.yaml file, e.g. from one of the other LIS2XX devices:
include: ["spi-device.yaml", "st,lis2dh-common.yaml"]
The SPI frequency should be for the device not the SPI controller, not that I've tested it and don't know if it's implemented or works but in theory you could have an SPI bus with 3 devices attached, one device could take at 250Kbps, one at 1Mbps and the
other at 20Mbps hence the SPI maximum frequency being part of the device configuration
Thanks, Jamie
On Fri, 2021-09-10 at 06:07 -0700, markus.prager via lists.zephyrproject.org wrote:
|
|
a Problem with external_lib sample
Omar Morceli
i'm facing a problem when i building the external_lib sample > west build -b nrf52dk_nrf52832 [1/142] Performing build step for 'mylib_project' FAILED: mylib/src/mylib_project-stamp/mylib_project-build mylib/lib/libmylib.a cmd.exe /C "cd /D C:\Users\OMAR\zephyrproject\zephyr\samples\application_development\external_lib\mylib && make PREFIX=C:/Users/OMAR/zephyrproject/zephyr/samples/application_development/external_lib/build/mylib "CC=C:/Program Files (x86)/GNU Arm Embedded Toolchain/10 2020-q4-major/bin/arm-none-eabi-gcc.exe" "AR=C:/Program Files (x86)/GNU Arm Embedded Toolchain/10 2020-q4-major/bin/arm-none-eabi-ar.exe" "CFLAGS=-IC:/Users/OMAR/zephyrproject/zephyr/include -IC:/Users/OMAR/zephyrproject/zephyr/samples/application_development/external_lib/build/zephyr/include/generated -IC:/Users/OMAR/zephyrproject/zephyr/soc/arm/nordic_nrf/nrf52 -IC:/Users/OMAR/zephyrproject/zephyr/lib/libc/minimal/include -IC:/Users/OMAR/zephyrproject/modules/hal/cmsis/CMSIS/Core/Include -IC:/Users/OMAR/zephyrproject/modules/hal/nordic/nrfx -IC:/Users/OMAR/zephyrproject/modules/hal/nordic/nrfx/drivers/include -IC:/Users/OMAR/zephyrproject/modules/hal/nordic/nrfx/mdk -IC:/Users/OMAR/zephyrproject/zephyr/modules/hal_nordic/nrfx/. -IC:/Users/OMAR/zephyrproject/modules/debug/segger/SEGGER -IC:/Users/OMAR/zephyrproject/modules/debug/segger/Config -IC:/Users/OMAR/zephyrproject/zephyr/modules/segger/. -Ic:/program files (x86)/gnu arm embedded toolchain/10 2020-q4-major/bin/../lib/gcc/arm-none-eabi/10.2.1/include -Ic:/program files (x86)/gnu arm embedded toolchain/10 2020-q4-major/bin/../lib/gcc/arm-none-eabi/10.2.1/include-fixed -DKERNEL -D__ZEPHYR__=1 -D_FORTIFY_SOURCE=2 -DBUILD_VERSION=zephyr-v2.6.0-663-g4ad79bb609be -D__PROGRAM_START -DNRF52832_XXAA -DNRF52832_XXAA -Os -imacros C:/Users/OMAR/zephyrproject/zephyr/samples/application_development/external_lib/build/zephyr/include/generated/autoconf.h -ffreestanding -fno-common -g -gdwarf-4 -fdiagnostics-color=always -mcpu=cortex-m4 -mthumb -mabi=aapcs -imacros C:/Users/OMAR/zephyrproject/zephyr/include/toolchain/zephyr_stdint.h -Wall -Wformat -Wformat-security -Wno-format-zero-length -Wno-main -Wno-pointer-sign -Wpointer-arith -Wexpansion-to-defined -Wno-address-of-packed-member -Wno-unused-but-set-variable -Werror=implicit-int -fno-asynchronous-unwind-tables -fno-pie -fno-pic -fno-strict-overflow -fno-reorder-functions -fno-defer-pop -fmacro-prefix-map=C:/Users/OMAR/zephyrproject/zephyr/samples/application_development/external_lib=CMAKE_SOURCE_DIR -fmacro-prefix-map=C:/Users/OMAR/zephyrproject/zephyr=ZEPHYR_BASE -fmacro-prefix-map=C:/Users/OMAR/zephyrproject=WEST_TOPDIR -ffunction-sections -fdata-sections -std=c99 -nostdinc -isystemC:/Users/OMAR/zephyrproject/zephyr/lib/libc/minimal/include -isystemc:/program files (x86)/gnu arm embedded toolchain/10 2020-q4-major/bin/../lib/gcc/arm-none-eabi/10.2.1/include -isystemc:/program files (x86)/gnu arm embedded toolchain/10 2020-q4-major/bin/../lib/gcc/arm-none-eabi/10.2.1/include-fixed" && "C:\Program Files\CMake\bin\cmake.exe" -E touch C:/Users/OMAR/zephyrproject/zephyr/samples/application_development/external_lib/build/mylib/src/mylib_project-stamp/mylib_project-build" mkdir -p C:/Users/OMAR/zephyrproject/zephyr/samples/application_development/external_lib/build/mylib/obj C:/Users/OMAR/zephyrproject/zephyr/samples/application_development/external_lib/build/mylib/lib The syntax of the command is incorrect. make: *** [all] Error 1 [2/142] Building C object zephyr/CMakeFiles/offsets.dir/arch/arm/core/offsets/offsets.c.obj ninja: build stopped: subcommand failed. FATAL ERROR: command exited with status 1: 'C:\Program Files\CMake\bin\cmake.EXE' --build 'C:\Users\OMAR\zephyrproject\zephyr\samples\application_development\external_lib\build' Thanks
|
|
Re: Dev-Review Meeting Agenda Sept 9th
Bolivar, Marti
toggle quoted messageShow quoted text
From: devel@... <devel@...> on behalf of Kumar Gala via lists.zephyrproject.org <kumar.gala=linaro.org@...>
Sent: Wednesday, September 8, 2021 10:02 AM To: devel <devel@...> Cc: Marull, Gerard <gerard.marull@...>; Erwan Gouriou <erwan.gouriou@...> Subject: [Zephyr-devel] Dev-Review Meeting Agenda Sept 9th PINCTRL:
- devicetree description (option 1 vs option 3) Option1 (grouping by device): NRF: https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgist.github.com%2Fgmarull%2Fe2afed5c97a188f3830ff0bd59d3d3ae&data=04%7C01%7Cmarti.bolivar%40nordicsemi.no%7C166a6b8c438849649be008d972ea8828%7C28e5afa2bf6f419a8cf6b31c6e9e5e8d%7C0%7C0%7C637667173911869513%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=np7sKz42jb%2FwCq3lv2mJvx8b2BbwLxJtg5vqXkr2FxY%3D&reserved=0 NXP: https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgist.github.com%2Fgalak%2Fa3c021d8052e58c818d4df60c981558c&data=04%7C01%7Cmarti.bolivar%40nordicsemi.no%7C166a6b8c438849649be008d972ea8828%7C28e5afa2bf6f419a8cf6b31c6e9e5e8d%7C0%7C0%7C637667173911869513%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=lstQAmYLPhryqZbB72qn%2Fpej91bowQOOmkjBdfmp0tQ%3D&reserved=0 Option3 (grouping by pin): NRF: https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgist.github.com%2Fgmarull%2F6993e3eacad1b0d7c00c1ea2f16c3a12&data=04%7C01%7Cmarti.bolivar%40nordicsemi.no%7C166a6b8c438849649be008d972ea8828%7C28e5afa2bf6f419a8cf6b31c6e9e5e8d%7C0%7C0%7C637667173911879471%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=%2FAAZAPUoq1mEJfjJV9b2KEl4RCIf44ulF4bYl%2BDmjto%3D&reserved=0 NXP: https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgist.github.com%2Fgalak%2Ffb558ef83203db69b9ad983bd39b5d71&data=04%7C01%7Cmarti.bolivar%40nordicsemi.no%7C166a6b8c438849649be008d972ea8828%7C28e5afa2bf6f419a8cf6b31c6e9e5e8d%7C0%7C0%7C637667173911879471%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=lLwzURnxykr63bLlC2IbdjMbiFyXBIX%2Bwdu6CdvetNw%3D&reserved=0 - API discussion - https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fzephyrproject-rtos%2Fzephyr%2Fdiscussions%2F35077&data=04%7C01%7Cmarti.bolivar%40nordicsemi.no%7C166a6b8c438849649be008d972ea8828%7C28e5afa2bf6f419a8cf6b31c6e9e5e8d%7C0%7C0%7C637667173911879471%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=3b1rv%2F0VgCHo5uarvge6CDoC96XVsc8QZ1U9o48pV1A%3D&reserved=0 drivers: regulator: convert to gpio_dt_spec - https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fzephyrproject-rtos%2Fzephyr%2Fpull%2F37689&data=04%7C01%7Cmarti.bolivar%40nordicsemi.no%7C166a6b8c438849649be008d972ea8828%7C28e5afa2bf6f419a8cf6b31c6e9e5e8d%7C0%7C0%7C637667173911879471%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=%2FhMOb10KltcSJSMj1KZ%2Bu6Sqvu8aSs%2B1fF7JkUq3HdE%3D&reserved=0 Plus anything anyone else has. - k
|
|
Re: Unknown origin of error
markus.prager@...
Alright, so thanks to Nick (thank you!) I have now narrowed down my problem a little.
|
|
Power sequencing and driver intialisation
Hi All,
We're building a custom board with a no-standard power sequence. The processor and a TCA6418 GPIO expander come up first on a low-current 1V8 supply. The TCA6418 controls the enable pins for all the power regulators in the system, including the high-current 1V8 that powers the rest of the devices connected to the processor. So order of initialization will be:
Is it possible to do this using just the priority levels in the drivers? Glenn
|
|
Problem when building external_lib sample
Omar Morceli
hi i'm facing a problem when i building the external_lib sample > west build -b nrf52dk_nrf52832 [1/142] Performing build step for 'mylib_project' FAILED: mylib/src/mylib_project-stamp/mylib_project-build mylib/lib/libmylib.a cmd.exe /C "cd /D C:\Users\OMAR\zephyrproject\zephyr\samples\application_development\external_lib\mylib && make PREFIX=C:/Users/OMAR/zephyrproject/zephyr/samples/application_development/external_lib/build/mylib "CC=C:/Program Files (x86)/GNU Arm Embedded Toolchain/10 2020-q4-major/bin/arm-none-eabi-gcc.exe" "AR=C:/Program Files (x86)/GNU Arm Embedded Toolchain/10 2020-q4-major/bin/arm-none-eabi-ar.exe" "CFLAGS=-IC:/Users/OMAR/zephyrproject/zephyr/include -IC:/Users/OMAR/zephyrproject/zephyr/samples/application_development/external_lib/build/zephyr/include/generated -IC:/Users/OMAR/zephyrproject/zephyr/soc/arm/nordic_nrf/nrf52 -IC:/Users/OMAR/zephyrproject/zephyr/lib/libc/minimal/include -IC:/Users/OMAR/zephyrproject/modules/hal/cmsis/CMSIS/Core/Include -IC:/Users/OMAR/zephyrproject/modules/hal/nordic/nrfx -IC:/Users/OMAR/zephyrproject/modules/hal/nordic/nrfx/drivers/include -IC:/Users/OMAR/zephyrproject/modules/hal/nordic/nrfx/mdk -IC:/Users/OMAR/zephyrproject/zephyr/modules/hal_nordic/nrfx/. -IC:/Users/OMAR/zephyrproject/modules/debug/segger/SEGGER -IC:/Users/OMAR/zephyrproject/modules/debug/segger/Config -IC:/Users/OMAR/zephyrproject/zephyr/modules/segger/. -Ic:/program files (x86)/gnu arm embedded toolchain/10 2020-q4-major/bin/../lib/gcc/arm-none-eabi/10.2.1/include -Ic:/program files (x86)/gnu arm embedded toolchain/10 2020-q4-major/bin/../lib/gcc/arm-none-eabi/10.2.1/include-fixed -DKERNEL -D__ZEPHYR__=1 -D_FORTIFY_SOURCE=2 -DBUILD_VERSION=zephyr-v2.6.0-663-g4ad79bb609be -D__PROGRAM_START -DNRF52832_XXAA -DNRF52832_XXAA -Os -imacros C:/Users/OMAR/zephyrproject/zephyr/samples/application_development/external_lib/build/zephyr/include/generated/autoconf.h -ffreestanding -fno-common -g -gdwarf-4 -fdiagnostics-color=always -mcpu=cortex-m4 -mthumb -mabi=aapcs -imacros C:/Users/OMAR/zephyrproject/zephyr/include/toolchain/zephyr_stdint.h -Wall -Wformat -Wformat-security -Wno-format-zero-length -Wno-main -Wno-pointer-sign -Wpointer-arith -Wexpansion-to-defined -Wno-address-of-packed-member -Wno-unused-but-set-variable -Werror=implicit-int -fno-asynchronous-unwind-tables -fno-pie -fno-pic -fno-strict-overflow -fno-reorder-functions -fno-defer-pop -fmacro-prefix-map=C:/Users/OMAR/zephyrproject/zephyr/samples/application_development/external_lib=CMAKE_SOURCE_DIR -fmacro-prefix-map=C:/Users/OMAR/zephyrproject/zephyr=ZEPHYR_BASE -fmacro-prefix-map=C:/Users/OMAR/zephyrproject=WEST_TOPDIR -ffunction-sections -fdata-sections -std=c99 -nostdinc -isystemC:/Users/OMAR/zephyrproject/zephyr/lib/libc/minimal/include -isystemc:/program files (x86)/gnu arm embedded toolchain/10 2020-q4-major/bin/../lib/gcc/arm-none-eabi/10.2.1/include -isystemc:/program files (x86)/gnu arm embedded toolchain/10 2020-q4-major/bin/../lib/gcc/arm-none-eabi/10.2.1/include-fixed" && "C:\Program Files\CMake\bin\cmake.exe" -E touch C:/Users/OMAR/zephyrproject/zephyr/samples/application_development/external_lib/build/mylib/src/mylib_project-stamp/mylib_project-build" mkdir -p C:/Users/OMAR/zephyrproject/zephyr/samples/application_development/external_lib/build/mylib/obj C:/Users/OMAR/zephyrproject/zephyr/samples/application_development/external_lib/build/mylib/lib The syntax of the command is incorrect. make: *** [all] Error 1 [2/142] Building C object zephyr/CMakeFiles/offsets.dir/arch/arm/core/offsets/offsets.c.obj ninja: build stopped: subcommand failed. FATAL ERROR: command exited with status 1: 'C:\Program Files\CMake\bin\cmake.EXE' --build 'C:\Users\OMAR\zephyrproject\zephyr\samples\application_development\external_lib\build' Thanks
|
|
Event: Zephyr Project: Dev Meeting - 09/09/2021
#cal-reminder
devel@lists.zephyrproject.org Calendar <noreply@...>
Reminder: Zephyr Project: Dev Meeting When: Where: Organizer: devel@... An RSVP is requested. Click here to RSVP Description: ________________________________________________________________________________
+1 321-558-6518 United States, Orlando (Toll)
Conference ID: 483 314 739#
Local numbers | Reset PIN | Learn more about Teams | Meeting options
________________________________________________________________________________
|
|
Re: Why do_swap() sets cpu.current before context switch?
Yasushi SHOJI
Hi,
On Thu, Sep 9, 2021 at 12:01 AM Katsuhiro Suzuki <katsuhiro@katsuster.net> wrote: On 2021/09/08 16:22, Yasushi SHOJI wrote:The reason why we set _current to the new thread is that we can't set it afterOn Wed, Sep 8, 2021 at 10:23 AM Katsuhiro Suzuki <katsuhiro@katsuster.net> wrote:Because to keep consistency for another context switching (by preemption) and we switch to the new thread. The newly switched thread will just start running from the point it left off. Otherwise, we have to make sure that each and every arch must set _current to the new thread in `arch_switch()`. At an IRQ, you know the `_current` is the currently executing thread and you can get a new thread from ready_q, if needed. At explicit switch, you are given both old and new threads. So in both cases, we _can_ implement the switch. I agree that we need to do similar things for arch_switch and irq, and love to use exact same code for both, but it might be better to have separate code for each situation. Or, at least use .macro to construct parts of it. ps. Unfortunately, unlike the Linux kernel, we don't have any way to get the thread struct from a stack pointer, IIRC. just my 2 cents, -- yashi
|
|
Dev-Review Meeting Agenda Sept 9th
Kumar Gala
PINCTRL:
- devicetree description (option 1 vs option 3) Option1 (grouping by device): NRF: https://gist.github.com/gmarull/e2afed5c97a188f3830ff0bd59d3d3ae NXP: https://gist.github.com/galak/a3c021d8052e58c818d4df60c981558c Option3 (grouping by pin): NRF: https://gist.github.com/gmarull/6993e3eacad1b0d7c00c1ea2f16c3a12 NXP: https://gist.github.com/galak/fb558ef83203db69b9ad983bd39b5d71 - API discussion - https://github.com/zephyrproject-rtos/zephyr/discussions/35077 drivers: regulator: convert to gpio_dt_spec - https://github.com/zephyrproject-rtos/zephyr/pull/37689 Plus anything anyone else has. - k
|
|
Re: Why do_swap() sets cpu.current before context switch?
Andy Ross
On 9/8/2021 8:08 AM, Katsuhiro Suzuki wrote:
RISC-V's FPU arch has the flag to permit/forbid using FPU. In Zephyr, this flag is set to Can't you just check that flag in the context switch code? It seems like that would be faster on average (most DSP workloads try very hard to avoid doing synchronous context switches to avoid the need to spill all that state), and have much better latency guarantees (taking an exception is REALLY expensive!). Andy
|
|
Re: Why do_swap() sets cpu.current before context switch?
Katsuhiro Suzuki
Hello,
On 2021/09/08 11:35, andy-intel@plausible.org wrote: Katsuhiro Suzuki wrote:Thanks for your advice.Newer switching sets NEW thread handle into _current_cpu.currentSo... this is the very middle of a context switch. The expectation of the kernel is that no exception/interrupt handlers are going to fire, because (by definition) if they do they will see corrupt/inconsistent thread state. Or rather, if an architecture wants to allow that, it needs to be prepared to do the work. Current RISC-V implementation (CONFIG_USE_SWITCH=n) is using 'ecall' (this is SW interrupt instruction) to execute context switching explicitly. And jump into interrupt handler that is used from not only SW interrupt but also other interrupts. In interrupt handler, kernel saves FPU registers of current thread that is pointing old thread. I agree with you that I can add special path for explicit context switching. If such path is needed, I will add that. Can you explain why you need to take an FPU exception in the middle of a context switch? That seems a little questionable to me. Why are you hitting lazy-saved FPU registers in a situation where it would be faster to just check the mask state to see if they are populated or not? (Forgive me: I don't know the RISC-V FPU architecture, but I assume that's the situation you're in: the FPU registers may or may not be in use and using them if they aren't will trap.)In my understanding, RISC-V has not supported lazy-saved FPU yet. Always need to save FPU registers at the beginning of interrupt handler. RISC-V's FPU arch has the flag to permit/forbid using FPU. In Zephyr, this flag is set to forbid side if thread was declared as not using FPU. And CPU raise interrupt when using any FPU instruction at FPU forbidden state. AndyBest Regards, Katsuhiro Suzuki
|
|
Re: Why do_swap() sets cpu.current before context switch?
Katsuhiro Suzuki
Hello,
Thank you for reply. On 2021/09/08 16:22, Yasushi SHOJI wrote: Hi,Currently, No. I'm trying to add a support for CONFIG_USE_SWITCH=y case. Sorry for confusing. Older means CONFIG_USE_SWITCH=n.Newer switching sets NEW thread handle into _current_cpu.current BEFORE calling arch_switch().AFAICS, even with v1.11, we are setting `_current` to `new_thread` in Does not means Zephyr's version. Why do you `use _current_cpu` at all? `_arch_switch()` orBecause to keep consistency for another context switching (by preemption) and other interrupts. Only _current_cpu.current is available when an interrupt occurred. Best,Best Regards, Katsuhiro Suzuki
|
|
Re: Why do_swap() sets cpu.current before context switch?
Yasushi SHOJI
Hi,
On Wed, Sep 8, 2021 at 10:23 AM Katsuhiro Suzuki <katsuhiro@katsuster.net> wrote: I have question about newer version of context switching (CONFIG_USE_SWITCH=y).Does RISC-V support USE_SWITCH? Newer switching sets NEW thread handle into _current_cpu.current BEFORE calling arch_switch().AFAICS, even with v1.11, we are setting `_current` to `new_thread` in `_Swap()` before calling `_arch_switch()`. What version are you referring to as "older"? Why do you `use _current_cpu` at all? `_arch_switch()` or `arch_switch()` on the main branch takes both new and old thread handles. Best, -- yashi
|
|