Re: [PATCH] ad7877: keep dma rx buffers in seperate cache lines

From: Mike Frysinger
Date: Thu May 06 2010 - 14:46:31 EST


On Thu, May 6, 2010 at 06:37, Oskar Schirmer wrote:
> Âstruct ser_req {
> + Â Â Â u16 Â Â Â Â Â Â Â Â Â Â sample;
> +    char          Â__padalign[L1_CACHE_BYTES - sizeof(u16)];
> +
> Â Â Â Âu16 Â Â Â Â Â Â Â Â Â Â reset;
> Â Â Â Âu16 Â Â Â Â Â Â Â Â Â Â ref_on;
> Â Â Â Âu16 Â Â Â Â Â Â Â Â Â Â command;
> - Â Â Â u16 Â Â Â Â Â Â Â Â Â Â sample;
>    Âstruct spi_message   Âmsg;
>    Âstruct spi_transfer   xfer[6];
> Â};

are you sure this is necessary ? ser_req is only ever used with
spi_sync() and it's allocated/released on the fly, so how could
anything be reading that memory between the start of the transmission
and the return to adi7877 ?

> Âstruct ad7877 {
> + Â Â Â u16 Â Â Â Â Â Â Â Â Â Â conversion_data[AD7877_NR_SENSE];
> +    char          Â__padalign[L1_CACHE_BYTES
> + Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â - AD7877_NR_SENSE * sizeof(u16)];
> +
>    Âstruct input_dev    Â*input;
>    Âchar          Âphys[32];
>
> @@ -182,8 +188,6 @@ struct ad7877 {
> Â Â Â Âu8 Â Â Â Â Â Â Â Â Â Â Âaveraging;
> Â Â Â Âu8 Â Â Â Â Â Â Â Â Â Â Âpen_down_acc_interval;
>
> - Â Â Â u16 Â Â Â Â Â Â Â Â Â Â conversion_data[AD7877_NR_SENSE];
> -
>    Âstruct spi_transfer   xfer[AD7877_NR_SENSE + 2];
>    Âstruct spi_message   Âmsg;

i can see the spi_message inside of this struct being a problem
because the spi transfer is doing asynchronously with spi_async().
however, i would add a comment right above these two fields with a
short explanation as to why they're at the start and why the pad
exists so someone down the line doesnt move it.
-mike
¢éì®&Þ~º&¶¬–+-±éÝ¥Šw®žË±Êâmébžìdz¹Þ)í…æèw*jg¬±¨¶‰šŽŠÝj/êäz¹ÞŠà2ŠÞ¨è­Ú&¢)ß«a¶Úþø®G«éh®æj:+v‰¨Šwè†Ù>Wš±êÞiÛaxPjØm¶Ÿÿà -»+ƒùdš_