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

[PATCH v2] Fix PPC64le cache line issues #692

Closed
wants to merge 3 commits into from

Conversation

lumag
Copy link

@lumag lumag commented Sep 4, 2018

No description provided.

Dmitry Eremin-Solenikov added 2 commits September 4, 2018 09:56
POWER8 has 128-byte cache lines

Signed-off-by: Dmitry Eremin-Solenikov <dmitry.ereminsolenikov@linaro.org>
POWER8 has 128-byte cache lines

Signed-off-by: Dmitry Eremin-Solenikov <dmitry.ereminsolenikov@linaro.org>
@muvarov muvarov changed the title Fix PPC64le cache line issues [PATCH v1] Fix PPC64le cache line issues Sep 4, 2018
Signed-off-by: Dmitry Eremin-Solenikov <dmitry.ereminsolenikov@linaro.org>
@muvarov muvarov changed the title [PATCH v1] Fix PPC64le cache line issues [PATCH v2] Fix PPC64le cache line issues Sep 4, 2018
Copy link
Contributor

@Bill-Fischofer-Linaro Bill-Fischofer-Linaro left a comment

Choose a reason for hiding this comment

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

Small comment but otherwise looks reasonable.

@@ -53,6 +53,8 @@ struct pktio_if_ops;

#if defined(ODP_NETMAP)
#define PKTIO_PRIVATE_SIZE 74752
#elif defined(ODP_PKTIO_DPDK) && ODP_CACHE_LINE_SIZE == 128
#define PKTIO_PRIVATE_SIZE 10240
#elif defined(ODP_PKTIO_DPDK)
#define PKTIO_PRIVATE_SIZE 5632
Copy link
Contributor

Choose a reason for hiding this comment

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

Would this be better as simply a standard multiple of ODP_CACHE_LINE_SIZE? Previous code assuming cache line size of 64 bytes is 88 lines, while you're setting it to 80 lines for 128 byte cache lines. These numbers seem arbitrary anyway.

Copy link
Author

Choose a reason for hiding this comment

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

It's a sizeof(struct) aligned up, so it was hand-calculated.

Copy link
Contributor

Choose a reason for hiding this comment

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

Can we then use that sizeof() in the #define?

Copy link
Contributor

@muvarov muvarov Sep 5, 2018

Choose a reason for hiding this comment

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

maybe make unsigned char ODP_ALIGNED_CACHE pkt_priv[PKTIO_PRIVATE_SIZE]; dynamic rather then fixed len? Remove static assert from pkios and increase private date with realloc() if needed? All this ifdefs are very annoying.

Copy link
Author

Choose a reason for hiding this comment

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

@Bill-Fischofer-Linaro No, structs are private to drivers.
@muvarov I'd like to hear about realloc for shm-allocated memory.
Another approach might be to allocate pktio-private memory from per-pktio-type pool. However I can not predict impact on the performance.
@MatiasElo @psavol any ideas?

Copy link
Contributor

Choose a reason for hiding this comment

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

@lumag memory might be not shared for priv and it should work. 1) if pktio open in control thread then workers run - it's the same memory 2) with workers run and do pktio_open then they have per worker internal non share priv struct which will be cleared after close.

Copy link
Author

Choose a reason for hiding this comment

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

It looks like the only sane option is the per-pktio private data pool.

Copy link
Contributor

Choose a reason for hiding this comment

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

API does not forbid to call open several times for the same pool. odp_pktio_open("eth0", pool, NULL) and then odp_pktio_open("netmap:eth0", pool, NULL) or odp_pktio_open("tap0", pool, NULL). Not sure that I understand what "the per-pktio private data pool" means.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Changing DPDK pktio PKTIO_PRIVATE_SIZE to 10240 doesn't seem to have any performance impact, so the new ifdef branch seems quite unnecessary.

Copy link
Contributor

Choose a reason for hiding this comment

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

@MatiasElo only memory usage 10k instead of 5k multiply on ODP_CONFIG_PKTIO_ENTRIES

@lumag
Copy link
Author

lumag commented Sep 7, 2018 via email

@muvarov
Copy link
Contributor

muvarov commented Sep 7, 2018

@lumag yes, agree. pktio can have internal things which has to be common for all threads. Now I think that it's better to apply current PR as it fixes real issue. And we can polish memory usage later.

@muvarov
Copy link
Contributor

muvarov commented Sep 12, 2018

Merged.

@muvarov muvarov closed this Sep 12, 2018
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.

None yet

4 participants