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

Regarding Manual cache management with the CPU cache still being enabled #76

Open
balaji-ch opened this issue Apr 25, 2021 · 3 comments

Comments

@balaji-ch
Copy link

Do we need to call
fd = open("/sys/class/u-dma-buf/udmabuf0/sync_for_device", O_WRONLY)) != -1)
once before mmap ? or any special care need to be taken for manual cache management ?

@ikwzm
Copy link
Owner

ikwzm commented Apr 25, 2021

Thank you for the issue.

Do we need to call
fd = open("/sys/class/u-dma-buf/udmabuf0/sync_for_device", O_WRONLY)) != -1)
once before mmap ?

there is no need.
It's the same whether you open the file before mmap() or after mmap().

or any special care need to be taken for manual cache management ?

Knowledge of general CPU Cache and Linux Kernel is required.

@balaji-ch
Copy link
Author

But here in this example
https://github.com/ikwzm/ZynqMP-FPGA-Linux-Example-2-UltraZed/blob/master/negative.py
udmabuf4.sync_for_device()
udmabuf5.sync_for_device()
is called in the for loop ?

@ikwzm
Copy link
Owner

ikwzm commented Apr 26, 2021

In this example, sync_for_device()/sync_for_cpu() is inside the loop because it runs multiple times to calculate the average time it takes to process it.

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

No branches or pull requests

2 participants