Coder Social home page Coder Social logo

Comments (9)

eggqq007 avatar eggqq007 commented on June 16, 2024

Upload the llvm-objdump -S -no-show-raw-insn xdp_test.o files:

xdp_test_smallstack.txt
xdp_test_bigstack.txt

from p4c-xdp.

eggqq007 avatar eggqq007 commented on June 16, 2024

ping......

from p4c-xdp.

mihaibudiu avatar mihaibudiu commented on June 16, 2024

I don't know if there is much we can say about this; we do not have any control on how clang generates code.

from p4c-xdp.

eggqq007 avatar eggqq007 commented on June 16, 2024

OK....I found a workaround.
I rewrite some logical in ControlBodyTranslator::compileEmitField to consume memcpy, and eliminate the write_byte. It helps reduce the stack from about 350 to 128byte. And performance is better also.

I also rewrite some logical in ControlBodyTranslator::preorder to help to judge if we should rewrite re-populate a header.

And also fix the issue that using if-else in control.("if" emit a useless ";" in if-else statement which cause compile error)

I found the counter only support 32bit which is too small, so increase it from 32bit to 64bit if using counterArray which type is hash.

from p4c-xdp.

eggqq007 avatar eggqq007 commented on June 16, 2024

introducing 64bit counter: 2.7Mpps -->2.5Mpps
using memcpy and eliminating write_byte & avoid re-populate packet's header: 2.5Mpps --> 2.8Mpps

from p4c-xdp.

mihaibudiu avatar mihaibudiu commented on June 16, 2024

Do you plan to contribute these changes to our code?

from p4c-xdp.

eggqq007 avatar eggqq007 commented on June 16, 2024

It is draft code and I am afraid I don't have enough time to make it become a accepted patch recently.
I will upload my draft code diff first in case someone need it.

from p4c-xdp.

williamtu avatar williamtu commented on June 16, 2024

if you're allowed to change kernel, then you can increase MAX_BPF_STACK to a little larger value.

from p4c-xdp.

eggqq007 avatar eggqq007 commented on June 16, 2024

Not only the linux stack size, the llvm-6 and llvm-7 would hit error in compiling if the stack size above 512bytes...

from p4c-xdp.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.