public inbox for linuxppc-dev@ozlabs.org 
 help / color / mirror / Atom feed
From: Daniel Axtens <dja@axtens•net>
To: Matt Brown <matthew.brown.dev@gmail•com>, linuxppc-dev@lists•ozlabs.org
Subject: Re: [v5 2/2] raid6/altivec: Add vpermxor implementation for raid6 Q syndrome
Date: Wed, 02 Aug 2017 09:01:26 +1000	[thread overview]
Message-ID: <878tj2sxix.fsf@linkitivity.dja.id.au> (raw)
In-Reply-To: <20170428055809.2675-2-matthew.brown.dev@gmail.com>

Hi Matt,

> The raid6 Q syndrome check has been optimised using the vpermxor
> instruction.

Very much a nit, but normally we'd write the change that the patch makes
as a command: "Optimise the raid6 Q syndrome generation using the
vpermxor instruction" - see
https://www.kernel.org/doc/html/v4.11/process/submitting-patches.html#describe-your-changes

> +static void noinline raid6_vpermxor$#_gen_syndrome_real(int disks, size_t bytes,
> +							void **ptrs)
> +{
> +	u8 **dptr = (u8 **)ptrs;
> +	u8 *p, *q;
> +	int d, z, z0;
> +	unative_t wp$$, wq$$, wd$$;
> +
> +	z0 = disks - 3;		/* Highest data disk */
> +	p = dptr[z0+1];		/* XOR parity */
> +	q = dptr[z0+2];		/* RS syndrome */
> +
> +	for (d = 0; d < bytes; d += NSIZE*$#) {
> +		wp$$ = wq$$ = *(unative_t *)&dptr[z0][d+$$*NSIZE];
> +
> +		for (z = z0-1; z>=0; z--) {
> +			wd$$ = *(unative_t *)&dptr[z][d+$$*NSIZE];
> +			/* P syndrome */
> +			wp$$ = vec_xor(wp$$, wd$$);
> +
> +			/*Q syndrome */
> +			asm("vpermxor %0,%1,%2,%3":"=v"(wq$$):"v"(gf_high), "v"(gf_low), "v"(wq$$));

Initially I thought "why can't we break this over 2 lines?" and then I
remembered that the awk script can't handle that. A space between /* and
Q would be good though.

> +			wq$$ = vec_xor(wq$$, wd$$);

I generated some of the unrolled code and inspected it. It's non-trivial
to follow but that's justifiable, it's due to:
 - the complex maths
 - the unrolling process
 - consistency with the altivec code, which I think is worth keeping
I am not sure how you could make it any easier to read, so I don't think
that should block its acceptance into the kernel.

I am confident that this code works correctly and as described.

Reviewed-by: Daniel Axtens <dja@axtens•net>

Regards,
Daniel

> -- 
> 2.9.3

  reply	other threads:[~2017-08-01 23:01 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-28  5:58 [v5 1/2] lib/raid6: Build proper files on corresponding arch Matt Brown
2017-04-28  5:58 ` [v5 2/2] raid6/altivec: Add vpermxor implementation for raid6 Q syndrome Matt Brown
2017-08-01 23:01   ` Daniel Axtens [this message]
2017-08-02  2:04     ` Michael Ellerman
2017-08-02  0:20   ` Daniel Axtens
2017-08-04  1:40     ` Matt Brown
2017-08-01 22:27 ` [v5 1/2] lib/raid6: Build proper files on corresponding arch Daniel Axtens
2017-08-02  2:00   ` Michael Ellerman
2017-08-04  1:33     ` Matt Brown

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=878tj2sxix.fsf@linkitivity.dja.id.au \
    --to=dja@axtens$(echo .)net \
    --cc=linuxppc-dev@lists$(echo .)ozlabs.org \
    --cc=matthew.brown.dev@gmail$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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