Received: from redirect.mail.gandi.net (relay13.mail.gandi.net [217.70.178.233]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 44DD91957FC for ; Tue, 19 Nov 2024 07:27:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.178.233 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732001234; cv=none; b=NFvJ2X765bhbHXSOuT6etORdaM+qaDZ729XnDpYrGHxCulPvgIkD9WLb2aCfMvv5QeGdFn7a7gXgWve3ewtURgHsRgUNfskRokGg+hA3doKse9cm/EBB73kKRTdlWKrra4mRS7PQhgCRHsK1cOmb9oycy5jLcXk43bIzupuzJ8c= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732001234; c=relaxed/simple; bh=ywt1L5eYl8KgsTZktjdRf29vT0L7u5h//9J72LmT518=; h=From:In-Reply-To:Content-Type:Date:Cc:To:MIME-Version:Message-ID: Subject; b=qR4813CJKuTR0NmY8dwHYFJ/MT4WbSuDEBPAysG8awyoGWfbpusZrHWjELl9QGS/yL5fg5fv8E/oZ8HKnkaXeqjUeQ5OuHAmcpCihShtnmSjlOepjKmhLzUBCROIQ7skfHMVhI35RYythLN1uaDX1EmoWPFyZXeujKYoDs7mwY0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=thom.fr.eu.org; spf=pass smtp.mailfrom=redirect.mail.gandi.net; dkim=permerror (0-bit key) header.d=thom.fr.eu.org header.i=@thom.fr.eu.org header.b=hJz2JeLo; arc=none smtp.client-ip=217.70.178.233 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=thom.fr.eu.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redirect.mail.gandi.net Authentication-Results: smtp.subspace.kernel.org; dkim=permerror (0-bit key) header.d=thom.fr.eu.org header.i=@thom.fr.eu.org header.b="hJz2JeLo" Received: from spool.mail.gandi.net (spool2.mail.gandi.net [217.70.178.211]) by relay13.mail.gandi.net (Postfix) with ESMTPS id F2F2380004; Tue, 19 Nov 2024 07:27:07 +0000 (UTC) Received: from smtp5-g21.free.fr (smtp5-g21.free.fr [212.27.42.5]) by spool.mail.gandi.net (Postfix) with ESMTPS id 3551C740034; Tue, 19 Nov 2024 07:27:07 +0000 (UTC) Received: from mail.thom.fr.eu.org (unknown [82.64.149.25]) by smtp5-g21.free.fr (Postfix) with ESMTPS id AD2C460129; Tue, 19 Nov 2024 08:27:06 +0100 (CET) Received: from localhost ([127.0.0.1]) by mail.thom.fr.eu.org (8.15.2/8.15.2/Debian-22+deb11u3) with ESMTP id 4AJ7Qj0k2760350; Tue, 19 Nov 2024 08:26:56 +0100 DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/simple; d=thom.fr.eu.org; s=default; t=1732001222; bh=ywt1L5eYl8KgsTZktjdRf29vT0L7u5h//9J72LmT518=; h=From:In-Reply-To:Date:Cc:To:Subject; b=hJz2JeLo8ZOUb+wCvy3P/XZeI5ujuZ97tuAEIRIq+BanJe2/zkKaU7goHk/3hECEH wwRSkGMY42rEdjLFQSZlunZhlGUD2YRh6z7sAnWe3/knGArMY4uXzx/E6IWP5DTmlQ cJHLDfOKBtobgShD0wZgczPOmE5qPpL/J6YOHS3mYikl9noMZWn9cpN3iJd+DO9OSw ixr/n60wW2Z4vvK6+ZRyGo77eEnDFKHVP7okWUmTWq7HtueeCbYiIvD9qJY0wVKWCe ONrfiWd/g3O/NlfOEtCuL+N8Qpj/zLw/XOVd6B8cv+EQmwzoFbKEpc8EgAtffw171h XETsySo2hTNRQ== From: =?utf-8?q?Fran=C3=A7ois_Legal?= In-Reply-To: <87v7wkimjd.fsf@xenomai.org> Content-Type: text/plain; charset="utf-8" X-Forward: 217.109.173.233, 194.9.98.110 Date: Tue, 19 Nov 2024 08:26:45 +0100 Cc: "Florian Bezdeka" , "Jan Kiszka" , xenomai@xenomai.org, =?utf-8?q?=E5=AD=99=E6=B6=9B?= To: "Philippe Gerum" Precedence: bulk X-Mailing-List: xenomai@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <1017-673c3d80-39-2c5d8800@259497031> Subject: =?utf-8?q?Re=3A?= Switching from xenomai 3.2 IPIPE to xenomai 3.3 Dovetail User-Agent: SOGoMail 5.0.1 Content-Transfer-Encoding: quoted-printable X-Virus-Scanned: clamav-milter 0.103.10 at tls-srv-03 X-Virus-Status: Clean Authentication-Results: spool.mail.gandi.net; dkim=fail ("headers rsa verify failed") header.d=thom.fr.eu.org header.s=default header.b=hJz2JeLo; dmarc=none; spf=pass (spool.mail.gandi.net: domain of devel@thom.fr.eu.org designates 212.27.42.5 as permitted sender) smtp.mailfrom=devel@thom.fr.eu.org Le Lundi, Novembre 18, 2024 16:33 CET, Philippe Gerum = a =C3=A9crit: > Fran=C3=A7ois Legal writes: > > > Le Lundi, Novembre 18, 2024 15:49 CET, Philippe Gerum a =C3=A9crit: > > > >> Florian Bezdeka writes: > >> > >> > On Mon, 2024-11-18 at 14:37 +0100, Philippe Gerum wrote: > >> >> Fran=C3=A7ois Legal writes: > >> >> > >> >> > Le Lundi, Novembre 18, 2024 13:06 CET, Florian Bezdeka a =C3=A9crit: > >> >> > > >> >> > > > >> >> > > [ Updated CC list to merge both mail threads ] > >> >> > > > >> >> > > On Mon, 2024-11-18 at 12:37 +0100, Philippe Gerum wrote: > >> >> > > > Fran=C3=A7ois Legal writes: > >> >> > > > > >> >> > > > > Le Lundi, Novembre 18, 2024 11:32 CET, Florian Bezdeka = a =C3=A9crit: > >> >> > > > > =C2=A0 > >> >> > > > > > On Mon, 2024-11-18 at 11:21 +0100, Fran=C3=A7ois Lega= l wrote: > >> >> > > > > > > Le Lundi, Novembre 18, 2024 10:01 CET, Jan Kiszka <= jan.kiszka@siemens.com> a =C3=A9crit: > >> >> > > > > > > =C2=A0 > >> >> > > > > > > > On 18.11.24 09:50, Fran=C3=A7ois Legal wrote: > >> >> > > > > > > > > Hello, > >> >> > > > > > > > > > >> >> > > > > > > > > running on an Arm v7 cortex A9 platform, I'm tr= ying to switch from xenomai 3.2 (linux 5.4 IPIPE) to xenomai 3.3 (linux= 5.15 Dovetail). > >> >> > > > > > > > > > >> >> > > > > > > > > I can successfully boot my system with linux 5.= 15 + CONFIG=5FDOVETAIL, but as soon as I enable Xenomai (CONFIG=5FXENOM= AI), I got stuck at boot in a do=5Fidle loop. Did I miss anything ? > >> >> > > > > > > > > > >> >> > > > > > > > > Attached is my config. > >> >> > > > > > > > > >> >> > > > > > > > Can you factor out from it what the SoC is, if yo= u patched the kernel > >> >> > > > > > > > for it (in the past and now), if you had to adopt= Dovetail etc.? > >> >> > > > > > > > > >> >> > > > > > > > Jan > >> >> > > > > > > > >> >> > > > > > > The SoC is Xilinx zynq 7000. I have custom patches = for custom FPGA peripherals (which most of them have been successfully = ported to 5.15). > >> >> > > > > > > >> >> > > > > > We had a similar report for the zynq 7020 a couple of= days ago. > >> >> > > > > > See [1]. > >> >> > > > > > > >> >> > > > > > What happens if you disable CONFIG=5FSMP? (Not that t= his should be the > >> >> > > > > > final solution, but it might help to track the issue = down...) > >> >> > > > > > > >> >> > > > > > Florian > >> >> > > > > > > >> >> > > > > > >> >> > > > > Disabling config SMP makes my system boot again. > >> >> > > > > How can I help working this out ? > >> >> > > > > > >> >> > > > > Fran=C3=A7ois > >> >> > > > > > >> >> > > > > >> >> > > > This looks like an issue with the proxy tick device. Firs= t thing is to > >> >> > > > disable CONFIG=5FXENOMAI, enabling CONFIG=5FIRQ=5FPIPELIN= E=5FTORTURE=5FTEST. If > >> >> > > > the kernel still hangs, we may have a hint about the reas= on > >> >> > > > why. Alternatively, you could keep CONFIG=5FXENOMAI in, b= ooting the kernel > >> >> > > > with "xenomai.state=3Dstopped". If no hang occurs at boot= anymore, there > >> >> > > > may be an issue with proxying the timer device on this So= C. > >> >> > > > > >> >> > > >> >> > CONFIG=5FIRQ=5FPIPELINE=5FTORTURE=5FTEST seems to report OK (= attached bootlog CONFIG=5FIRQ=5FPIPELINE=5FTORTURE=5FTEST.boot > >> >> > > >> >> > Starting with "xenomai.state=3Dstopped" works (attached boolo= g xenomai.state-stopped.boot) > >> >> > Starting up xenomai with coreclk afterwards seem to work and = not hang system : > >> >> > root@Arkens=5FSV:~# /usr/xenomai/sbin/corectl -start > >> >> > [ 117.328878] CPU1: proxy tick device registered (333.33MHz)= > >> >> > [ 117.328883] CPU0: proxy tick device registered (333.33MHz)= > >> >> > [ 117.339995] [Xenomai] services started > >> >> > > >> >> > > >> >> > >> >> Ok, so another usual suspect for this issue: some weirdness in = the CPU > >> >> idling code, which causes a (timer) interrupt to linger indefin= itely in > >> >> some per-CPU interrupt log. A typical scenario is as follows: > >> >> > >> >> CPUx > >> >> ---- > >> >> > >> >> default=5Fidle=5Fcall() { > >> >> > >> >> ... > >> >> -> logged because local=5Firq=5Fdisable() in effect, =5Fh= owever=5F we do NOT > >> >> expect hard irqs to be enabled [1] before entering the= idle call > >> >> next =3D> issue is there. > >> >> arch=5Fcpu=5Fidle(); > >> >> ... > >> >> /* per-CPU log is not flushed, because of [1] */ > >> >> } > >> >> > >> >> At the end of the day, the (most likely) timer IRQ is marked as= pending > >> >> in the log, but never played, so the kernel activity stalls on = that CPU, > >> >> especially if the boot CPU is involved. > >> >> > >> > > >> > Taken from the boot log: > >> > > >> > [ 0.000024] clocksource: arm=5Fglobal=5Ftimer: freq: 16666666= 5 Hz, mask: 0xffffffffffffffff max=5Fcycles: 0x26703d7dd8, max=5Fidle=5F= ns: 440795208065 ns > >> > [ 0.012959] clocksource: jiffies: freq: 0 Hz, mask: 0xfffffff= f max=5Fcycles: 0xffffffff, max=5Fidle=5Fns: 19112604462750000 ns > >> > [ 0.587268] clocksource: Switched to clocksource arm=5Fglobal= =5Ftimer > >> > [ 1.065121] clocksource: ttc=5Fclocksource: freq: 54253 Hz, m= ask: 0xffff max=5Fcycles: 0xffff, max=5Fidle=5Fns: 537538477 ns > >> > > >> > So the last active clocksource is ttc=5Fclocksource > >> > (drivers/clocksource/timer-cadence-ttc.c). > >> > If I'm correct the OOB enablement is missing for this driver. > >> > > >> > Philippe already pointed us to > >> > https://v4.xenomai.org/dovetail/porting/timer/. > >> > > >> > Could someone try that? I have matching HW at hand... > >> > > >> > >> The following code is a 100%, happily untested attempt to enable t= he ttc > >> device for pipelining (timer events and reading its clock source > >> directly from user-space via mmio as well). I don't have any zynq = hw at > >> hand to test it either. > >> > >> diff --git a/drivers/clocksource/timer-cadence-ttc.c b/drivers/clo= cksource/timer-cadence-ttc.c > >> index 0d52e28fea4de..fcab778448bba 100644 > >> --- a/drivers/clocksource/timer-cadence-ttc.c > >> +++ b/drivers/clocksource/timer-cadence-ttc.c > >> @@ -84,11 +84,11 @@ struct ttc=5Ftimer=5Fclocksource { > >> u32 scale=5Fclk=5Fctrl=5Freg=5Fold; > >> u32 scale=5Fclk=5Fctrl=5Freg=5Fnew; > >> struct ttc=5Ftimer ttc; > >> - struct clocksource cs; > >> + struct clocksource=5Fuser=5Fmmio cs; > >> }; > >> > >> #define to=5Fttc=5Ftimer=5Fclksrc(x) \ > >> - container=5Fof(x, struct ttc=5Ftimer=5Fclocksource, cs) > >> + container=5Fof(x, struct ttc=5Ftimer=5Fclocksource, cs.mmio.clk= src) > >> > >> struct ttc=5Ftimer=5Fclockevent { > >> struct ttc=5Ftimer ttc; > >> @@ -143,24 +143,11 @@ static irqreturn=5Ft ttc=5Fclock=5Fevent=5Fi= nterrupt(int irq, void *dev=5Fid) > >> /* Acknowledge the interrupt and call event handler */ > >> readl=5Frelaxed(timer->base=5Faddr + TTC=5FISR=5FOFFSET); > >> > >> - ttce->ce.event=5Fhandler(&ttce->ce); > >> + clockevents=5Fhandle=5Fevent(&ttce->ce); > >> > >> return IRQ=5FHANDLED; > >> } > >> > >> -/** > >> - * =5F=5Fttc=5Fclocksource=5Fread - Reads the timer counter regis= ter > >> - * > >> - * returns: Current timer counter register value > >> - **/ > >> -static u64 =5F=5Fttc=5Fclocksource=5Fread(struct clocksource *cs)= > >> -{ > >> - struct ttc=5Ftimer *timer =3D &to=5Fttc=5Ftimer=5Fclksrc(cs)->tt= c; > >> - > >> - return (u64)readl=5Frelaxed(timer->base=5Faddr + > >> - TTC=5FCOUNT=5FVAL=5FOFFSET); > >> -} > >> - > >> static u64 notrace ttc=5Fsched=5Fclock=5Fread(void) > >> { > >> return readl=5Frelaxed(ttc=5Fsched=5Fclock=5Fval=5Freg); > >> @@ -320,6 +307,7 @@ static int ttc=5Frate=5Fchange=5Fclocksource=5F= cb(struct notifier=5Fblock *nb, > >> static int =5F=5Finit ttc=5Fsetup=5Fclocksource(struct clk *clk, = void =5F=5Fiomem *base, > >> u32 timer=5Fwidth) > >> { > >> + struct clocksource=5Fmmio=5Fregs mmr =3D { 0 }; > >> struct ttc=5Ftimer=5Fclocksource *ttccs; > >> int err; > >> > >> @@ -347,11 +335,11 @@ static int =5F=5Finit ttc=5Fsetup=5Fclocksou= rce(struct clk *clk, void =5F=5Fiomem *base, > >> pr=5Fwarn("Unable to register clock notifier.\n"); > >> > >> ttccs->ttc.base=5Faddr =3D base; > >> - ttccs->cs.name =3D "ttc=5Fclocksource"; > >> - ttccs->cs.rating =3D 200; > >> - ttccs->cs.read =3D =5F=5Fttc=5Fclocksource=5Fread; > >> - ttccs->cs.mask =3D CLOCKSOURCE=5FMASK(timer=5Fwidth); > >> - ttccs->cs.flags =3D CLOCK=5FSOURCE=5FIS=5FCONTINUOUS; > >> + ttccs->cs.mmio.clksrc.name =3D "ttc=5Fclocksource"; > >> + ttccs->cs.mmio.clksrc.rating =3D 200; > >> + ttccs->cs.mmio.clksrc.read =3D clocksource=5Fmmio=5Freadl=5Fup, > >> + ttccs->cs.mmio.clksrc.mask =3D CLOCKSOURCE=5FMASK(timer=5Fwidth)= ; > >> + ttccs->cs.mmio.clksrc.flags =3D CLOCK=5FSOURCE=5FIS=5FCONTINUOUS= ; > >> > >> /* > >> * Setup the clock source counter to be an incrementing counter > >> @@ -364,7 +352,10 @@ static int =5F=5Finit ttc=5Fsetup=5Fclocksour= ce(struct clk *clk, void =5F=5Fiomem *base, > >> writel=5Frelaxed(CNT=5FCNTRL=5FRESET, > >> ttccs->ttc.base=5Faddr + TTC=5FCNT=5FCNTRL=5FOFFSET); > >> > >> - err =3D clocksource=5Fregister=5Fhz(&ttccs->cs, ttccs->ttc.freq = / PRESCALE); > >> + mmr.reg=5Flower =3D ttccs->ttc.base=5Faddr + TTC=5FCOUNT=5FVAL=5F= OFFSET; > >> + mmr.bits=5Flower =3D 32; > >> + > >> + err =3D clocksource=5Fuser=5Fmmio=5Finit(&ttccs->cs, &mmr, ttccs= ->ttc.freq / PRESCALE); > >> if (err) { > >> kfree(ttccs); > >> return err; > >> @@ -431,7 +422,8 @@ static int =5F=5Finit ttc=5Fsetup=5Fclockevent= (struct clk *clk, > >> > >> ttcce->ttc.base=5Faddr =3D base; > >> ttcce->ce.name =3D "ttc=5Fclockevent"; > >> - ttcce->ce.features =3D CLOCK=5FEVT=5FFEAT=5FPERIODIC | CLOCK=5FE= VT=5FFEAT=5FONESHOT; > >> + ttcce->ce.features =3D CLOCK=5FEVT=5FFEAT=5FPERIODIC | \ > >> + CLOCK=5FEVT=5FFEAT=5FONESHOT | CLOCK=5FEVT=5FFEAT=5FPIPELINE; > >> ttcce->ce.set=5Fnext=5Fevent =3D ttc=5Fset=5Fnext=5Fevent; > >> ttcce->ce.set=5Fstate=5Fshutdown =3D ttc=5Fshutdown; > >> ttcce->ce.set=5Fstate=5Fperiodic =3D ttc=5Fset=5Fperiodic; > >> > >> -- > > > > I just gave it a try, but with no success. I hadtried a patch of mi= ne too with the same result. > > I wonder however if this is really the problem here as when I get s= tuck at boot, the last declare time source is the Arm GT : > > > > Here : > > [ 0.614817] clocksource: Switched to clocksource arm=5Fglobal=5F= timer > > > > [ 0.628544] NET: Registered PF=5FINET protocol family > > [ 0.633699] IP idents hash table entries: 16384 (order: 5, 13107= 2 bytes, linear) > > [ 0.642170] tcp=5Flisten=5Fportaddr=5Fhash hash table entries: 5= 12 (order: 0, 4096 bytes, linear) > > [ 0.650587] Table-perturb hash table entries: 65536 (order: 6, 2= 62144 bytes, linear) > > [ 0.658339] TCP established hash table entries: 8192 (order: 3, = 32768 bytes, linear) > > [ 0.666173] TCP bind hash table entries: 8192 (order: 4, 65536 b= ytes, linear) > > [ 0.673540] TCP: Hash tables configured (established 8192 bind 8= 192) > > [ 0.679986] UDP hash table entries: 512 (order: 2, 16384 bytes, = linear) > > [ 0.686665] UDP-Lite hash table entries: 512 (order: 2, 16384 by= tes, linear) > > [ 0.693937] NET: Registered PF=5FUNIX/PF=5FLOCAL protocol family= > > [ 0.700355] RPC: Registered named UNIX socket transport module. > > [ 0.706274] RPC: Registered udp transport module. > > [ 0.710989] RPC: Registered tcp transport module. > > [ 0.715691] RPC: Registered tcp NFSv4.1 backchannel transport mo= dule. > > [ 0.722914] [Xenomai] scheduling class idle registered. > > [ 0.728138] [Xenomai] scheduling class rt registered. > > [ 0.733243] IRQ pipeline: high-priority Xenomai stage added. > > [ 0.740572] CPU0: proxy tick device registered (333.33MHz) > > [ 0.740575] CPU1: proxy tick device registered (333.33MHz) > > [ 0.752600] [Xenomai] Cobalt v3.3 > > [ 0.756129] workingset: timestamp=5Fbits=3D30 max=5Forder=3D18 b= ucket=5Forder=3D0 > > [ 0.879595] NET: Registered PF=5FALG protocol family > > [ 0.884507] bounce: pool size: 64 pages > > [ 0.888358] io scheduler mq-deadline registered > > [ 0.896523] dma-pl330 f8003000.dmac: Loaded driver for PL330 DMA= C-241330 > > [ 0.903234] dma-pl330 f8003000.dmac: DBUFF-128x8bytes Nu= m=5FChans-8 Num=5FPeri-4 Num=5FEvents-16 > > [ 0.919795] brd: module loaded > > > > then hung from here > > > > What if you disable CONFIG=5FCPUIDLE? It's already disabled. Fran=C3=A7ois > > -- > Philippe.