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

Re: [Xen-devel] [PATCH v3 4/5] x86: Port the basic alternative mechanism from Linux to Xen




> -----Original Message-----
> From: Jan Beulich [mailto:JBeulich@xxxxxxxx]
> Sent: Tuesday, June 03, 2014 6:51 PM
> To: Wu, Feng
> Cc: andrew.cooper3@xxxxxxxxxx; ian.campbell@xxxxxxxxxx;
> stefano.stabellini@xxxxxxxxxx; keir.xen@xxxxxxxxx; xen-devel@xxxxxxxxxxxxx;
> boris.ostrovsky@xxxxxxxxxx; tim@xxxxxxx
> Subject: RE: [PATCH v3 4/5] x86: Port the basic alternative mechanism from
> Linux to Xen
> 
> >>> On 03.06.14 at 12:35, <feng.wu@xxxxxxxxx> wrote:
> 
> >
> >> -----Original Message-----
> >> From: Jan Beulich [mailto:JBeulich@xxxxxxxx]
> >> Sent: Tuesday, June 03, 2014 6:25 PM
> >> To: Wu, Feng
> >> Cc: andrew.cooper3@xxxxxxxxxx; ian.campbell@xxxxxxxxxx;
> >> stefano.stabellini@xxxxxxxxxx; keir.xen@xxxxxxxxx;
> xen-devel@xxxxxxxxxxxxx;
> >> boris.ostrovsky@xxxxxxxxxx; tim@xxxxxxx
> >> Subject: RE: [PATCH v3 4/5] x86: Port the basic alternative mechanism from
> >> Linux to Xen
> >>
> >> >>> On 03.06.14 at 12:13, <feng.wu@xxxxxxxxx> wrote:
> >> >> -----Original Message-----
> >> >> From: Jan Beulich [mailto:JBeulich@xxxxxxxx]
> >> >> Sent: Tuesday, June 03, 2014 6:00 PM
> >> >> To: Wu, Feng
> >> >> Cc: andrew.cooper3@xxxxxxxxxx; ian.campbell@xxxxxxxxxx;
> >> >> stefano.stabellini@xxxxxxxxxx; keir.xen@xxxxxxxxx;
> >> xen-devel@xxxxxxxxxxxxx;
> >> >> boris.ostrovsky@xxxxxxxxxx; tim@xxxxxxx
> >> >> Subject: Re: [PATCH v3 4/5] x86: Port the basic alternative mechanism
> from
> >> >> Linux to Xen
> >> >>
> >> >> >>> On 30.05.14 at 10:56, <feng.wu@xxxxxxxxx> wrote:
> >> >> > +#ifdef K8_NOP1
> >> >> > +static const unsigned char k8nops[] __initconst = {
> >> >> > +    K8_NOP1,
> >> >> > +    K8_NOP2,
> >> >> > +    K8_NOP3,
> >> >> > +    K8_NOP4,
> >> >> > +    K8_NOP5,
> >> >> > +    K8_NOP6,
> >> >> > +    K8_NOP7,
> >> >> > +    K8_NOP8
> >> >> > +};
> >> >> > +static const unsigned char * const k8_nops[ASM_NOP_MAX+1]
> >> __initconst =
> >> >> {
> >> >> > +    NULL,
> >> >> > +    k8nops,
> >> >> > +    k8nops + 1,
> >> >> > +    k8nops + 1 + 2,
> >> >> > +    k8nops + 1 + 2 + 3,
> >> >> > +    k8nops + 1 + 2 + 3 + 4,
> >> >> > +    k8nops + 1 + 2 + 3 + 4 + 5,
> >> >> > +    k8nops + 1 + 2 + 3 + 4 + 5 + 6,
> >> >> > +    k8nops + 1 + 2 + 3 + 4 + 5 + 6 + 7
> >> >> > +};
> >> >> > +#endif
> >> >> > +
> >> >> > +#ifdef P6_NOP1
> >> >> > +static const unsigned char p6nops[] __initconst = {
> >> >> > +    P6_NOP1,
> >> >> > +    P6_NOP2,
> >> >> > +    P6_NOP3,
> >> >> > +    P6_NOP4,
> >> >> > +    P6_NOP5,
> >> >> > +    P6_NOP6,
> >> >> > +    P6_NOP7,
> >> >> > +    P6_NOP8
> >> >> > +};
> >> >> > +static const unsigned char * const p6_nops[ASM_NOP_MAX+1]
> >> __initconst =
> >> >> {
> >> >> > +    NULL,
> >> >> > +    p6nops,
> >> >> > +    p6nops + 1,
> >> >> > +    p6nops + 1 + 2,
> >> >> > +    p6nops + 1 + 2 + 3,
> >> >> > +    p6nops + 1 + 2 + 3 + 4,
> >> >> > +    p6nops + 1 + 2 + 3 + 4 + 5,
> >> >> > +    p6nops + 1 + 2 + 3 + 4 + 5 + 6,
> >> >> > +    p6nops + 1 + 2 + 3 + 4 + 5 + 6 + 7
> >> >> > +};
> >> >> > +#endif
> >> >>
> >> >> The uses of __initconst together with -fPIC cause build problems on
> >> >> older gcc. I fixed this up in a temporary way, but put a work item on
> >> >> my todo list to deal with this properly while at once converting
> >> >> alternative.o to alternative.init.o (as the file consists of only init
> >> >> code and data).
> >> >
> >> > Thanks a lot for pointing this out. Do I need to do something for this?
> >>
> >> If you're up to it, you could of course save me the time to do what I
> >> outlined above...
> >
> > From the above you mentioned, seems we cannot use __initconst together
> with
> > -fPIC on
> > some old gcc. Do you know what is the reason, and does the problem occur
> > with "__initdata ", "__init ", etc?
> 
> The problem is only with __initconst afaict, the reason being that with
> -fPIC constant data with relocations doesn't get put into r/o sections
> (irrespective of the "const" modifier) by older gcc versions.
> 
> Jan

I am a little curious, from xen.lds.S, we can see both *(.init.data) and 
*(.init.rodata) go into section .init.data.
So even we use __initconst and "const" modifier, the data is still not 
constant, right?

Thanks,
Feng

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

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