From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Cooper Subject: Re: [PATCH 4/4] sched: Use the auto-generated list of schedulers Date: Fri, 18 Dec 2015 17:30:10 +0000 Message-ID: <567442A2.30106@citrix.com> References: <1450385974-12732-1-git-send-email-jonathan.creekmore@gmail.com> <1450385974-12732-5-git-send-email-jonathan.creekmore@gmail.com> <5673F2EF02000078000C1194@prv-mh.provo.novell.com> <567445CE02000078000C1645@prv-mh.provo.novell.com> <1F59ABD7-C8E2-4B0A-88C9-B9D8DAFCA2DA@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1a9yr9-0003oh-M5 for xen-devel@lists.xenproject.org; Fri, 18 Dec 2015 17:30:15 +0000 In-Reply-To: <1F59ABD7-C8E2-4B0A-88C9-B9D8DAFCA2DA@gmail.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Jonathan Creekmore , Jan Beulich Cc: George Dunlap , xen-devel@lists.xenproject.org, Dario Faggioli List-Id: xen-devel@lists.xenproject.org On 18/12/15 17:24, Jonathan Creekmore wrote: >> On Dec 18, 2015, at 10:43 AM, Jan Beulich wrote: >> >>>>> On 18.12.15 at 17:00, wrote: >>> Jan Beulich writes: >>>>>>> On 17.12.15 at 21:59, wrote: >>>>> +extern const struct scheduler *__schedulers_start[], *__schedulers_end[]; >>>>> +#define NUM_SCHEDULERS >>> (((uintptr_t)__schedulers_end-(uintptr_t)__schedulers_start) \ >>>>> + / sizeof(struct scheduler *)) >>>>> +static const struct scheduler **schedulers = __schedulers_start; >>>> I really wonder whether we should continue follow this route of >>>> __start_ / __stop_ symbols, instead of leveraging gas+ld's >>>> .startof. and .sizeof. operators. >>> So, I would love to explore using those operators if you can give me >>> some link to documentation for using them. I have yet to be able to find >>> a construct for LD and GCC that works correctly for generating >>> equivalent symbols. >> With binutils docs missing any notion of these, I can only refer >> you to binutils sources, I'm afraid. >> > Well, I would prefer not to delve into undocumented behavior in what > should be a fairly straightforward patch set, so I plan on keeping the use > of the __start and __stop symbols. One hint to pick up from the Linux side of things is that you can do: extern const struct scheduler *__schedulers_start[], *__schedulers_end[]; #define NUM_SCHEDULERS (__schedulers_end - __schedulers_start) and rely on the semantics of pointer arithmetic. ~Andrew