From: "Jan Beulich" Subject: Re: [PATCH v3 4/5] x86: Port the basic alternative mechanism from Linux to Xen Date: Tue, 03 Jun 2014 11:51:29 +0100 Message-ID: <538DC4D10200007800017488@mail.emea.novell.com> References: <1401440185-11266-1-git-send-email-feng.wu@intel.com> <1401440185-11266-5-git-send-email-feng.wu@intel.com> <538DB8CB02000078000173D7@mail.emea.novell.com> <538DBEA70200007800017422@mail.emea.novell.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Feng Wu Cc: "ian.campbell@citrix.com" , "andrew.cooper3@citrix.com" , "tim@xen.org" , "xen-devel@lists.xen.org" , "keir.xen@gmail.com" , "stefano.stabellini@citrix.com" , "boris.ostrovsky@oracle.com" List-Id: xen-devel@lists.xenproject.org >>> On 03.06.14 at 12:35, wrote: > >> -----Original Message----- >> From: Jan Beulich [mailto:JBeulich@suse.com] >> Sent: Tuesday, June 03, 2014 6:25 PM >> To: Wu, Feng >> Cc: andrew.cooper3@citrix.com; ian.campbell@citrix.com; >> stefano.stabellini@citrix.com; keir.xen@gmail.com; xen-devel@lists.xen.org; >> boris.ostrovsky@oracle.com; tim@xen.org >> Subject: RE: [PATCH v3 4/5] x86: Port the basic alternative mechanism from >> Linux to Xen >> >> >>> On 03.06.14 at 12:13, wrote: >> >> -----Original Message----- >> >> From: Jan Beulich [mailto:JBeulich@suse.com] >> >> Sent: Tuesday, June 03, 2014 6:00 PM >> >> To: Wu, Feng >> >> Cc: andrew.cooper3@citrix.com; ian.campbell@citrix.com; >> >> stefano.stabellini@citrix.com; keir.xen@gmail.com; >> xen-devel@lists.xen.org; >> >> boris.ostrovsky@oracle.com; tim@xen.org >> >> Subject: Re: [PATCH v3 4/5] x86: Port the basic alternative mechanism from >> >> Linux to Xen >> >> >> >> >>> On 30.05.14 at 10:56, 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