[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] Xen optimization



On Mon, 15 Oct 2018, Milan Boberic wrote:
> In attachment are device-tree files I found in my project:
> 
> device-tree.bbappend - under
> <path_to_project>/uz3eg_iocc_2018_2/project-spec/meta-user/recipes-bsp/device-tree/
> 
> xen-overlay.dtsi , system-user.dtsi and zunqmp-qemu-arm.dts - under
> <path_to_project>/uz3eg_iocc_2018_2/project-spec/meta-user/recipes-bsp/device-tree/files
> 
> zynqmp-qemu-multiarch-arm and zynqmp-qemu-pmu - under
> <path_to_project>/uz3eg_iocc_2018_2/project-spec/meta-user/recipes-bsp/device-tree/files/multi-arch
> 
> pcw.dtsi , pl.dtsi , system-conf.dtsi , sistem-top.dts ,
> zynqmp-clk-ccf.dtsi and zynqmp.dtsi -
> under<path_to_project>/uz3eg_iocc_2018_2/components/plnx_workspace/device-tree/device-tree/
> 
> In system-conf.dtsi file first line says:
> /*
>  * CAUTION: This file is automatically generated by PetaLinux SDK.
>  * DO NOT modify this file
>  */
> and there is no sigh of timer.
> If you could take a look at this and other files in attachment it
> would be great.

The device tree with everything seems to be system.dts, that was enough
:-)  I don't need the dtsi files you used to build the final dts, I only
need the one you use in uboot and for your guest.

In system.dts, the timers are all there:

                timer@ff110000 {
                        compatible = "cdns,ttc";
                        status = "okay";
                        interrupt-parent = <0x4>;
                        interrupts = <0x0 0x24 0x4 0x0 0x25 0x4 0x0 0x26 0x4>;
                        reg = <0x0 0xff110000 0x0 0x1000>;
                        timer-width = <0x20>;
                        power-domains = <0x3b>;
                        clocks = <0x3 0x1f>;
                        xen,passthrough;
                };

                timer@ff120000 {
                        compatible = "cdns,ttc";
                        status = "disabled";
                        interrupt-parent = <0x4>;
                        interrupts = <0x0 0x27 0x4 0x0 0x28 0x4 0x0 0x29 0x4>;
                        reg = <0x0 0xff120000 0x0 0x1000>;
                        timer-width = <0x20>;
                        power-domains = <0x3b>;
                        clocks = <0x3 0x1f>;
                };

                timer@ff130000 {
                        compatible = "cdns,ttc";
                        status = "disabled";
                        interrupt-parent = <0x4>;
                        interrupts = <0x0 0x2a 0x4 0x0 0x2b 0x4 0x0 0x2c 0x4>;
                        reg = <0x0 0xff130000 0x0 0x1000>;
                        timer-width = <0x20>;
                        power-domains = <0x3c>;
                        clocks = <0x3 0x1f>;
                };

                timer@ff140000 {
                        compatible = "cdns,ttc";
                        status = "disabled";
                        interrupt-parent = <0x4>;
                        interrupts = <0x0 0x2d 0x4 0x0 0x2e 0x4 0x0 0x2f 0x4>;
                        reg = <0x0 0xff140000 0x0 0x1000>;
                        timer-width = <0x20>;
                        power-domains = <0x3d>;
                        clocks = <0x3 0x1f>;
                };

It looks like you set xen,passthrough correctly in system.dts for
timer@ff110000, serial@ff010000, and gpio@ff0a0000.



> I also tried to run bare-metal app with this changes and it worked, added:
> 
> &ttc0 {
>         status = "okay";
>         compatible = "cdns,ttc";
>         interrupt-parent = <0x4>;
>         interrupts = <0x0 0x24 0x4 0x0 0x25 0x4 0x0 0x26 0x4>;
>         reg = <0x0 0xff110000 0x0 0x1000>;
>         timer-width = <0x20>;
>         power-domains = <0x3b>;
>         xen,passthrough;
> 
> };
> 
> in xen-overlay.dtsi file, because it's overlay it shouldn't duplicate
> timer nod, right?

As I wrote, system.dts looks correct.


> After build I ran:
>  dtc -I dtb -O dts -o system.dts system.dtb
> and checked for ttc0, it seems okay except interrupt-parent is <0x4>
> not <0x2> like in your example:

I don't know what you are referring to. In the system.dts you attached
interrupt-parent is <0x4> which is correct:

                timer@ff110000 {
                        compatible = "cdns,ttc";
                        status = "okay";
                        interrupt-parent = <0x4>;


> timer@ff110000 {
> compatible = "cdns,ttc";
> status = "okay";
> interrupt-parent = <0x4>;
> interrupts = <0x0 0x24 0x4 0x0 0x25 0x4 0x0 0x26 0x4>;
> reg = <0x0 0xff110000 0x0 0x1000>;
> timer-width = <0x20>;
> power-domains = <0x3b>;
> clocks = <0x3 0x1f>;
> xen,passthrough;
> };
> status was "disable" before.
> system.dts is also added in attachment.

status is "okay" in the system.dts you attached. That is important
because status = "disable" it means the device cannot be used.


> Is this the working passthrough?Because jitter is the same .
> 
> When legit, working passthrough is set correctly, jitter should be
> smaller, right?

If you are not getting any errors anymore when creating your baremetal
guest, then yes, it should be working passthrough. I would double-check
that everything is working as expected using the DEBUG patch for Xen I
suggested to you in the other email. You might even want to remove the
"if" check and always print something for every interrupt of your guest
just to get an idea of what's going on. See the attached patch.

Once everything is as expected I would change the frequency of the
timer, because 1u is way too frequent. I think it should be at least
3us, more like 5us. Keep in mind that jitter is about having
deterministic IRQ latency, not about having extremely frequent
interrupts.

I would also double check that you are not using any other devices or
virtual interfaces in your baremetal app because that could negatively
affect the numbers. For instance, Linux by default uses the virtual
timer interface ("arm,armv8-timer", I would double check that the
baremetal app is not doing the same -- you don't want to be using two
timers when doing your measurements.


> Thanks in advance!
> Milan
> On Mon, Oct 15, 2018 at 12:50 AM Stefano Stabellini
> <stefano.stabellini@xxxxxxxxxx> wrote:
> >
> > On Sat, 13 Oct 2018, Milan Boberic wrote:
> > > > This is definitely wrong. Can you please also post the full host device
> > > > tree with your modifications that you are using for Xen and Dom0?  You
> > > > should have something like:
> > > >
> > > >         timer@ff110000 {
> > > >             compatible = "cdns,ttc";
> > > >             interrupt-parent = <0x2>;
> > > >             interrupts = <0x0 0x24 0x4 0x0 0x25 0x4 0x0 0x26 0x4>;
> > > >             reg = <0x0 0xff110000 0x0 0x1000>;
> > > >             timer-width = <0x20>;
> > > >             power-domains = <0x3b>;
> > > >             xen,passthrough;
> > > >         };
> > > > For each of the nodes of the devices you are assigning to the DomU.
> > >
> > > I put
> > > &ttc0 {
> > >    xen,passthrough = <0x1>;
> > > };
> > > because when I was making bm app I was following this guide. Now I see
> > > it's wrong. When I copied directly:
> > > timer@ff110000 {
> > >             compatible = "cdns,ttc";
> > >             interrupt-parent = <0x2>;
> > >             interrupts = <0x0 0x24 0x4 0x0 0x25 0x4 0x0 0x26 0x4>;
> > >             reg = <0x0 0xff110000 0x0 0x1000>;
> > >             timer-width = <0x20>;
> > >             power-domains = <0x3b>;
> > >             xen,passthrough;
> > >         };
> > > in to the xen-overlay.dtsi file it resulted an error during
> > > device-tree build. I modified it a little bit so I can get successful
> > > build, there are all device-tree files included in attachment. I'm not
> > > sure how to set this passthrough properly, if you could take a look at
> > > those files in attachment I'd be more then grateful.
> > >
> > > > It's here: 
> > > > https://github.com/Xilinx/xen/blob/xilinx/stable-4.9/xen/arch/arm/vgic.c#L462
> > > Oh, about that. I sent you wrong branch, I was using Xen 4.10. Anyway
> > > now I moved to Xen 4.11 like you suggested and applied your patch and
> > > Dario's also.
> > >
> > > Okay, now when I want to xl create my domU (bare-metal app) I get error:
> > >
> > > Parsing config from timer.cfg
> > > (XEN) IRQ 68 is already used by domain 0
> > > libxl: error: libxl_create.c:1354:domcreate_launch_dm: Domain 1:failed
> > > give domain access to irq 68: Device or resource busy
> > > libxl: error: libxl_domain.c:1034:libxl__destroy_domid: Domain
> > > 1:Non-existant domain
> > > libxl: error: libxl_domain.c:993:domain_destroy_callback: Domain
> > > 1:Unable to destroy guest
> > > libxl: error: libxl_domain.c:920:domain_destroy_cb: Domain
> > > 1:Destruction of domain failed
> >
> > That means that the "xen,passthrough" addition to the host device tree went 
> > wrong.
> >
> >
> > > I guess my modifications of:
> > > timer@ff110000 {
> > >             compatible = "cdns,ttc";
> > >             interrupt-parent = <0x2>;
> > >             interrupts = <0x0 0x24 0x4 0x0 0x25 0x4 0x0 0x26 0x4>;
> > >             reg = <0x0 0xff110000 0x0 0x1000>;
> > >             timer-width = <0x20>;
> > >             power-domains = <0x3b>;
> > >             xen,passthrough;
> > >         };
> > > are not correct.
> >
> > Right
> >
> >
> > > I tried to change interrupts to:
> > >  interrupts = <0x0 0x44 0x4 0x0 0x45 0x4 0x0 0x46 0x4>;
> > > because if you check here on page 310 interrupts for TTC0 are 68:70.
> > > But that didn't work either I still get same error.
> >
> > The interrupt numbers specified in the DTS are the real interrupt minus
> > 32: 68-32 = 36 = 0x24. The DTS was correct.
> >
> >
> > > I also tried to change xen,passthrough; line with:
> > > xen,passthrough = <0x1>;
> > > but also without success, still the same error.
> > >
> > > Are you sure about this line:
> > > reg = <0x0 0xff110000 0x0 0x1000>;   ?
> > > Or it should be like this?
> > >  reg = <0x0 0xff110000 0x1000>;
> >
> > Yes, that could be a problem. The format depends on the #address-cells
> > and #size-cells parameters. You didn't send me system-conf.dtsi, so I
> > don't know for sure which one of the two is right. In any case, you
> > should not duplicate the timer@ff110000 node in device tree. You should
> > only add "xen,passthrough;" to the existing timer@ff110000 node, which
> > is probably in system-conf.dtsi. So, avoid adding a new timer node to
> > xen-overlay.dtsi, and instead modify system-conf.dtsi.
> >
> >
> > > I also included xl dmesg and dmesg in attachments (after xl create of bm 
> > > app).
> > >
> > > Thanks in advance!
> > >
> > > Milan
> > >
> 

Attachment: 5
Description: Text document

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.