netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jakub Kicinski <jakub.kicinski@netronome.com>
To: Jiong Wang <jiong.wang@netronome.com>
Cc: Alexei Starovoitov <alexei.starovoitov@gmail.com>,
	daniel@iogearbox.net, bpf@vger.kernel.org,
	netdev@vger.kernel.org, oss-drivers@netronome.com
Subject: Re: [oss-drivers] Re: [PATCH/RFC v2 bpf-next 05/19] bpf: split read liveness into REG_LIVE_READ64 and REG_LIVE_READ32
Date: Thu, 11 Apr 2019 09:44:56 -0700	[thread overview]
Message-ID: <20190411094456.1fabc52d@cakuba.netronome.com> (raw)
In-Reply-To: <3A9F4205-577C-4E64-8400-0D476F08459E@netronome.com>

On Thu, 11 Apr 2019 07:13:03 +0100, Jiong Wang wrote:
> >> @@ -1150,17 +1150,17 @@ static int mark_reg_read(struct bpf_verifier_env *env,
> >> 				parent->var_off.value, parent->off);
> >> 			return -EFAULT;
> >> 		}
> >> -		if (parent->live & REG_LIVE_READ)
> >> +		if ((parent->live & REG_LIVE_READ) == flags)
> >> 			/* The parentage chain never changes and
> >> -			 * this parent was already marked as LIVE_READ.
> >> +			 * this parent was already marked with all read bits.  
> > 
> > Do we have to propagate all read bits?  Read64 is strictly stronger
> > than read32, as long as read64 is set on the parent we should be good?  
> 
> We should be good, but I doubt there is value to differentiate on this in this
> kind of HOT function.

The entire if clause is an optimization.  I'm saying you can maintain it
as more aggressive.

> >> @@ -6196,12 +6286,19 @@ static int propagate_liveness_reg(struct bpf_verifier_env *env,
> >> 				  struct bpf_reg_state *reg,
> >> 				  struct bpf_reg_state *parent_reg)
> >> {
> >> +	u8 parent_bits = parent_reg->live & REG_LIVE_READ;
> >> +	u8 bits = reg->live & REG_LIVE_READ;
> >> +	u8 bits_diff = parent_bits ^ bits;
> >> +	u8 bits_prop = bits_diff & bits;
> >> 	int err;
> >> 
> >> -	if (parent_reg->live & REG_LIVE_READ || !(reg->live & REG_LIVE_READ))
> >> +	/* "reg" and "parent_reg" has the same read bits, or the bit doesn't
> >> +	 * belong to "reg".
> >> +	 */
> >> +	if (!bits_diff || !bits_prop)  
> > 
> > bits_prop is a subset of bits_diff, no?  !bits_prop is always true
> > if !bits_diff is true, no need to check both.  
> 
> Bits_prop is a subset of bits_diff WHEN it comes from “reg", we don’t want to
> do the propagation when the diff comes from “parent_reg”, so, we need to check
> both.

Not sure what you're saying, in this patch:

	u8 bits_prop = bits_diff & bits;

Maybe you're talking about some patch down the line..

  reply	other threads:[~2019-04-11 16:45 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-10 19:50 [PATCH/RFC v2 bpf-next 00/19] bpf: eliminate zero extensions for sub-register writes Jiong Wang
2019-04-10 19:50 ` [PATCH/RFC v2 bpf-next 01/19] bpf: refactor propagate_liveness to eliminate duplicated for loop Jiong Wang
2019-04-10 19:50 ` [PATCH/RFC v2 bpf-next 02/19] bpf: refactor propagate_liveness to eliminate code redundance Jiong Wang
2019-04-11  2:39   ` [oss-drivers] " Jakub Kicinski
2019-04-10 19:50 ` [PATCH/RFC v2 bpf-next 03/19] bpf: factor out reg and stack slot propagation into "propagate_liveness_reg" Jiong Wang
2019-04-11  2:39   ` [oss-drivers] " Jakub Kicinski
2019-04-10 19:50 ` [PATCH/RFC v2 bpf-next 04/19] bpf: refactor "check_reg_arg" to eliminate code redundancy Jiong Wang
2019-04-11  2:40   ` Jakub Kicinski
2019-04-10 19:50 ` [PATCH/RFC v2 bpf-next 05/19] bpf: split read liveness into REG_LIVE_READ64 and REG_LIVE_READ32 Jiong Wang
2019-04-11  2:52   ` Jakub Kicinski
2019-04-11  6:13     ` Jiong Wang
2019-04-11 16:44       ` Jakub Kicinski [this message]
2019-04-11 16:53         ` [oss-drivers] " Jiong Wang
2019-04-12 16:14           ` Jiong Wang
2019-04-11 17:22         ` Jiong Wang
2019-04-10 19:50 ` [PATCH/RFC v2 bpf-next 06/19] bpf: mark lo32 writes that should be zero extended into hi32 Jiong Wang
2019-04-11  3:13   ` Jakub Kicinski
2019-04-11  6:02     ` Jiong Wang
2019-04-10 19:50 ` [PATCH/RFC v2 bpf-next 07/19] bpf: reduce false alarm by refining helper call arg types Jiong Wang
2019-04-10 19:50 ` [PATCH/RFC v2 bpf-next 08/19] bpf: insert explicit zero extension insn when hardware doesn't do it implicitly Jiong Wang
2019-04-10 19:50 ` [PATCH/RFC v2 bpf-next 09/19] bpf: introduce new bpf prog load flags "BPF_F_TEST_RND_HI32" Jiong Wang
2019-04-10 19:50 ` [PATCH/RFC v2 bpf-next 10/19] bpf: randomize high 32-bit when BPF_F_TEST_RND_HI32 is set Jiong Wang
2019-04-10 19:50 ` [PATCH/RFC v2 bpf-next 11/19] libbpf: new global variable "libbpf_test_mode" Jiong Wang
2019-04-11  3:19   ` Jakub Kicinski
2019-04-11 14:32     ` Jiong Wang
2019-04-11 21:49       ` Jiong Wang
2019-04-12 22:08         ` Jiong Wang
2019-04-10 19:50 ` [PATCH/RFC v2 bpf-next 12/19] selftests: enable hi32 randomization for "test_progs" and "test_verifier" Jiong Wang
2019-04-10 19:50 ` [PATCH/RFC v2 bpf-next 13/19] arm: bpf: eliminate zero extension code-gen Jiong Wang
2019-04-10 19:50 ` [PATCH/RFC v2 bpf-next 14/19] powerpc: " Jiong Wang
2019-04-10 19:50 ` [PATCH/RFC v2 bpf-next 15/19] s390: " Jiong Wang
2019-04-10 19:50 ` [PATCH/RFC v2 bpf-next 16/19] sparc: " Jiong Wang
2019-04-10 19:50 ` [PATCH/RFC v2 bpf-next 17/19] x32: " Jiong Wang
2019-04-10 19:50 ` [PATCH/RFC v2 bpf-next 18/19] riscv: " Jiong Wang
2019-04-10 19:50 ` [PATCH/RFC v2 bpf-next 19/19] nfp: " Jiong Wang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190411094456.1fabc52d@cakuba.netronome.com \
    --to=jakub.kicinski@netronome.com \
    --cc=alexei.starovoitov@gmail.com \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=jiong.wang@netronome.com \
    --cc=netdev@vger.kernel.org \
    --cc=oss-drivers@netronome.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).