* [Xenomai] imx28 rtcan flexcan system freezes @ 2014-01-22 10:24 Alexandre COFFIGNAL 2014-01-22 11:23 ` Gilles Chanteperdrix 0 siblings, 1 reply; 27+ messages in thread From: Alexandre COFFIGNAL @ 2014-01-22 10:24 UTC (permalink / raw) To: xenomai Hi all, I use two rtcan flexcan on imx28-evk board. If both rtcan devices receive a data at the same time, this cause a freeze. After investigation, i found that if I replace in flexcan_rx_interrupt these instructions : - *(__be32 *)(cf->data + 0) = - cpu_to_be32(flexcan_read(&mb->data[0])); - *(__be32 *)(cf->data + 4) = - cpu_to_be32(flexcan_read(&mb->data[1])); by these + data0 = flexcan_read(&mb->data[0]); + data1 = flexcan_read(&mb->data[1]); + + cf->data[3]=((data0 >> 0) & 0xFF) ; + cf->data[2]=((data0 >> 8) & 0xFF) ; + cf->data[1]=((data0 >> 16) & 0xFF) ; + cf->data[0]=((data0 >> 24) & 0xFF) ; + cf->data[7]=((data1 >> 0) & 0xFF) ; + cf->data[6]=((data1 >> 8) & 0xFF) ; + cf->data[5]=((data1 >> 16) & 0xFF) ; + cf->data[4]=((data1 >> 24) & 0xFF) ; rtcan flexcan works perfectly. is anyone know what is the problem with first instructions ? My config : xenomai 2.6.3, linux 3.8.13, ^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [Xenomai] imx28 rtcan flexcan system freezes 2014-01-22 10:24 [Xenomai] imx28 rtcan flexcan system freezes Alexandre COFFIGNAL @ 2014-01-22 11:23 ` Gilles Chanteperdrix 2014-01-22 11:36 ` Alexandre COFFIGNAL 0 siblings, 1 reply; 27+ messages in thread From: Gilles Chanteperdrix @ 2014-01-22 11:23 UTC (permalink / raw) To: Alexandre COFFIGNAL; +Cc: xenomai On 01/22/2014 11:24 AM, Alexandre COFFIGNAL wrote: > Hi all, > > I use two rtcan flexcan on imx28-evk board. > > If both rtcan devices receive a data at the same time, this cause a freeze. > After investigation, i found that if I replace in flexcan_rx_interrupt > these instructions : > - *(__be32 *)(cf->data + 0) = > - cpu_to_be32(flexcan_read(&mb->data[0])); > - *(__be32 *)(cf->data + 4) = > - cpu_to_be32(flexcan_read(&mb->data[1])); > > by these > > + data0 = flexcan_read(&mb->data[0]); > + data1 = flexcan_read(&mb->data[1]); > + > + cf->data[3]=((data0 >> 0) & 0xFF) ; > + cf->data[2]=((data0 >> 8) & 0xFF) ; > + cf->data[1]=((data0 >> 16) & 0xFF) ; > + cf->data[0]=((data0 >> 24) & 0xFF) ; > + cf->data[7]=((data1 >> 0) & 0xFF) ; > + cf->data[6]=((data1 >> 8) & 0xFF) ; > + cf->data[5]=((data1 >> 16) & 0xFF) ; > + cf->data[4]=((data1 >> 24) & 0xFF) ; > > rtcan flexcan works perfectly. > is anyone know what is the problem with first instructions ? Probably mb->data does not have the right alignment. Could you not arrange to get it properly aligned? Failing that, you should use put_unaligned instead of open coding it. -- Gilles. ^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [Xenomai] imx28 rtcan flexcan system freezes 2014-01-22 11:23 ` Gilles Chanteperdrix @ 2014-01-22 11:36 ` Alexandre COFFIGNAL 2014-01-22 12:00 ` Gilles Chanteperdrix 0 siblings, 1 reply; 27+ messages in thread From: Alexandre COFFIGNAL @ 2014-01-22 11:36 UTC (permalink / raw) To: Gilles Chanteperdrix; +Cc: xenomai Le 22/01/2014 12:23, Gilles Chanteperdrix a écrit : > On 01/22/2014 11:24 AM, Alexandre COFFIGNAL wrote: >> Hi all, >> >> I use two rtcan flexcan on imx28-evk board. >> >> If both rtcan devices receive a data at the same time, this cause a freeze. >> After investigation, i found that if I replace in flexcan_rx_interrupt >> these instructions : >> - *(__be32 *)(cf->data + 0) = >> - cpu_to_be32(flexcan_read(&mb->data[0])); >> - *(__be32 *)(cf->data + 4) = >> - cpu_to_be32(flexcan_read(&mb->data[1])); >> >> by these >> >> + data0 = flexcan_read(&mb->data[0]); >> + data1 = flexcan_read(&mb->data[1]); >> + >> + cf->data[3]=((data0 >> 0) & 0xFF) ; >> + cf->data[2]=((data0 >> 8) & 0xFF) ; >> + cf->data[1]=((data0 >> 16) & 0xFF) ; >> + cf->data[0]=((data0 >> 24) & 0xFF) ; >> + cf->data[7]=((data1 >> 0) & 0xFF) ; >> + cf->data[6]=((data1 >> 8) & 0xFF) ; >> + cf->data[5]=((data1 >> 16) & 0xFF) ; >> + cf->data[4]=((data1 >> 24) & 0xFF) ; >> >> rtcan flexcan works perfectly. >> is anyone know what is the problem with first instructions ? > Probably mb->data does not have the right alignment. Could you not > arrange to get it properly aligned? Failing that, you should use > put_unaligned instead of open coding it. > > here structures used in flexcan driver, it seem to be aligned /* Structure of the message buffer */ struct flexcan_mb { u32 can_ctrl; u32 can_id; u32 data[2]; }; /* Structure of the hardware registers */ struct flexcan_regs { u32 mcr; /* 0x00 */ u32 ctrl; /* 0x04 */ u32 timer; /* 0x08 */ u32 _reserved1; /* 0x0c */ u32 rxgmask; /* 0x10 */ u32 rx14mask; /* 0x14 */ u32 rx15mask; /* 0x18 */ u32 ecr; /* 0x1c */ u32 esr; /* 0x20 */ u32 imask2; /* 0x24 */ u32 imask1; /* 0x28 */ u32 iflag2; /* 0x2c */ u32 iflag1; /* 0x30 */ u32 crl2; /* 0x34 */ u32 esr2; /* 0x38 */ u32 _reserved2[2]; u32 crcr; /* 0x44 */ u32 rxfgmask; /* 0x48 */ u32 rxfir; /* 0x4c */ u32 _reserved3[12]; struct flexcan_mb cantxfg[64]; }; ^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [Xenomai] imx28 rtcan flexcan system freezes 2014-01-22 11:36 ` Alexandre COFFIGNAL @ 2014-01-22 12:00 ` Gilles Chanteperdrix 2014-01-22 13:27 ` Alexandre COFFIGNAL 0 siblings, 1 reply; 27+ messages in thread From: Gilles Chanteperdrix @ 2014-01-22 12:00 UTC (permalink / raw) To: Alexandre COFFIGNAL; +Cc: xenomai On 01/22/2014 12:36 PM, Alexandre COFFIGNAL wrote: >>> + cf->data[3]=((data0 >> 0) & 0xFF) ; >>> + cf->data[2]=((data0 >> 8) & 0xFF) ; >>> + cf->data[1]=((data0 >> 16) & 0xFF) ; >>> + cf->data[0]=((data0 >> 24) & 0xFF) ; >>> + cf->data[7]=((data1 >> 0) & 0xFF) ; >>> + cf->data[6]=((data1 >> 8) & 0xFF) ; >>> + cf->data[5]=((data1 >> 16) & 0xFF) ; >>> + cf->data[4]=((data1 >> 24) & 0xFF) ; >>> >>> rtcan flexcan works perfectly. >>> is anyone know what is the problem with first instructions ? >> Probably mb->data does not have the right alignment. Could you not >> arrange to get it properly aligned? Failing that, you should use >> put_unaligned instead of open coding it. >> >> > here structures used in flexcan driver, it seem to be aligned I am talking about the alignment of cf->data, since obviously, that is the one which is causing problems. -- Gilles. ^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [Xenomai] imx28 rtcan flexcan system freezes 2014-01-22 12:00 ` Gilles Chanteperdrix @ 2014-01-22 13:27 ` Alexandre COFFIGNAL 2014-01-22 13:30 ` Gilles Chanteperdrix 0 siblings, 1 reply; 27+ messages in thread From: Alexandre COFFIGNAL @ 2014-01-22 13:27 UTC (permalink / raw) Cc: xenomai Le 22/01/2014 13:00, Gilles Chanteperdrix a écrit : > On 01/22/2014 12:36 PM, Alexandre COFFIGNAL wrote: >>>> + cf->data[3]=((data0 >> 0) & 0xFF) ; >>>> + cf->data[2]=((data0 >> 8) & 0xFF) ; >>>> + cf->data[1]=((data0 >> 16) & 0xFF) ; >>>> + cf->data[0]=((data0 >> 24) & 0xFF) ; >>>> + cf->data[7]=((data1 >> 0) & 0xFF) ; >>>> + cf->data[6]=((data1 >> 8) & 0xFF) ; >>>> + cf->data[5]=((data1 >> 16) & 0xFF) ; >>>> + cf->data[4]=((data1 >> 24) & 0xFF) ; >>>> >>>> rtcan flexcan works perfectly. >>>> is anyone know what is the problem with first instructions ? >>> Probably mb->data does not have the right alignment. Could you not >>> arrange to get it properly aligned? Failing that, you should use >>> put_unaligned instead of open coding it. >>> >>> >> here structures used in flexcan driver, it seem to be aligned > > I am talking about the alignment of cf->data, since obviously, that is > the one which is causing problems. > > Thank a lot, put_unaligned fix this issue if you want, i can send a path -- ^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [Xenomai] imx28 rtcan flexcan system freezes 2014-01-22 13:27 ` Alexandre COFFIGNAL @ 2014-01-22 13:30 ` Gilles Chanteperdrix 2014-01-22 14:04 ` Alexandre COFFIGNAL 0 siblings, 1 reply; 27+ messages in thread From: Gilles Chanteperdrix @ 2014-01-22 13:30 UTC (permalink / raw) To: Alexandre COFFIGNAL; +Cc: xenomai On 01/22/2014 02:27 PM, Alexandre COFFIGNAL wrote: > > Le 22/01/2014 13:00, Gilles Chanteperdrix a écrit : >> On 01/22/2014 12:36 PM, Alexandre COFFIGNAL wrote: >>>>> + cf->data[3]=((data0 >> 0) & 0xFF) ; >>>>> + cf->data[2]=((data0 >> 8) & 0xFF) ; >>>>> + cf->data[1]=((data0 >> 16) & 0xFF) ; >>>>> + cf->data[0]=((data0 >> 24) & 0xFF) ; >>>>> + cf->data[7]=((data1 >> 0) & 0xFF) ; >>>>> + cf->data[6]=((data1 >> 8) & 0xFF) ; >>>>> + cf->data[5]=((data1 >> 16) & 0xFF) ; >>>>> + cf->data[4]=((data1 >> 24) & 0xFF) ; >>>>> >>>>> rtcan flexcan works perfectly. >>>>> is anyone know what is the problem with first instructions ? >>>> Probably mb->data does not have the right alignment. Could you not >>>> arrange to get it properly aligned? Failing that, you should use >>>> put_unaligned instead of open coding it. >>>> >>>> >>> here structures used in flexcan driver, it seem to be aligned >> >> I am talking about the alignment of cf->data, since obviously, that is >> the one which is causing problems. >> >> > Thank a lot, put_unaligned fix this issue if you want, i can send a path > The other solution (getting cf->data to be properly aligned) would be more efficient, why is not it possible to get cf->data properly aligned? -- Gilles. ^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [Xenomai] imx28 rtcan flexcan system freezes 2014-01-22 13:30 ` Gilles Chanteperdrix @ 2014-01-22 14:04 ` Alexandre COFFIGNAL 2014-01-22 14:12 ` Gilles Chanteperdrix 2014-01-23 19:48 ` Gilles Chanteperdrix 0 siblings, 2 replies; 27+ messages in thread From: Alexandre COFFIGNAL @ 2014-01-22 14:04 UTC (permalink / raw) Cc: xenomai Le 22/01/2014 14:30, Gilles Chanteperdrix a écrit : > On 01/22/2014 02:27 PM, Alexandre COFFIGNAL wrote: >> >> Le 22/01/2014 13:00, Gilles Chanteperdrix a écrit : >>> On 01/22/2014 12:36 PM, Alexandre COFFIGNAL wrote: >>>>>> + cf->data[3]=((data0 >> 0) & 0xFF) ; >>>>>> + cf->data[2]=((data0 >> 8) & 0xFF) ; >>>>>> + cf->data[1]=((data0 >> 16) & 0xFF) ; >>>>>> + cf->data[0]=((data0 >> 24) & 0xFF) ; >>>>>> + cf->data[7]=((data1 >> 0) & 0xFF) ; >>>>>> + cf->data[6]=((data1 >> 8) & 0xFF) ; >>>>>> + cf->data[5]=((data1 >> 16) & 0xFF) ; >>>>>> + cf->data[4]=((data1 >> 24) & 0xFF) ; >>>>>> >>>>>> rtcan flexcan works perfectly. >>>>>> is anyone know what is the problem with first instructions ? >>>>> Probably mb->data does not have the right alignment. Could you not >>>>> arrange to get it properly aligned? Failing that, you should use >>>>> put_unaligned instead of open coding it. >>>>> >>>>> >>>> here structures used in flexcan driver, it seem to be aligned >>> >>> I am talking about the alignment of cf->data, since obviously, that is >>> the one which is causing problems. >>> >>> >> Thank a lot, put_unaligned fix this issue if you want, i can send a path >> > > The other solution (getting cf->data to be properly aligned) would be > more efficient, why is not it possible to get cf->data properly aligned? > I think, i can't get cf->data to be properly aligned because "cf" is receive internal frame representation within the ring buffer of a struct rtcan_socket and struct rtcan_rb_frame is a generic structure used in all rtcan drivers . ^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [Xenomai] imx28 rtcan flexcan system freezes 2014-01-22 14:04 ` Alexandre COFFIGNAL @ 2014-01-22 14:12 ` Gilles Chanteperdrix 2014-01-23 10:04 ` Gilles Chanteperdrix 2014-01-26 19:26 ` Wolfgang Grandegger 2014-01-23 19:48 ` Gilles Chanteperdrix 1 sibling, 2 replies; 27+ messages in thread From: Gilles Chanteperdrix @ 2014-01-22 14:12 UTC (permalink / raw) To: Alexandre COFFIGNAL; +Cc: xenomai On 01/22/2014 03:04 PM, Alexandre COFFIGNAL wrote: > > Le 22/01/2014 14:30, Gilles Chanteperdrix a écrit : >> On 01/22/2014 02:27 PM, Alexandre COFFIGNAL wrote: >>> >>> Le 22/01/2014 13:00, Gilles Chanteperdrix a écrit : >>>> On 01/22/2014 12:36 PM, Alexandre COFFIGNAL wrote: >>>>>>> + cf->data[3]=((data0 >> 0) & 0xFF) ; >>>>>>> + cf->data[2]=((data0 >> 8) & 0xFF) ; >>>>>>> + cf->data[1]=((data0 >> 16) & 0xFF) ; >>>>>>> + cf->data[0]=((data0 >> 24) & 0xFF) ; >>>>>>> + cf->data[7]=((data1 >> 0) & 0xFF) ; >>>>>>> + cf->data[6]=((data1 >> 8) & 0xFF) ; >>>>>>> + cf->data[5]=((data1 >> 16) & 0xFF) ; >>>>>>> + cf->data[4]=((data1 >> 24) & 0xFF) ; >>>>>>> >>>>>>> rtcan flexcan works perfectly. >>>>>>> is anyone know what is the problem with first instructions ? >>>>>> Probably mb->data does not have the right alignment. Could you not >>>>>> arrange to get it properly aligned? Failing that, you should use >>>>>> put_unaligned instead of open coding it. >>>>>> >>>>>> >>>>> here structures used in flexcan driver, it seem to be aligned >>>> >>>> I am talking about the alignment of cf->data, since obviously, that is >>>> the one which is causing problems. >>>> >>>> >>> Thank a lot, put_unaligned fix this issue if you want, i can send a path >>> >> >> The other solution (getting cf->data to be properly aligned) would be >> more efficient, why is not it possible to get cf->data properly aligned? >> > I think, i can't get cf->data to be properly aligned because "cf" is > receive internal frame representation within the ring buffer > of a struct rtcan_socket and struct rtcan_rb_frame is a generic > structure used in all rtcan drivers . Well, if you fix rtcan_rb_frame to be aligned, it will be aligned for all drivers, so that looks like a worthwile improvement... -- Gilles. ^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [Xenomai] imx28 rtcan flexcan system freezes 2014-01-22 14:12 ` Gilles Chanteperdrix @ 2014-01-23 10:04 ` Gilles Chanteperdrix 2014-01-23 11:36 ` Wolfgang Grandegger 2014-01-26 19:26 ` Wolfgang Grandegger 1 sibling, 1 reply; 27+ messages in thread From: Gilles Chanteperdrix @ 2014-01-23 10:04 UTC (permalink / raw) To: Wolfgang Grandegger; +Cc: xenomai On 01/22/2014 03:12 PM, Gilles Chanteperdrix wrote: > On 01/22/2014 03:04 PM, Alexandre COFFIGNAL wrote: >> >> Le 22/01/2014 14:30, Gilles Chanteperdrix a écrit : >>> On 01/22/2014 02:27 PM, Alexandre COFFIGNAL wrote: >>>> >>>> Le 22/01/2014 13:00, Gilles Chanteperdrix a écrit : >>>>> On 01/22/2014 12:36 PM, Alexandre COFFIGNAL wrote: >>>>>>>> + cf->data[3]=((data0 >> 0) & 0xFF) ; >>>>>>>> + cf->data[2]=((data0 >> 8) & 0xFF) ; >>>>>>>> + cf->data[1]=((data0 >> 16) & 0xFF) ; >>>>>>>> + cf->data[0]=((data0 >> 24) & 0xFF) ; >>>>>>>> + cf->data[7]=((data1 >> 0) & 0xFF) ; >>>>>>>> + cf->data[6]=((data1 >> 8) & 0xFF) ; >>>>>>>> + cf->data[5]=((data1 >> 16) & 0xFF) ; >>>>>>>> + cf->data[4]=((data1 >> 24) & 0xFF) ; >>>>>>>> >>>>>>>> rtcan flexcan works perfectly. >>>>>>>> is anyone know what is the problem with first instructions ? >>>>>>> Probably mb->data does not have the right alignment. Could you not >>>>>>> arrange to get it properly aligned? Failing that, you should use >>>>>>> put_unaligned instead of open coding it. >>>>>>> >>>>>>> >>>>>> here structures used in flexcan driver, it seem to be aligned >>>>> >>>>> I am talking about the alignment of cf->data, since obviously, that is >>>>> the one which is causing problems. >>>>> >>>>> >>>> Thank a lot, put_unaligned fix this issue if you want, i can send a path >>>> >>> >>> The other solution (getting cf->data to be properly aligned) would be >>> more efficient, why is not it possible to get cf->data properly aligned? >>> >> I think, i can't get cf->data to be properly aligned because "cf" is >> receive internal frame representation within the ring buffer >> of a struct rtcan_socket and struct rtcan_rb_frame is a generic >> structure used in all rtcan drivers . > > Well, if you fix rtcan_rb_frame to be aligned, it will be aligned for > all drivers, so that looks like a worthwile improvement... > > Wolfgang, what do you think? Should we change the alignment of rtcan_rb_frame::data, or use put_unaligned on ARM? -- Gilles. ^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [Xenomai] imx28 rtcan flexcan system freezes 2014-01-23 10:04 ` Gilles Chanteperdrix @ 2014-01-23 11:36 ` Wolfgang Grandegger 2014-01-23 12:05 ` Gilles Chanteperdrix 2014-01-23 12:54 ` Alexandre COFFIGNAL 0 siblings, 2 replies; 27+ messages in thread From: Wolfgang Grandegger @ 2014-01-23 11:36 UTC (permalink / raw) To: Gilles Chanteperdrix; +Cc: Wolfgang Grandegger, xenomai Hi Gilles, On Thu, 23 Jan 2014 11:04:44 +0100, Gilles Chanteperdrix <gilles.chanteperdrix@xenomai.org> wrote: > On 01/22/2014 03:12 PM, Gilles Chanteperdrix wrote: >> On 01/22/2014 03:04 PM, Alexandre COFFIGNAL wrote: >>> >>> Le 22/01/2014 14:30, Gilles Chanteperdrix a écrit : >>>> On 01/22/2014 02:27 PM, Alexandre COFFIGNAL wrote: >>>>> >>>>> Le 22/01/2014 13:00, Gilles Chanteperdrix a écrit : >>>>>> On 01/22/2014 12:36 PM, Alexandre COFFIGNAL wrote: >>>>>>>>> + cf->data[3]=((data0 >> 0) & 0xFF) ; >>>>>>>>> + cf->data[2]=((data0 >> 8) & 0xFF) ; >>>>>>>>> + cf->data[1]=((data0 >> 16) & 0xFF) ; >>>>>>>>> + cf->data[0]=((data0 >> 24) & 0xFF) ; >>>>>>>>> + cf->data[7]=((data1 >> 0) & 0xFF) ; >>>>>>>>> + cf->data[6]=((data1 >> 8) & 0xFF) ; >>>>>>>>> + cf->data[5]=((data1 >> 16) & 0xFF) ; >>>>>>>>> + cf->data[4]=((data1 >> 24) & 0xFF) ; >>>>>>>>> >>>>>>>>> rtcan flexcan works perfectly. >>>>>>>>> is anyone know what is the problem with first instructions ? >>>>>>>> Probably mb->data does not have the right alignment. Could you not >>>>>>>> arrange to get it properly aligned? Failing that, you should use >>>>>>>> put_unaligned instead of open coding it. How are unaligned accesses handled on your system? Alexandre, what does "cat /proc/cpu/alignment" report? Aligned access would be better, I agree. >>>>>>>> >>>>>>>> >>>>>>> here structures used in flexcan driver, it seem to be aligned >>>>>> >>>>>> I am talking about the alignment of cf->data, since obviously, that >>>>>> is >>>>>> the one which is causing problems. >>>>>> >>>>>> >>>>> Thank a lot, put_unaligned fix this issue if you want, i can send a >>>>> path >>>>> >>>> >>>> The other solution (getting cf->data to be properly aligned) would be >>>> more efficient, why is not it possible to get cf->data properly >>>> aligned? >>>> >>> I think, i can't get cf->data to be properly aligned because "cf" is >>> receive internal frame representation within the ring buffer >>> of a struct rtcan_socket and struct rtcan_rb_frame is a generic >>> structure used in all rtcan drivers . >> >> Well, if you fix rtcan_rb_frame to be aligned, it will be aligned for >> all drivers, so that looks like a worthwile improvement... >> >> > > Wolfgang, what do you think? Should we change the alignment of > rtcan_rb_frame::data, or use put_unaligned on ARM? I realized the mail and wonder why this problem does not show up with vanilla Linux. Maybe we need to port over some patch from there. I will have a closer look this even or over the weekend. Wolfgang. ^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [Xenomai] imx28 rtcan flexcan system freezes 2014-01-23 11:36 ` Wolfgang Grandegger @ 2014-01-23 12:05 ` Gilles Chanteperdrix 2014-01-23 12:21 ` Wolfgang Grandegger 2014-01-23 13:07 ` Gilles Chanteperdrix 2014-01-23 12:54 ` Alexandre COFFIGNAL 1 sibling, 2 replies; 27+ messages in thread From: Gilles Chanteperdrix @ 2014-01-23 12:05 UTC (permalink / raw) To: Wolfgang Grandegger; +Cc: Wolfgang Grandegger, xenomai On 01/23/2014 12:36 PM, Wolfgang Grandegger wrote: > How are unaligned accesses handled on your system? Alexandre, > > what does "cat /proc/cpu/alignment" report? Aligned access > > would be better, I agree. The imx28 can not support unaligned accesses in hardware. The unaligned access causes an exception, /proc/cpu/alignment thus only allow choosing how the exception is handled. >> Wolfgang, what do you think? Should we change the alignment of > >> rtcan_rb_frame::data, or use put_unaligned on ARM? > > > > I realized the mail and wonder why this problem does not show up with > > vanilla Vanilla handles the alignment trap by emulating the faulting instruction. Last time I checked, there were some problems related to running the emulation over xenomai domain, though looking at the code now, I see nothing which would prevent us from doing it. -- Gilles. ^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [Xenomai] imx28 rtcan flexcan system freezes 2014-01-23 12:05 ` Gilles Chanteperdrix @ 2014-01-23 12:21 ` Wolfgang Grandegger 2014-01-23 12:23 ` Gilles Chanteperdrix 2014-01-23 13:07 ` Gilles Chanteperdrix 1 sibling, 1 reply; 27+ messages in thread From: Wolfgang Grandegger @ 2014-01-23 12:21 UTC (permalink / raw) To: Gilles Chanteperdrix; +Cc: Wolfgang Grandegger, xenomai On Thu, 23 Jan 2014 13:05:40 +0100, Gilles Chanteperdrix <gilles.chanteperdrix@xenomai.org> wrote: > On 01/23/2014 12:36 PM, Wolfgang Grandegger wrote: >> How are unaligned accesses handled on your system? Alexandre, >> >> what does "cat /proc/cpu/alignment" report? Aligned access >> >> would be better, I agree. > > The imx28 can not support unaligned accesses in hardware. The unaligned > access causes an exception, /proc/cpu/alignment thus only allow choosing > how the exception is handled. > > >>> Wolfgang, what do you think? Should we change the alignment of >> >>> rtcan_rb_frame::data, or use put_unaligned on ARM? >> >> >> >> I realized the mail and wonder why this problem does not show up with >> >> vanilla > > Vanilla handles the alignment trap by emulating the faulting > instruction. Last time I checked, there were some problems related to > running the emulation over xenomai domain, though looking at the code > now, I see nothing which would prevent us from doing it. Yes, I know. But the handling of unaligned accesses via trap handler must be enabled by the user and I'm not aware that this is needed for vanilla Linux. Wolfgang. ^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [Xenomai] imx28 rtcan flexcan system freezes 2014-01-23 12:21 ` Wolfgang Grandegger @ 2014-01-23 12:23 ` Gilles Chanteperdrix 0 siblings, 0 replies; 27+ messages in thread From: Gilles Chanteperdrix @ 2014-01-23 12:23 UTC (permalink / raw) To: Wolfgang Grandegger; +Cc: Wolfgang Grandegger, xenomai On 01/23/2014 01:21 PM, Wolfgang Grandegger wrote: >> Vanilla handles the alignment trap by emulating the faulting > >> instruction. Last time I checked, there were some problems related to > >> running the emulation over xenomai domain, though looking at the code > >> now, I see nothing which would prevent us from doing it. > > > > Yes, I know. But the handling of unaligned accesses via trap handler must > > be > > enabled by the user and I'm not aware that this is needed for vanilla > > Linux. I remember reading on the LAKML that the alignment trap is needed for kernel operations, notably for the IP stack. -- Gilles. ^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [Xenomai] imx28 rtcan flexcan system freezes 2014-01-23 12:05 ` Gilles Chanteperdrix 2014-01-23 12:21 ` Wolfgang Grandegger @ 2014-01-23 13:07 ` Gilles Chanteperdrix 1 sibling, 0 replies; 27+ messages in thread From: Gilles Chanteperdrix @ 2014-01-23 13:07 UTC (permalink / raw) To: Wolfgang Grandegger; +Cc: xenomai On 01/23/2014 01:05 PM, Gilles Chanteperdrix wrote: > Vanilla handles the alignment trap by emulating the faulting > instruction. Last time I checked, there were some problems related to > running the emulation over xenomai domain, though looking at the code > now, I see nothing which would prevent us from doing it. > Correction: the emulation code would require changing probe_kernel_address to be able to run over non-linux stacks. -- Gilles. ^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [Xenomai] imx28 rtcan flexcan system freezes 2014-01-23 11:36 ` Wolfgang Grandegger 2014-01-23 12:05 ` Gilles Chanteperdrix @ 2014-01-23 12:54 ` Alexandre COFFIGNAL 2014-01-23 13:10 ` Alexandre COFFIGNAL 1 sibling, 1 reply; 27+ messages in thread From: Alexandre COFFIGNAL @ 2014-01-23 12:54 UTC (permalink / raw) To: xenomai Le 23/01/2014 12:36, Wolfgang Grandegger a écrit : > Hi Gilles, > > > > On Thu, 23 Jan 2014 11:04:44 +0100, Gilles Chanteperdrix > > <gilles.chanteperdrix@xenomai.org> wrote: > >> On 01/22/2014 03:12 PM, Gilles Chanteperdrix wrote: >>> On 01/22/2014 03:04 PM, Alexandre COFFIGNAL wrote: >>>> Le 22/01/2014 14:30, Gilles Chanteperdrix a écrit : >>>>> On 01/22/2014 02:27 PM, Alexandre COFFIGNAL wrote: >>>>>> Le 22/01/2014 13:00, Gilles Chanteperdrix a écrit : >>>>>>> On 01/22/2014 12:36 PM, Alexandre COFFIGNAL wrote: >>>>>>>>>> + cf->data[3]=((data0 >> 0) & 0xFF) ; >>>>>>>>>> + cf->data[2]=((data0 >> 8) & 0xFF) ; >>>>>>>>>> + cf->data[1]=((data0 >> 16) & 0xFF) ; >>>>>>>>>> + cf->data[0]=((data0 >> 24) & 0xFF) ; >>>>>>>>>> + cf->data[7]=((data1 >> 0) & 0xFF) ; >>>>>>>>>> + cf->data[6]=((data1 >> 8) & 0xFF) ; >>>>>>>>>> + cf->data[5]=((data1 >> 16) & 0xFF) ; >>>>>>>>>> + cf->data[4]=((data1 >> 24) & 0xFF) ; >>>>>>>>>> rtcan flexcan works perfectly. >>>>>>>>>> is anyone know what is the problem with first instructions ? >>>>>>>>> Probably mb->data does not have the right alignment. Could you > not > >>>>>>>>> arrange to get it properly aligned? Failing that, you should use >>>>>>>>> put_unaligned instead of open coding it. > > > How are unaligned accesses handled on your system? Alexandre, > > what does "cat /proc/cpu/alignment" report? Aligned access > > would be better, I agree. > > > >>>>>>>> here structures used in flexcan driver, it seem to be aligned >>>>>>> I am talking about the alignment of cf->data, since obviously, that >>>>>>> is >>>>>>> the one which is causing problems. >>>>>> Thank a lot, put_unaligned fix this issue if you want, i can send a >>>>>> path >>>>> The other solution (getting cf->data to be properly aligned) would be >>>>> more efficient, why is not it possible to get cf->data properly >>>>> aligned? >>>> I think, i can't get cf->data to be properly aligned because "cf" is >>>> receive internal frame representation within the ring buffer >>>> of a struct rtcan_socket and struct rtcan_rb_frame is a generic >>>> structure used in all rtcan drivers . >>> Well, if you fix rtcan_rb_frame to be aligned, it will be aligned for >>> all drivers, so that looks like a worthwile improvement... >> Wolfgang, what do you think? Should we change the alignment of >> rtcan_rb_frame::data, or use put_unaligned on ARM? > > > I realized the mail and wonder why this problem does not show up with > > vanilla > > Linux. Maybe we need to port over some patch from there. I will have a > > closer > > look this even or over the weekend. > > > > Wolfgang. > > > > _______________________________________________ > Xenomai mailing list > Xenomai@xenomai.org > http://www.xenomai.org/mailman/listinfo/xenomai Hi, "cat /proc/cpu/alignment" report User: 0 System: 0 Skipped: 0 Half: 0 Word: 0 DWord: 0 Multi: 0 User faults: 0 (ignored) something wrong with that ? Alexandre. ^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [Xenomai] imx28 rtcan flexcan system freezes 2014-01-23 12:54 ` Alexandre COFFIGNAL @ 2014-01-23 13:10 ` Alexandre COFFIGNAL 0 siblings, 0 replies; 27+ messages in thread From: Alexandre COFFIGNAL @ 2014-01-23 13:10 UTC (permalink / raw) To: xenomai Le 23/01/2014 13:54, Alexandre COFFIGNAL a écrit : > > Le 23/01/2014 12:36, Wolfgang Grandegger a écrit : >> Hi Gilles, >> >> >> >> On Thu, 23 Jan 2014 11:04:44 +0100, Gilles Chanteperdrix >> >> <gilles.chanteperdrix@xenomai.org> wrote: >> >>> On 01/22/2014 03:12 PM, Gilles Chanteperdrix wrote: >>>> On 01/22/2014 03:04 PM, Alexandre COFFIGNAL wrote: >>>>> Le 22/01/2014 14:30, Gilles Chanteperdrix a écrit : >>>>>> On 01/22/2014 02:27 PM, Alexandre COFFIGNAL wrote: >>>>>>> Le 22/01/2014 13:00, Gilles Chanteperdrix a écrit : >>>>>>>> On 01/22/2014 12:36 PM, Alexandre COFFIGNAL wrote: >>>>>>>>>>> + cf->data[3]=((data0 >> 0) & 0xFF) ; >>>>>>>>>>> + cf->data[2]=((data0 >> 8) & 0xFF) ; >>>>>>>>>>> + cf->data[1]=((data0 >> 16) & 0xFF) ; >>>>>>>>>>> + cf->data[0]=((data0 >> 24) & 0xFF) ; >>>>>>>>>>> + cf->data[7]=((data1 >> 0) & 0xFF) ; >>>>>>>>>>> + cf->data[6]=((data1 >> 8) & 0xFF) ; >>>>>>>>>>> + cf->data[5]=((data1 >> 16) & 0xFF) ; >>>>>>>>>>> + cf->data[4]=((data1 >> 24) & 0xFF) ; >>>>>>>>>>> rtcan flexcan works perfectly. >>>>>>>>>>> is anyone know what is the problem with first instructions ? >>>>>>>>>> Probably mb->data does not have the right alignment. Could you >> not >> >>>>>>>>>> arrange to get it properly aligned? Failing that, you should use >>>>>>>>>> put_unaligned instead of open coding it. >> >> >> How are unaligned accesses handled on your system? Alexandre, >> >> what does "cat /proc/cpu/alignment" report? Aligned access >> >> would be better, I agree. >> >> >> >>>>>>>>> here structures used in flexcan driver, it seem to be aligned >>>>>>>> I am talking about the alignment of cf->data, since obviously, >>>>>>>> that >>>>>>>> is >>>>>>>> the one which is causing problems. >>>>>>> Thank a lot, put_unaligned fix this issue if you want, i can send a >>>>>>> path >>>>>> The other solution (getting cf->data to be properly aligned) >>>>>> would be >>>>>> more efficient, why is not it possible to get cf->data properly >>>>>> aligned? >>>>> I think, i can't get cf->data to be properly aligned because "cf" is >>>>> receive internal frame representation within the ring buffer >>>>> of a struct rtcan_socket and struct rtcan_rb_frame is a generic >>>>> structure used in all rtcan drivers . >>>> Well, if you fix rtcan_rb_frame to be aligned, it will be aligned for >>>> all drivers, so that looks like a worthwile improvement... >>> Wolfgang, what do you think? Should we change the alignment of >>> rtcan_rb_frame::data, or use put_unaligned on ARM? >> >> >> I realized the mail and wonder why this problem does not show up with >> >> vanilla >> >> Linux. Maybe we need to port over some patch from there. I will have a >> >> closer >> >> look this even or over the weekend. >> >> >> >> Wolfgang. >> >> >> >> _______________________________________________ >> Xenomai mailing list >> Xenomai@xenomai.org >> http://www.xenomai.org/mailman/listinfo/xenomai > > Hi, > > "cat /proc/cpu/alignment" report > User: 0 > System: 0 > Skipped: 0 > Half: 0 > Word: 0 > DWord: 0 > Multi: 0 > User faults: 0 (ignored) > > something wrong with that ? > > Alexandre. > > > _______________________________________________ > Xenomai mailing list > Xenomai@xenomai.org > http://www.xenomai.org/mailman/listinfo/xenomai For your information : Actualy my kernel is linux 3.8.13 vanilla from https://www.kernel.org/pub/linux/kernel/v3.x/" with Adeos/Xenomai Real-time patch 2.6.3 from download.gna.org/xenomai/stable/xenomai-2.6.3.tar.bz2 ^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [Xenomai] imx28 rtcan flexcan system freezes 2014-01-22 14:12 ` Gilles Chanteperdrix 2014-01-23 10:04 ` Gilles Chanteperdrix @ 2014-01-26 19:26 ` Wolfgang Grandegger 2014-01-26 19:29 ` Gilles Chanteperdrix 1 sibling, 1 reply; 27+ messages in thread From: Wolfgang Grandegger @ 2014-01-26 19:26 UTC (permalink / raw) To: Gilles Chanteperdrix, Alexandre COFFIGNAL; +Cc: xenomai On 01/22/2014 03:12 PM, Gilles Chanteperdrix wrote: > On 01/22/2014 03:04 PM, Alexandre COFFIGNAL wrote: >> >> Le 22/01/2014 14:30, Gilles Chanteperdrix a écrit : >>> On 01/22/2014 02:27 PM, Alexandre COFFIGNAL wrote: >>>> >>>> Le 22/01/2014 13:00, Gilles Chanteperdrix a écrit : >>>>> On 01/22/2014 12:36 PM, Alexandre COFFIGNAL wrote: >>>>>>>> + cf->data[3]=((data0 >> 0) & 0xFF) ; >>>>>>>> + cf->data[2]=((data0 >> 8) & 0xFF) ; >>>>>>>> + cf->data[1]=((data0 >> 16) & 0xFF) ; >>>>>>>> + cf->data[0]=((data0 >> 24) & 0xFF) ; >>>>>>>> + cf->data[7]=((data1 >> 0) & 0xFF) ; >>>>>>>> + cf->data[6]=((data1 >> 8) & 0xFF) ; >>>>>>>> + cf->data[5]=((data1 >> 16) & 0xFF) ; >>>>>>>> + cf->data[4]=((data1 >> 24) & 0xFF) ; >>>>>>>> >>>>>>>> rtcan flexcan works perfectly. >>>>>>>> is anyone know what is the problem with first instructions ? >>>>>>> Probably mb->data does not have the right alignment. Could you not >>>>>>> arrange to get it properly aligned? Failing that, you should use >>>>>>> put_unaligned instead of open coding it. >>>>>>> >>>>>>> >>>>>> here structures used in flexcan driver, it seem to be aligned >>>>> >>>>> I am talking about the alignment of cf->data, since obviously, that is >>>>> the one which is causing problems. >>>>> >>>>> >>>> Thank a lot, put_unaligned fix this issue if you want, i can send a >>>> path >>>> >>> >>> The other solution (getting cf->data to be properly aligned) would be >>> more efficient, why is not it possible to get cf->data properly aligned? >>> >> I think, i can't get cf->data to be properly aligned because "cf" is >> receive internal frame representation within the ring buffer >> of a struct rtcan_socket and struct rtcan_rb_frame is a generic >> structure used in all rtcan drivers . > > Well, if you fix rtcan_rb_frame to be aligned, it will be aligned for > all drivers, so that looks like a worthwile improvement... I had a closer look. The CAN message (frame) queuing is optimized for size to get as much as possible messages into the queue. Therefore the CAN data are copied using memcpy, but only the real bytes. Directly behind the real data is the 64 bit timestamp, if requested, which is also not aligned. Therefore I suggest to use memcpy or byte accesses in the flexcan driver as well. If this was a good decision is another question. Wolfgang. ^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [Xenomai] imx28 rtcan flexcan system freezes 2014-01-26 19:26 ` Wolfgang Grandegger @ 2014-01-26 19:29 ` Gilles Chanteperdrix 2014-01-26 20:16 ` Wolfgang Grandegger 0 siblings, 1 reply; 27+ messages in thread From: Gilles Chanteperdrix @ 2014-01-26 19:29 UTC (permalink / raw) To: Wolfgang Grandegger; +Cc: xenomai On 01/26/2014 08:26 PM, Wolfgang Grandegger wrote: > On 01/22/2014 03:12 PM, Gilles Chanteperdrix wrote: >> On 01/22/2014 03:04 PM, Alexandre COFFIGNAL wrote: >>> >>> Le 22/01/2014 14:30, Gilles Chanteperdrix a écrit : >>>> On 01/22/2014 02:27 PM, Alexandre COFFIGNAL wrote: >>>>> >>>>> Le 22/01/2014 13:00, Gilles Chanteperdrix a écrit : >>>>>> On 01/22/2014 12:36 PM, Alexandre COFFIGNAL wrote: >>>>>>>>> + cf->data[3]=((data0 >> 0) & 0xFF) ; >>>>>>>>> + cf->data[2]=((data0 >> 8) & 0xFF) ; >>>>>>>>> + cf->data[1]=((data0 >> 16) & 0xFF) ; >>>>>>>>> + cf->data[0]=((data0 >> 24) & 0xFF) ; >>>>>>>>> + cf->data[7]=((data1 >> 0) & 0xFF) ; >>>>>>>>> + cf->data[6]=((data1 >> 8) & 0xFF) ; >>>>>>>>> + cf->data[5]=((data1 >> 16) & 0xFF) ; >>>>>>>>> + cf->data[4]=((data1 >> 24) & 0xFF) ; >>>>>>>>> >>>>>>>>> rtcan flexcan works perfectly. >>>>>>>>> is anyone know what is the problem with first instructions ? >>>>>>>> Probably mb->data does not have the right alignment. Could you not >>>>>>>> arrange to get it properly aligned? Failing that, you should use >>>>>>>> put_unaligned instead of open coding it. >>>>>>>> >>>>>>>> >>>>>>> here structures used in flexcan driver, it seem to be aligned >>>>>> >>>>>> I am talking about the alignment of cf->data, since obviously, that is >>>>>> the one which is causing problems. >>>>>> >>>>>> >>>>> Thank a lot, put_unaligned fix this issue if you want, i can send a >>>>> path >>>>> >>>> >>>> The other solution (getting cf->data to be properly aligned) would be >>>> more efficient, why is not it possible to get cf->data properly aligned? >>>> >>> I think, i can't get cf->data to be properly aligned because "cf" is >>> receive internal frame representation within the ring buffer >>> of a struct rtcan_socket and struct rtcan_rb_frame is a generic >>> structure used in all rtcan drivers . >> >> Well, if you fix rtcan_rb_frame to be aligned, it will be aligned for >> all drivers, so that looks like a worthwile improvement... > > I had a closer look. The CAN message (frame) queuing is optimized for > size to get as much as possible messages into the queue. Therefore the > CAN data are copied using memcpy, but only the real bytes. Directly > behind the real data is the 64 bit timestamp, if requested, which is > also not aligned. Therefore I suggest to use memcpy or byte accesses in > the flexcan driver as well. If this was a good decision is another question. Aligning the data begining costs 2 bytes by struct rtcan_rb_frame. How many such structures are there for a typical driver? -- Gilles. ^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [Xenomai] imx28 rtcan flexcan system freezes 2014-01-26 19:29 ` Gilles Chanteperdrix @ 2014-01-26 20:16 ` Wolfgang Grandegger 2014-01-26 20:56 ` Gilles Chanteperdrix 0 siblings, 1 reply; 27+ messages in thread From: Wolfgang Grandegger @ 2014-01-26 20:16 UTC (permalink / raw) To: Gilles Chanteperdrix; +Cc: xenomai On 01/26/2014 08:29 PM, Gilles Chanteperdrix wrote: > On 01/26/2014 08:26 PM, Wolfgang Grandegger wrote: >> On 01/22/2014 03:12 PM, Gilles Chanteperdrix wrote: >>> On 01/22/2014 03:04 PM, Alexandre COFFIGNAL wrote: >>>> >>>> Le 22/01/2014 14:30, Gilles Chanteperdrix a écrit : >>>>> On 01/22/2014 02:27 PM, Alexandre COFFIGNAL wrote: >>>>>> >>>>>> Le 22/01/2014 13:00, Gilles Chanteperdrix a écrit : >>>>>>> On 01/22/2014 12:36 PM, Alexandre COFFIGNAL wrote: >>>>>>>>>> + cf->data[3]=((data0 >> 0) & 0xFF) ; >>>>>>>>>> + cf->data[2]=((data0 >> 8) & 0xFF) ; >>>>>>>>>> + cf->data[1]=((data0 >> 16) & 0xFF) ; >>>>>>>>>> + cf->data[0]=((data0 >> 24) & 0xFF) ; >>>>>>>>>> + cf->data[7]=((data1 >> 0) & 0xFF) ; >>>>>>>>>> + cf->data[6]=((data1 >> 8) & 0xFF) ; >>>>>>>>>> + cf->data[5]=((data1 >> 16) & 0xFF) ; >>>>>>>>>> + cf->data[4]=((data1 >> 24) & 0xFF) ; >>>>>>>>>> >>>>>>>>>> rtcan flexcan works perfectly. >>>>>>>>>> is anyone know what is the problem with first instructions ? >>>>>>>>> Probably mb->data does not have the right alignment. Could you not >>>>>>>>> arrange to get it properly aligned? Failing that, you should use >>>>>>>>> put_unaligned instead of open coding it. >>>>>>>>> >>>>>>>>> >>>>>>>> here structures used in flexcan driver, it seem to be aligned >>>>>>> >>>>>>> I am talking about the alignment of cf->data, since obviously, that is >>>>>>> the one which is causing problems. >>>>>>> >>>>>>> >>>>>> Thank a lot, put_unaligned fix this issue if you want, i can send a >>>>>> path >>>>>> >>>>> >>>>> The other solution (getting cf->data to be properly aligned) would be >>>>> more efficient, why is not it possible to get cf->data properly aligned? >>>>> >>>> I think, i can't get cf->data to be properly aligned because "cf" is >>>> receive internal frame representation within the ring buffer >>>> of a struct rtcan_socket and struct rtcan_rb_frame is a generic >>>> structure used in all rtcan drivers . >>> >>> Well, if you fix rtcan_rb_frame to be aligned, it will be aligned for >>> all drivers, so that looks like a worthwile improvement... >> >> I had a closer look. The CAN message (frame) queuing is optimized for >> size to get as much as possible messages into the queue. Therefore the >> CAN data are copied using memcpy, but only the real bytes. Directly >> behind the real data is the 64 bit timestamp, if requested, which is >> also not aligned. Therefore I suggest to use memcpy or byte accesses in >> the flexcan driver as well. If this was a good decision is another question. > > Aligning the data begining costs 2 bytes by struct rtcan_rb_frame. How > many such structures are there for a typical driver? Any message in the queue will require two bytes more. I did not say that optimizing for size is necessary, but that's how it was implemented long time ago. And I do not see a need to break that just because of the Flexcan driver. Wolfgang. > > ^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [Xenomai] imx28 rtcan flexcan system freezes 2014-01-26 20:16 ` Wolfgang Grandegger @ 2014-01-26 20:56 ` Gilles Chanteperdrix 2014-01-27 7:56 ` Wolfgang Grandegger 0 siblings, 1 reply; 27+ messages in thread From: Gilles Chanteperdrix @ 2014-01-26 20:56 UTC (permalink / raw) To: Wolfgang Grandegger; +Cc: xenomai On 01/26/2014 09:16 PM, Wolfgang Grandegger wrote: > On 01/26/2014 08:29 PM, Gilles Chanteperdrix wrote: >> On 01/26/2014 08:26 PM, Wolfgang Grandegger wrote: >>> On 01/22/2014 03:12 PM, Gilles Chanteperdrix wrote: >>>> On 01/22/2014 03:04 PM, Alexandre COFFIGNAL wrote: >>>>> >>>>> Le 22/01/2014 14:30, Gilles Chanteperdrix a écrit : >>>>>> On 01/22/2014 02:27 PM, Alexandre COFFIGNAL wrote: >>>>>>> >>>>>>> Le 22/01/2014 13:00, Gilles Chanteperdrix a écrit : >>>>>>>> On 01/22/2014 12:36 PM, Alexandre COFFIGNAL wrote: >>>>>>>>>>> + cf->data[3]=((data0 >> 0) & 0xFF) ; >>>>>>>>>>> + cf->data[2]=((data0 >> 8) & 0xFF) ; >>>>>>>>>>> + cf->data[1]=((data0 >> 16) & 0xFF) ; >>>>>>>>>>> + cf->data[0]=((data0 >> 24) & 0xFF) ; >>>>>>>>>>> + cf->data[7]=((data1 >> 0) & 0xFF) ; >>>>>>>>>>> + cf->data[6]=((data1 >> 8) & 0xFF) ; >>>>>>>>>>> + cf->data[5]=((data1 >> 16) & 0xFF) ; >>>>>>>>>>> + cf->data[4]=((data1 >> 24) & 0xFF) ; >>>>>>>>>>> >>>>>>>>>>> rtcan flexcan works perfectly. >>>>>>>>>>> is anyone know what is the problem with first instructions ? >>>>>>>>>> Probably mb->data does not have the right alignment. Could you not >>>>>>>>>> arrange to get it properly aligned? Failing that, you should use >>>>>>>>>> put_unaligned instead of open coding it. >>>>>>>>>> >>>>>>>>>> >>>>>>>>> here structures used in flexcan driver, it seem to be aligned >>>>>>>> >>>>>>>> I am talking about the alignment of cf->data, since obviously, that is >>>>>>>> the one which is causing problems. >>>>>>>> >>>>>>>> >>>>>>> Thank a lot, put_unaligned fix this issue if you want, i can send a >>>>>>> path >>>>>>> >>>>>> >>>>>> The other solution (getting cf->data to be properly aligned) would be >>>>>> more efficient, why is not it possible to get cf->data properly aligned? >>>>>> >>>>> I think, i can't get cf->data to be properly aligned because "cf" is >>>>> receive internal frame representation within the ring buffer >>>>> of a struct rtcan_socket and struct rtcan_rb_frame is a generic >>>>> structure used in all rtcan drivers . >>>> >>>> Well, if you fix rtcan_rb_frame to be aligned, it will be aligned for >>>> all drivers, so that looks like a worthwile improvement... >>> >>> I had a closer look. The CAN message (frame) queuing is optimized for >>> size to get as much as possible messages into the queue. Therefore the >>> CAN data are copied using memcpy, but only the real bytes. Directly >>> behind the real data is the 64 bit timestamp, if requested, which is >>> also not aligned. Therefore I suggest to use memcpy or byte accesses in >>> the flexcan driver as well. If this was a good decision is another question. >> >> Aligning the data begining costs 2 bytes by struct rtcan_rb_frame. How >> many such structures are there for a typical driver? > > Any message in the queue will require two bytes more. I did not say that > optimizing for size is necessary, but that's how it was implemented long > time ago. And I do not see a need to break that just because of the > Flexcan driver. IMO, it is not just for the flexcan driver, it will avoid unaligned accesses for all drivers which access data 4 bytes at a time. And I do not think it "breaks" anything. What I do not know is: - how many struct rtcan_rb_frame are typically in use? If only a few, then adding 2 bytes should not be a problem. - do all drivers access data 4 bytes at a time? or only the flexcan driver? Regards. -- Gilles. ^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [Xenomai] imx28 rtcan flexcan system freezes 2014-01-26 20:56 ` Gilles Chanteperdrix @ 2014-01-27 7:56 ` Wolfgang Grandegger 2014-01-28 22:06 ` Gilles Chanteperdrix 0 siblings, 1 reply; 27+ messages in thread From: Wolfgang Grandegger @ 2014-01-27 7:56 UTC (permalink / raw) To: Gilles Chanteperdrix; +Cc: xenomai On Sun, 26 Jan 2014 21:56:10 +0100, Gilles Chanteperdrix <gilles.chanteperdrix@xenomai.org> wrote: > On 01/26/2014 09:16 PM, Wolfgang Grandegger wrote: >> On 01/26/2014 08:29 PM, Gilles Chanteperdrix wrote: >>> On 01/26/2014 08:26 PM, Wolfgang Grandegger wrote: >>>> On 01/22/2014 03:12 PM, Gilles Chanteperdrix wrote: >>>>> On 01/22/2014 03:04 PM, Alexandre COFFIGNAL wrote: >>>>>> >>>>>> Le 22/01/2014 14:30, Gilles Chanteperdrix a écrit : >>>>>>> On 01/22/2014 02:27 PM, Alexandre COFFIGNAL wrote: >>>>>>>> >>>>>>>> Le 22/01/2014 13:00, Gilles Chanteperdrix a écrit : >>>>>>>>> On 01/22/2014 12:36 PM, Alexandre COFFIGNAL wrote: >>>>>>>>>>>> + cf->data[3]=((data0 >> 0) & 0xFF) ; >>>>>>>>>>>> + cf->data[2]=((data0 >> 8) & 0xFF) ; >>>>>>>>>>>> + cf->data[1]=((data0 >> 16) & 0xFF) ; >>>>>>>>>>>> + cf->data[0]=((data0 >> 24) & 0xFF) ; >>>>>>>>>>>> + cf->data[7]=((data1 >> 0) & 0xFF) ; >>>>>>>>>>>> + cf->data[6]=((data1 >> 8) & 0xFF) ; >>>>>>>>>>>> + cf->data[5]=((data1 >> 16) & 0xFF) ; >>>>>>>>>>>> + cf->data[4]=((data1 >> 24) & 0xFF) ; >>>>>>>>>>>> >>>>>>>>>>>> rtcan flexcan works perfectly. >>>>>>>>>>>> is anyone know what is the problem with first instructions ? >>>>>>>>>>> Probably mb->data does not have the right alignment. Could you >>>>>>>>>>> not >>>>>>>>>>> arrange to get it properly aligned? Failing that, you should use >>>>>>>>>>> put_unaligned instead of open coding it. >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>> here structures used in flexcan driver, it seem to be aligned >>>>>>>>> >>>>>>>>> I am talking about the alignment of cf->data, since obviously, >>>>>>>>> that is >>>>>>>>> the one which is causing problems. >>>>>>>>> >>>>>>>>> >>>>>>>> Thank a lot, put_unaligned fix this issue if you want, i can send a >>>>>>>> path >>>>>>>> >>>>>>> >>>>>>> The other solution (getting cf->data to be properly aligned) would >>>>>>> be >>>>>>> more efficient, why is not it possible to get cf->data properly >>>>>>> aligned? >>>>>>> >>>>>> I think, i can't get cf->data to be properly aligned because "cf" is >>>>>> receive internal frame representation within the ring buffer >>>>>> of a struct rtcan_socket and struct rtcan_rb_frame is a generic >>>>>> structure used in all rtcan drivers . >>>>> >>>>> Well, if you fix rtcan_rb_frame to be aligned, it will be aligned for >>>>> all drivers, so that looks like a worthwile improvement... >>>> >>>> I had a closer look. The CAN message (frame) queuing is optimized for >>>> size to get as much as possible messages into the queue. Therefore the >>>> CAN data are copied using memcpy, but only the real bytes. Directly >>>> behind the real data is the 64 bit timestamp, if requested, which is >>>> also not aligned. Therefore I suggest to use memcpy or byte accesses in >>>> the flexcan driver as well. If this was a good decision is another >>>> question. >>> >>> Aligning the data begining costs 2 bytes by struct rtcan_rb_frame. How >>> many such structures are there for a typical driver? >> >> Any message in the queue will require two bytes more. I did not say that >> optimizing for size is necessary, but that's how it was implemented long >> time ago. And I do not see a need to break that just because of the >> Flexcan driver. > > IMO, it is not just for the flexcan driver, it will avoid unaligned > accesses for all drivers which access data 4 bytes at a time. And I do > not think it "breaks" anything. What I do not know is: But it's just the Flexcan driver which is doing unaligned accesses. > - how many struct rtcan_rb_frame are typically in use? If only a few, > then adding 2 bytes should not be a problem. This depends on the size of the queue. But if the message size changes it will also change run-time behaviour because less messages will fit into the queue. That's what I'm more concerned about than the extra 2 bytes. > - do all drivers access data 4 bytes at a time? or only the flexcan driver? No, as far as I have seen only the Flexan driver. But I need to check. Wolfgang. ^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [Xenomai] imx28 rtcan flexcan system freezes 2014-01-27 7:56 ` Wolfgang Grandegger @ 2014-01-28 22:06 ` Gilles Chanteperdrix 2014-01-29 7:16 ` Wolfgang Grandegger 0 siblings, 1 reply; 27+ messages in thread From: Gilles Chanteperdrix @ 2014-01-28 22:06 UTC (permalink / raw) To: Wolfgang Grandegger; +Cc: xenomai On 01/27/2014 08:56 AM, Wolfgang Grandegger wrote: > On Sun, 26 Jan 2014 21:56:10 +0100, Gilles Chanteperdrix >> IMO, it is not just for the flexcan driver, it will avoid unaligned > >> accesses for all drivers which access data 4 bytes at a time. And I do > >> not think it "breaks" anything. What I do not know is: > > > > But it's just the Flexcan driver which is doing unaligned accesses. Ok, can we agree on the following patch then? diff --git a/ksrc/drivers/can/rtcan_flexcan.c b/ksrc/drivers/can/rtcan_flexcan.c index 8f0e8d1..1674b73 100644 --- a/ksrc/drivers/can/rtcan_flexcan.c +++ b/ksrc/drivers/can/rtcan_flexcan.c @@ -38,6 +38,7 @@ #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,5,0) #include <linux/pinctrl/consumer.h> #endif +#include <asm/unaligned.h> #include <rtdm/rtdm_driver.h> @@ -497,11 +498,9 @@ static void flexcan_rx_interrupt(struct rtcan_device *dev, cf->can_id |= CAN_RTR_FLAG; skb->rb_frame_size = EMPTY_RB_FRAME_SIZE; } else { - skb->rb_frame_size = EMPTY_RB_FRAME_SIZE + cf->can_dlc ; - *(__be32 *)(cf->data + 0) = - cpu_to_be32(flexcan_read(&mb->data[0])); - *(__be32 *)(cf->data + 4) = - cpu_to_be32(flexcan_read(&mb->data[1])); + skb->rb_frame_size = EMPTY_RB_FRAME_SIZE + cf->can_dlc; + put_unaligned_be32(flexcan_read(&mb->data[0]), cf->data + 0); + put_unaligned_be32(flexcan_read(&mb->data[1]), cf->data + 4); } /* Store the interface index */ -- Gilles. ^ permalink raw reply related [flat|nested] 27+ messages in thread
* Re: [Xenomai] imx28 rtcan flexcan system freezes 2014-01-28 22:06 ` Gilles Chanteperdrix @ 2014-01-29 7:16 ` Wolfgang Grandegger 2014-01-29 15:50 ` Alexandre COFFIGNAL 0 siblings, 1 reply; 27+ messages in thread From: Wolfgang Grandegger @ 2014-01-29 7:16 UTC (permalink / raw) To: Gilles Chanteperdrix; +Cc: xenomai On Tue, 28 Jan 2014 23:06:54 +0100, Gilles Chanteperdrix <gilles.chanteperdrix@xenomai.org> wrote: > On 01/27/2014 08:56 AM, Wolfgang Grandegger wrote: >> On Sun, 26 Jan 2014 21:56:10 +0100, Gilles Chanteperdrix >>> IMO, it is not just for the flexcan driver, it will avoid unaligned >> >>> accesses for all drivers which access data 4 bytes at a time. And I do >> >>> not think it "breaks" anything. What I do not know is: >> >> >> >> But it's just the Flexcan driver which is doing unaligned accesses. > > Ok, can we agree on the following patch then? > > diff --git a/ksrc/drivers/can/rtcan_flexcan.c > b/ksrc/drivers/can/rtcan_flexcan.c > index 8f0e8d1..1674b73 100644 > --- a/ksrc/drivers/can/rtcan_flexcan.c > +++ b/ksrc/drivers/can/rtcan_flexcan.c > @@ -38,6 +38,7 @@ > #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,5,0) > #include <linux/pinctrl/consumer.h> > #endif > +#include <asm/unaligned.h> > > #include <rtdm/rtdm_driver.h> > > @@ -497,11 +498,9 @@ static void flexcan_rx_interrupt(struct rtcan_device > *dev, > cf->can_id |= CAN_RTR_FLAG; > skb->rb_frame_size = EMPTY_RB_FRAME_SIZE; > } else { > - skb->rb_frame_size = EMPTY_RB_FRAME_SIZE + cf->can_dlc ; > - *(__be32 *)(cf->data + 0) = > - cpu_to_be32(flexcan_read(&mb->data[0])); > - *(__be32 *)(cf->data + 4) = > - cpu_to_be32(flexcan_read(&mb->data[1])); > + skb->rb_frame_size = EMPTY_RB_FRAME_SIZE + cf->can_dlc; > + put_unaligned_be32(flexcan_read(&mb->data[0]), cf->data + 0); > + put_unaligned_be32(flexcan_read(&mb->data[1]), cf->data + 4); > } > > /* Store the interface index */ D'accord, thanks. Wolfgang. ^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [Xenomai] imx28 rtcan flexcan system freezes 2014-01-29 7:16 ` Wolfgang Grandegger @ 2014-01-29 15:50 ` Alexandre COFFIGNAL 2014-01-29 17:58 ` Gilles Chanteperdrix 0 siblings, 1 reply; 27+ messages in thread From: Alexandre COFFIGNAL @ 2014-01-29 15:50 UTC (permalink / raw) To: xenomai Le 29/01/2014 08:16, Wolfgang Grandegger a écrit : > On Tue, 28 Jan 2014 23:06:54 +0100, Gilles Chanteperdrix > <gilles.chanteperdrix@xenomai.org> wrote: >> On 01/27/2014 08:56 AM, Wolfgang Grandegger wrote: >>> On Sun, 26 Jan 2014 21:56:10 +0100, Gilles Chanteperdrix >>>> IMO, it is not just for the flexcan driver, it will avoid unaligned >>>> accesses for all drivers which access data 4 bytes at a time. And I do >>>> not think it "breaks" anything. What I do not know is: >>> >>> >>> But it's just the Flexcan driver which is doing unaligned accesses. >> Ok, can we agree on the following patch then? >> >> diff --git a/ksrc/drivers/can/rtcan_flexcan.c >> b/ksrc/drivers/can/rtcan_flexcan.c >> index 8f0e8d1..1674b73 100644 >> --- a/ksrc/drivers/can/rtcan_flexcan.c >> +++ b/ksrc/drivers/can/rtcan_flexcan.c >> @@ -38,6 +38,7 @@ >> #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,5,0) >> #include <linux/pinctrl/consumer.h> >> #endif >> +#include <asm/unaligned.h> >> >> #include <rtdm/rtdm_driver.h> >> >> @@ -497,11 +498,9 @@ static void flexcan_rx_interrupt(struct > rtcan_device >> *dev, >> cf->can_id |= CAN_RTR_FLAG; >> skb->rb_frame_size = EMPTY_RB_FRAME_SIZE; >> } else { >> - skb->rb_frame_size = EMPTY_RB_FRAME_SIZE + cf->can_dlc ; >> - *(__be32 *)(cf->data + 0) = >> - cpu_to_be32(flexcan_read(&mb->data[0])); >> - *(__be32 *)(cf->data + 4) = >> - cpu_to_be32(flexcan_read(&mb->data[1])); >> + skb->rb_frame_size = EMPTY_RB_FRAME_SIZE + cf->can_dlc; >> + put_unaligned_be32(flexcan_read(&mb->data[0]), cf->data + 0); >> + put_unaligned_be32(flexcan_read(&mb->data[1]), cf->data + 4); >> } >> >> /* Store the interface index */ > D'accord, thanks. > > Wolfgang. > Thank you all for your replies Alexandre. ^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [Xenomai] imx28 rtcan flexcan system freezes 2014-01-29 15:50 ` Alexandre COFFIGNAL @ 2014-01-29 17:58 ` Gilles Chanteperdrix 2014-01-31 13:15 ` Alexandre COFFIGNAL 0 siblings, 1 reply; 27+ messages in thread From: Gilles Chanteperdrix @ 2014-01-29 17:58 UTC (permalink / raw) To: Alexandre COFFIGNAL; +Cc: xenomai On 01/29/2014 04:50 PM, Alexandre COFFIGNAL wrote: > > Le 29/01/2014 08:16, Wolfgang Grandegger a écrit : >> On Tue, 28 Jan 2014 23:06:54 +0100, Gilles Chanteperdrix >> <gilles.chanteperdrix@xenomai.org> wrote: >>> On 01/27/2014 08:56 AM, Wolfgang Grandegger wrote: >>>> On Sun, 26 Jan 2014 21:56:10 +0100, Gilles Chanteperdrix >>>>> IMO, it is not just for the flexcan driver, it will avoid unaligned >>>>> accesses for all drivers which access data 4 bytes at a time. And I do >>>>> not think it "breaks" anything. What I do not know is: >>>> >>>> >>>> But it's just the Flexcan driver which is doing unaligned accesses. >>> Ok, can we agree on the following patch then? >>> >>> diff --git a/ksrc/drivers/can/rtcan_flexcan.c >>> b/ksrc/drivers/can/rtcan_flexcan.c >>> index 8f0e8d1..1674b73 100644 >>> --- a/ksrc/drivers/can/rtcan_flexcan.c >>> +++ b/ksrc/drivers/can/rtcan_flexcan.c >>> @@ -38,6 +38,7 @@ >>> #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,5,0) >>> #include <linux/pinctrl/consumer.h> >>> #endif >>> +#include <asm/unaligned.h> >>> >>> #include <rtdm/rtdm_driver.h> >>> >>> @@ -497,11 +498,9 @@ static void flexcan_rx_interrupt(struct >> rtcan_device >>> *dev, >>> cf->can_id |= CAN_RTR_FLAG; >>> skb->rb_frame_size = EMPTY_RB_FRAME_SIZE; >>> } else { >>> - skb->rb_frame_size = EMPTY_RB_FRAME_SIZE + cf->can_dlc ; >>> - *(__be32 *)(cf->data + 0) = >>> - cpu_to_be32(flexcan_read(&mb->data[0])); >>> - *(__be32 *)(cf->data + 4) = >>> - cpu_to_be32(flexcan_read(&mb->data[1])); >>> + skb->rb_frame_size = EMPTY_RB_FRAME_SIZE + cf->can_dlc; >>> + put_unaligned_be32(flexcan_read(&mb->data[0]), cf->data + 0); >>> + put_unaligned_be32(flexcan_read(&mb->data[1]), cf->data + 4); >>> } >>> >>> /* Store the interface index */ >> D'accord, thanks. >> >> Wolfgang. >> > Thank you all for your replies Hi Alexandre, Did you check the last patch? Does it compile and work for you? Regards. -- Gilles. ^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [Xenomai] imx28 rtcan flexcan system freezes 2014-01-29 17:58 ` Gilles Chanteperdrix @ 2014-01-31 13:15 ` Alexandre COFFIGNAL 0 siblings, 0 replies; 27+ messages in thread From: Alexandre COFFIGNAL @ 2014-01-31 13:15 UTC (permalink / raw) To: xenomai Le 29/01/2014 18:58, Gilles Chanteperdrix a écrit : > On 01/29/2014 04:50 PM, Alexandre COFFIGNAL wrote: >> >> Le 29/01/2014 08:16, Wolfgang Grandegger a écrit : >>> On Tue, 28 Jan 2014 23:06:54 +0100, Gilles Chanteperdrix >>> <gilles.chanteperdrix@xenomai.org> wrote: >>>> On 01/27/2014 08:56 AM, Wolfgang Grandegger wrote: >>>>> On Sun, 26 Jan 2014 21:56:10 +0100, Gilles Chanteperdrix >>>>>> IMO, it is not just for the flexcan driver, it will avoid unaligned >>>>>> accesses for all drivers which access data 4 bytes at a time. And >>>>>> I do >>>>>> not think it "breaks" anything. What I do not know is: >>>>> >>>>> >>>>> But it's just the Flexcan driver which is doing unaligned accesses. >>>> Ok, can we agree on the following patch then? >>>> >>>> diff --git a/ksrc/drivers/can/rtcan_flexcan.c >>>> b/ksrc/drivers/can/rtcan_flexcan.c >>>> index 8f0e8d1..1674b73 100644 >>>> --- a/ksrc/drivers/can/rtcan_flexcan.c >>>> +++ b/ksrc/drivers/can/rtcan_flexcan.c >>>> @@ -38,6 +38,7 @@ >>>> #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,5,0) >>>> #include <linux/pinctrl/consumer.h> >>>> #endif >>>> +#include <asm/unaligned.h> >>>> >>>> #include <rtdm/rtdm_driver.h> >>>> >>>> @@ -497,11 +498,9 @@ static void flexcan_rx_interrupt(struct >>> rtcan_device >>>> *dev, >>>> cf->can_id |= CAN_RTR_FLAG; >>>> skb->rb_frame_size = EMPTY_RB_FRAME_SIZE; >>>> } else { >>>> - skb->rb_frame_size = EMPTY_RB_FRAME_SIZE + cf->can_dlc ; >>>> - *(__be32 *)(cf->data + 0) = >>>> - cpu_to_be32(flexcan_read(&mb->data[0])); >>>> - *(__be32 *)(cf->data + 4) = >>>> - cpu_to_be32(flexcan_read(&mb->data[1])); >>>> + skb->rb_frame_size = EMPTY_RB_FRAME_SIZE + cf->can_dlc; >>>> + put_unaligned_be32(flexcan_read(&mb->data[0]), cf->data + 0); >>>> + put_unaligned_be32(flexcan_read(&mb->data[1]), cf->data + 4); >>>> } >>>> >>>> /* Store the interface index */ >>> D'accord, thanks. >>> >>> Wolfgang. >>> >> Thank you all for your replies > > Hi Alexandre, > > Did you check the last patch? Does it compile and work for you? > > Regards. > I tested this patch, it works perfectly on i.MX28. Thank you very much. Regards. ^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [Xenomai] imx28 rtcan flexcan system freezes 2014-01-22 14:04 ` Alexandre COFFIGNAL 2014-01-22 14:12 ` Gilles Chanteperdrix @ 2014-01-23 19:48 ` Gilles Chanteperdrix 1 sibling, 0 replies; 27+ messages in thread From: Gilles Chanteperdrix @ 2014-01-23 19:48 UTC (permalink / raw) To: Alexandre COFFIGNAL; +Cc: xenomai On 01/22/2014 03:04 PM, Alexandre COFFIGNAL wrote: > > Le 22/01/2014 14:30, Gilles Chanteperdrix a écrit : >> On 01/22/2014 02:27 PM, Alexandre COFFIGNAL wrote: >>> >>> Le 22/01/2014 13:00, Gilles Chanteperdrix a écrit : >>>> On 01/22/2014 12:36 PM, Alexandre COFFIGNAL wrote: >>>>>>> + cf->data[3]=((data0 >> 0) & 0xFF) ; >>>>>>> + cf->data[2]=((data0 >> 8) & 0xFF) ; >>>>>>> + cf->data[1]=((data0 >> 16) & 0xFF) ; >>>>>>> + cf->data[0]=((data0 >> 24) & 0xFF) ; >>>>>>> + cf->data[7]=((data1 >> 0) & 0xFF) ; >>>>>>> + cf->data[6]=((data1 >> 8) & 0xFF) ; >>>>>>> + cf->data[5]=((data1 >> 16) & 0xFF) ; >>>>>>> + cf->data[4]=((data1 >> 24) & 0xFF) ; >>>>>>> >>>>>>> rtcan flexcan works perfectly. >>>>>>> is anyone know what is the problem with first instructions ? >>>>>> Probably mb->data does not have the right alignment. Could you not >>>>>> arrange to get it properly aligned? Failing that, you should use >>>>>> put_unaligned instead of open coding it. >>>>>> >>>>>> >>>>> here structures used in flexcan driver, it seem to be aligned >>>> >>>> I am talking about the alignment of cf->data, since obviously, that is >>>> the one which is causing problems. >>>> >>>> >>> Thank a lot, put_unaligned fix this issue if you want, i can send a path >>> >> >> The other solution (getting cf->data to be properly aligned) would be >> more efficient, why is not it possible to get cf->data properly aligned? >> > I think, i can't get cf->data to be properly aligned because "cf" is > receive internal frame representation within the ring buffer > of a struct rtcan_socket and struct rtcan_rb_frame is a generic > structure used in all rtcan drivers . Hi Alexandr, Could you try the following patch? diff --git a/ksrc/drivers/can/rtcan_socket.h b/ksrc/drivers/can/rtcan_socket.h index e0a395d..8984121 100644 --- a/ksrc/drivers/can/rtcan_socket.h +++ b/ksrc/drivers/can/rtcan_socket.h @@ -77,6 +77,7 @@ struct rtcan_rb_frame { * existence of a timestamp is indicated by the RTCAN_HAS_TIMESTAMP * bit. */ unsigned char can_dlc; + unsigned short pad; /* Data bytes */ uint8_t data[8]; Regards. -- Gilles. ^ permalink raw reply related [flat|nested] 27+ messages in thread
end of thread, other threads:[~2014-01-31 13:15 UTC | newest] Thread overview: 27+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2014-01-22 10:24 [Xenomai] imx28 rtcan flexcan system freezes Alexandre COFFIGNAL 2014-01-22 11:23 ` Gilles Chanteperdrix 2014-01-22 11:36 ` Alexandre COFFIGNAL 2014-01-22 12:00 ` Gilles Chanteperdrix 2014-01-22 13:27 ` Alexandre COFFIGNAL 2014-01-22 13:30 ` Gilles Chanteperdrix 2014-01-22 14:04 ` Alexandre COFFIGNAL 2014-01-22 14:12 ` Gilles Chanteperdrix 2014-01-23 10:04 ` Gilles Chanteperdrix 2014-01-23 11:36 ` Wolfgang Grandegger 2014-01-23 12:05 ` Gilles Chanteperdrix 2014-01-23 12:21 ` Wolfgang Grandegger 2014-01-23 12:23 ` Gilles Chanteperdrix 2014-01-23 13:07 ` Gilles Chanteperdrix 2014-01-23 12:54 ` Alexandre COFFIGNAL 2014-01-23 13:10 ` Alexandre COFFIGNAL 2014-01-26 19:26 ` Wolfgang Grandegger 2014-01-26 19:29 ` Gilles Chanteperdrix 2014-01-26 20:16 ` Wolfgang Grandegger 2014-01-26 20:56 ` Gilles Chanteperdrix 2014-01-27 7:56 ` Wolfgang Grandegger 2014-01-28 22:06 ` Gilles Chanteperdrix 2014-01-29 7:16 ` Wolfgang Grandegger 2014-01-29 15:50 ` Alexandre COFFIGNAL 2014-01-29 17:58 ` Gilles Chanteperdrix 2014-01-31 13:15 ` Alexandre COFFIGNAL 2014-01-23 19:48 ` Gilles Chanteperdrix
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.