Martin J. Bligh wrote: >Patches look clean enough, apart from this: > > > >>+#define C(i) per_cpu(cpu_gdt_table, cpu)[GDT_ENTRY_TLS_MIN + i] = t->tls_array[i] >>+ C(0); C(1); C(2); >>+#undef C >> >> > >which is foul ... but you moved it, not wrote it ;-) > >But ... not sure doing this bottom up is going to be the easiest way >to do it? If we want to make clean abstractions, would seem easier to >work downwards from what areas we need to change. Maybe that's just me. > > You have a point. But my current thinking is, let's worry about abstractions later and get the silly mechanical stuff out of the way up front. My patches are mostly free of abstractions, as I said, I left higher level paradigms out on purpose so we can converge on the mechanics first - I think the mechanics will converge quite rapidly. BTW, I know that is ugly. That's why I wrote this: +static inline void load_TLS(struct thread_struct *t, unsigned int cpu) +{ + unsigned first = 0; + unsigned last = 0; + unsigned i; + for (i = 0; i < 3; i++) { + unsigned cur = i + GDT_ENTRY_TLS_MIN; + if (per_cpu(cpu_gdt_table, cpu)[cur].a != t->tls_array[i].a || + per_cpu(cpu_gdt_table, cpu)[cur].b != t->tls_array[i].b) { + per_cpu(cpu_gdt_table, cpu)[cur] = t->tls_array[i]; + last = cur; + if (!first) + first = cur; + } + } + if (first != 0) { + vmi_UpdateGDT(first, last); + } +} + But again, lets worry about abstractions later! It would be wonderful if we could both compile the same base tree before really getting into it. Zach