Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates and clean-up cache management #502

Merged
merged 5 commits into from
Sep 18, 2023

Conversation

iuliana-prodan
Copy link
Contributor

@iuliana-prodan iuliana-prodan commented Jul 18, 2023

Please, check each commit.

cc: @arnopo @carlocaione @TanmayShah-xilinx

Copy link
Collaborator

@carlocaione carlocaione left a comment

Choose a reason for hiding this comment

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

Instead of having different macros with different names doing the same thing can we have one single set of macros for flushing and invalidating?

lib/include/openamp/virtqueue.h Outdated Show resolved Hide resolved
@iuliana-prodan
Copy link
Contributor Author

Instead of having different macros with different names doing the same thing can we have one single set of macros for flushing and invalidating?

I totally agree, but TBH I don't know where to add them - in which header so it can be accessed by all?

@carlocaione
Copy link
Collaborator

I totally agree, but TBH I don't know where to add them - in which header so it can be accessed by all?

IMO if you cannot find a proper header for that just add a new one.

@iuliana-prodan
Copy link
Contributor Author

I totally agree, but TBH I don't know where to add them - in which header so it can be accessed by all?

IMO if you cannot find a proper header for that just add a new one.

ok, I'll look again. Thanks!

@iuliana-prodan
Copy link
Contributor Author

I totally agree, but TBH I don't know where to add them - in which header so it can be accessed by all?

IMO if you cannot find a proper header for that just add a new one.

I've add a new commit to fix this: 731e394

@arnopo arnopo requested review from edmooring, arnopo and tnmysh July 18, 2023 16:48
README.md Outdated Show resolved Hide resolved
README.md Show resolved Hide resolved
lib/include/openamp/virtqueue.h Outdated Show resolved Hide resolved
@iuliana-prodan iuliana-prodan force-pushed the updates-and-clean-up branch 3 times, most recently from b8d6ec3 to 9293a0b Compare July 24, 2023 10:49
Copy link
Collaborator

@carlocaione carlocaione left a comment

Choose a reason for hiding this comment

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

I'm in general ok with this change but we must discuss whether we actually want to have a general VIRTIO_USE_CACHE switch or we want to have a more fine grained control over buffers placement.

option (WITH_DCACHE "Build with all cache operations enabled" OFF)

if (WITH_DCACHE)
add_definitions(-DVIRTIO_USE_CACHE)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
add_definitions(-DVIRTIO_USE_CACHE)
add_definitions(-DVIRTIO_USE_DCACHE)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done. Thanks!

@iuliana-prodan
Copy link
Contributor Author

I'm in general ok with this change but we must discuss whether we actually want to have a general VIRTIO_USE_CACHE switch or we want to have a more fine grained control over buffers placement.

IMO we should keep all 3, but see here: #502 (comment)
Also, in Zephyr we enable all 3 together with CONFIG_OPENAMP_WITH_DCACHE (https://github.com/zephyrproject-rtos/open-amp/blob/master/CMakeLists.txt#L20), not 1 by 1, so adding 1 for all seems reasonable.

#define RSC_TABLE_INVALIDATE(x, s) metal_cache_invalidate(x, s)
#warning "VIRTIO_CACHED_RSC_TABLE is deprecated, please use VIRTIO_USE_CACHE"
#endif
#if defined(VIRTIO_CACHED_RSC_TABLE) || defined(VIRTIO_USE_CACHE)
Copy link
Collaborator

Choose a reason for hiding this comment

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

you update VIRTIO_USE_CACHE to VIRTIO_USE_DCACHE in option.cmake but not in the source files

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You're right. Thanks!
I fixed it!

@arnopo
Copy link
Collaborator

arnopo commented Aug 16, 2023

I'm in general ok with this change but we must discuss whether we actually want to have a general VIRTIO_USE_CACHE switch or we want to have a more fine grained control over buffers placement.

IMO we should keep all 3, but see here: #502 (comment) Also, in Zephyr we enable all 3 together with CONFIG_OPENAMP_WITH_DCACHE (https://github.com/zephyrproject-rtos/open-amp/blob/master/CMakeLists.txt#L20), not 1 by 1, so adding 1 for all seems reasonable.

@carlocaione
As mentioned in #502 (comment)
my proposal is:

One strategy would consists in making VIRTIO_CACHED_VRINGS, DVIRTIO_CACHED_BUFFERS and VIRTIO_CACHED_RSC_TABLE
deprecated. If nobody complains during 2 years we will clean them.

@xiaoxiang781216 :
Do you use cache management? If so, do you require fine control, or is one generic compilation configuration sufficent for your needs?

@arnopo arnopo self-requested a review August 17, 2023 07:28
@arnopo
Copy link
Collaborator

arnopo commented Sep 7, 2023

@carlocaione @xiaoxiang781216 any comment/feedback on this PR?

@carlocaione
Copy link
Collaborator

@arnopo instead of deprecating WITH_DCACHE_VRINGS and WITH_DCACHE_BUFFERS why not simply leave those in place without deprecation and making WITH_DCACHE a more general switch implying the other two?

At least people could decide the lever of granularity to use.

@arnopo
Copy link
Collaborator

arnopo commented Sep 11, 2023

@arnopo instead of deprecating WITH_DCACHE_VRINGS and WITH_DCACHE_BUFFERS why not simply leave those in place without deprecation and making WITH_DCACHE a more general switch implying the other two?

At least people could decide the lever of granularity to use.

If possible, I would avoid multiplying the configs that complexify the support and increase the risk of bugs. Therefore, if no rational to keep them they should be removed.

Copy link
Collaborator

@carlocaione carlocaione left a comment

Choose a reason for hiding this comment

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

I don't have any real problem with this. @iuliana-prodan please update https://github.com/zephyrproject-rtos/open-amp/blob/master/CMakeLists.txt and the zephyr open-amp repo when this is merged.

Copy link
Collaborator

@arnopo arnopo left a comment

Choose a reason for hiding this comment

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

LGTM

@tnmysh
Copy link
Collaborator

tnmysh commented Sep 13, 2023

LGTM

@arnopo
Copy link
Collaborator

arnopo commented Sep 14, 2023

@iuliana-prodan
There is a merge conflict, could you rebase your patch on top of main branch please?

@iuliana-prodan
Copy link
Contributor Author

@iuliana-prodan There is a merge conflict, could you rebase your patch on top of main branch please?

Sure

@iuliana-prodan
Copy link
Contributor Author

Did the rebase and push the changes.
I see a build failure:

-- ZEPHYR_TOOLCHAIN_VARIANT not set, trying to locate Zephyr SDK
CMake Error at /github/workspace/zephyrproject/zephyr/cmake/modules/FindZephyr-sdk.cmake:109 (find_package):
  Could not find a configuration file for package "Zephyr-sdk" that is
  compatible with requested version "0.16".
-- Configuring incomplete, errors occurred!

  The following configuration files were considered but not accepted:

    /github/workspace/zephyr-sdk-0.15.0/cmake/Zephyr-sdkConfig.cmake, version: 0.15.0

It seems to me that is required zephyr-sdk 0.16 and the continuous integrations uses 0.15.

@arnopo is it possible to update the zephyr-sdk?
Can I do that?
How? :)

@arnopo
Copy link
Collaborator

arnopo commented Sep 14, 2023

Did the rebase and push the changes. I see a build failure:

-- ZEPHYR_TOOLCHAIN_VARIANT not set, trying to locate Zephyr SDK
CMake Error at /github/workspace/zephyrproject/zephyr/cmake/modules/FindZephyr-sdk.cmake:109 (find_package):
  Could not find a configuration file for package "Zephyr-sdk" that is
  compatible with requested version "0.16".
-- Configuring incomplete, errors occurred!

  The following configuration files were considered but not accepted:

    /github/workspace/zephyr-sdk-0.15.0/cmake/Zephyr-sdkConfig.cmake, version: 0.15.0

It seems to me that is required zephyr-sdk 0.16 and the continuous integrations uses 0.15.

@arnopo is it possible to update the zephyr-sdk? Can I do that? How? :)

The dsk version in the Ci need to be uopdated , I will do it

@arnopo
Copy link
Collaborator

arnopo commented Sep 14, 2023

Ci fixed in #504
Please, could you rebase another time ( sorry for the double work)

Fix typo for WITH_DCACHE_BUFFERS option.

Signed-off-by: Iuliana Prodan <[email protected]>
Move VRING_FLUSH and VRING_INVALIDATE defines to header file.

Signed-off-by: Iuliana Prodan <[email protected]>
Do buffers flush and invalidate the same as with vrings
and resource table:
- add defines in header file;
- call BUFFER_FLUSH/BUFFER_INVALIDATE where necessary.

Signed-off-by: Iuliana Prodan <[email protected]>
Since all cache operations, for vrings, buffer and
resource table are using metal_cache_flush and
metal_cache_invalidate, define a common function for all.

Signed-off-by: Iuliana Prodan <[email protected]>
Add WITH_DCACHE operation used for all cache operations:
vrings, buffers and resource table.
The other options will be deprecated - add warning
message for this.

Add info for WITH_DCACHE option in README.

Signed-off-by: Iuliana Prodan <[email protected]>
@iuliana-prodan
Copy link
Contributor Author

Ci fixed in #504 Please, could you rebase another time ( sorry for the double work)

Done.
All good now! :)

@arnopo arnopo changed the title Updates and clean-up Updates and clean-up cache management Sep 18, 2023
@arnopo arnopo merged commit f2162a6 into OpenAMP:main Sep 18, 2023
2 checks passed
@iuliana-prodan
Copy link
Contributor Author

I don't have any real problem with this. @iuliana-prodan please update https://github.com/zephyrproject-rtos/open-amp/blob/master/CMakeLists.txt and the zephyr open-amp repo when this is merged.

@carlocaione Sorry for not doing this earlier, but... here it is: zephyrproject-rtos/open-amp#17
I cannot add any reviewers or anything.

@arnopo arnopo added this to the Release V2023.10 milestone Oct 12, 2023
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.

5 participants