Skip to content

Commit bb1775c

Browse files
committed
Merge tag 'metag-for-v3.15' of git://git.kernel.org/pub/scm/linux/kernel/git/jhogan/metag
Pull Metag architecture changes from James Hogan: - Remove unused NUMA definition (SD_NODE_INIT) - Refactor signal code to use struct ksignal - IRQ migration cleanup to use irq_set_affinity - Clean up main Kconfig file a little * tag 'metag-for-v3.15' of git://git.kernel.org/pub/scm/linux/kernel/git/jhogan/metag: sched: remove unused SCHED_INIT_NODE metag: Use get_signal() signal_setup_done() metag: Fix METAG Kconfig symbol select ordering metag: Use irq_set_affinity instead of homebrewn code
2 parents 63c9565 + 2aca46c commit bb1775c

4 files changed

Lines changed: 25 additions & 74 deletions

File tree

‎arch/metag/Kconfig‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ config METAG
99
select HAVE_ARCH_TRACEHOOK
1010
select HAVE_C_RECORDMCOUNT
1111
select HAVE_DEBUG_KMEMLEAK
12+
select HAVE_DEBUG_STACKOVERFLOW
1213
select HAVE_DYNAMIC_FTRACE
1314
select HAVE_FTRACE_MCOUNT_RECORD
1415
select HAVE_FUNCTION_TRACER
@@ -29,7 +30,6 @@ config METAG
2930
select OF
3031
select OF_EARLY_FLATTREE
3132
select SPARSE_IRQ
32-
select HAVE_DEBUG_STACKOVERFLOW
3333

3434
config STACKTRACE_SUPPORT
3535
def_bool y

‎arch/metag/include/asm/topology.h‎

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -3,33 +3,6 @@
33

44
#ifdef CONFIG_NUMA
55

6-
/* sched_domains SD_NODE_INIT for Meta machines */
7-
#define SD_NODE_INIT (struct sched_domain) { \
8-
.parent = NULL, \
9-
.child = NULL, \
10-
.groups = NULL, \
11-
.min_interval = 8, \
12-
.max_interval = 32, \
13-
.busy_factor = 32, \
14-
.imbalance_pct = 125, \
15-
.cache_nice_tries = 2, \
16-
.busy_idx = 3, \
17-
.idle_idx = 2, \
18-
.newidle_idx = 0, \
19-
.wake_idx = 0, \
20-
.forkexec_idx = 0, \
21-
.flags = SD_LOAD_BALANCE \
22-
| SD_BALANCE_FORK \
23-
| SD_BALANCE_EXEC \
24-
| SD_BALANCE_NEWIDLE \
25-
| SD_SERIALIZE, \
26-
.last_balance = jiffies, \
27-
.balance_interval = 1, \
28-
.nr_balance_failed = 0, \
29-
.max_newidle_lb_cost = 0, \
30-
.next_decay_max_lb_cost = jiffies, \
31-
}
32-
336
#define cpu_to_node(cpu) ((void)(cpu), 0)
347
#define parent_node(node) ((void)(node), 0)
358

‎arch/metag/kernel/irq.c‎

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -261,18 +261,6 @@ int __init arch_probe_nr_irqs(void)
261261
}
262262

263263
#ifdef CONFIG_HOTPLUG_CPU
264-
static void route_irq(struct irq_data *data, unsigned int irq, unsigned int cpu)
265-
{
266-
struct irq_desc *desc = irq_to_desc(irq);
267-
struct irq_chip *chip = irq_data_get_irq_chip(data);
268-
unsigned long flags;
269-
270-
raw_spin_lock_irqsave(&desc->lock, flags);
271-
if (chip->irq_set_affinity)
272-
chip->irq_set_affinity(data, cpumask_of(cpu), false);
273-
raw_spin_unlock_irqrestore(&desc->lock, flags);
274-
}
275-
276264
/*
277265
* The CPU has been marked offline. Migrate IRQs off this CPU. If
278266
* the affinity settings do not allow other CPUs, force them onto any
@@ -281,10 +269,9 @@ static void route_irq(struct irq_data *data, unsigned int irq, unsigned int cpu)
281269
void migrate_irqs(void)
282270
{
283271
unsigned int i, cpu = smp_processor_id();
284-
struct irq_desc *desc;
285272

286-
for_each_irq_desc(i, desc) {
287-
struct irq_data *data = irq_desc_get_irq_data(desc);
273+
for_each_active_irq(i) {
274+
struct irq_data *data = irq_get_irq_data(i);
288275
unsigned int newcpu;
289276

290277
if (irqd_is_per_cpu(data))
@@ -300,11 +287,8 @@ void migrate_irqs(void)
300287
i, cpu);
301288

302289
cpumask_setall(data->affinity);
303-
newcpu = cpumask_any_and(data->affinity,
304-
cpu_online_mask);
305290
}
306-
307-
route_irq(data, i, newcpu);
291+
irq_set_affinity(i, data->affinity);
308292
}
309293
}
310294
#endif /* CONFIG_HOTPLUG_CPU */

‎arch/metag/kernel/signal.c‎

Lines changed: 21 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -152,18 +152,18 @@ static void __user *get_sigframe(struct k_sigaction *ka, unsigned long sp,
152152
return (void __user *)sp;
153153
}
154154

155-
static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
156-
sigset_t *set, struct pt_regs *regs)
155+
static int setup_rt_frame(struct ksignal *ksig, sigset_t *set,
156+
struct pt_regs *regs)
157157
{
158158
struct rt_sigframe __user *frame;
159-
int err = -EFAULT;
159+
int err;
160160
unsigned long code;
161161

162-
frame = get_sigframe(ka, regs->REG_SP, sizeof(*frame));
162+
frame = get_sigframe(&ksig->ka, regs->REG_SP, sizeof(*frame));
163163
if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame)))
164-
goto out;
164+
return -EFAULT;
165165

166-
err = copy_siginfo_to_user(&frame->info, info);
166+
err = copy_siginfo_to_user(&frame->info, &ksig->info);
167167

168168
/* Create the ucontext. */
169169
err |= __put_user(0, &frame->uc.uc_flags);
@@ -174,7 +174,7 @@ static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
174174
err |= __copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set));
175175

176176
if (err)
177-
goto out;
177+
return -EFAULT;
178178

179179
/* Set up to return from userspace. */
180180

@@ -187,15 +187,15 @@ static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
187187
err |= __put_user(code, (unsigned long __user *)(&frame->retcode[1]));
188188

189189
if (err)
190-
goto out;
190+
return -EFAULT;
191191

192192
/* Set up registers for signal handler */
193193
regs->REG_RTP = (unsigned long) frame->retcode;
194194
regs->REG_SP = (unsigned long) frame + sizeof(*frame);
195-
regs->REG_ARG1 = sig;
195+
regs->REG_ARG1 = ksig->sig;
196196
regs->REG_ARG2 = (unsigned long) &frame->info;
197197
regs->REG_ARG3 = (unsigned long) &frame->uc;
198-
regs->REG_PC = (unsigned long) ka->sa.sa_handler;
198+
regs->REG_PC = (unsigned long) ksig->ka.sa.sa_handler;
199199

200200
pr_debug("SIG deliver (%s:%d): sp=%p pc=%08x pr=%08x\n",
201201
current->comm, current->pid, frame, regs->REG_PC,
@@ -205,24 +205,19 @@ static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
205205
* effective cache flush - directed rather than 'full flush'.
206206
*/
207207
flush_cache_sigtramp(regs->REG_RTP, sizeof(frame->retcode));
208-
out:
209-
if (err) {
210-
force_sigsegv(sig, current);
211-
return -EFAULT;
212-
}
208+
213209
return 0;
214210
}
215211

216-
static void handle_signal(unsigned long sig, siginfo_t *info,
217-
struct k_sigaction *ka, struct pt_regs *regs)
212+
static void handle_signal(struct ksignal *ksig, struct pt_regs *regs)
218213
{
219214
sigset_t *oldset = sigmask_to_save();
215+
int ret;
220216

221217
/* Set up the stack frame */
222-
if (setup_rt_frame(sig, ka, info, oldset, regs))
223-
return;
218+
ret = setup_rt_frame(ksig, oldset, regs);
224219

225-
signal_delivered(sig, info, ka, regs, test_thread_flag(TIF_SINGLESTEP));
220+
signal_setup_done(ret, ksig, test_thread_flag(TIF_SINGLESTEP));
226221
}
227222

228223
/*
@@ -235,10 +230,8 @@ static void handle_signal(unsigned long sig, siginfo_t *info,
235230
static int do_signal(struct pt_regs *regs, int syscall)
236231
{
237232
unsigned int retval = 0, continue_addr = 0, restart_addr = 0;
238-
struct k_sigaction ka;
239-
siginfo_t info;
240-
int signr;
241233
int restart = 0;
234+
struct ksignal ksig;
242235

243236
/*
244237
* By the end of rt_sigreturn the context describes the point that the
@@ -275,27 +268,28 @@ static int do_signal(struct pt_regs *regs, int syscall)
275268
* Get the signal to deliver. When running under ptrace, at this point
276269
* the debugger may change all our registers ...
277270
*/
278-
signr = get_signal_to_deliver(&info, &ka, regs, NULL);
271+
get_signal(&ksig);
272+
279273
/*
280274
* Depending on the signal settings we may need to revert the decision
281275
* to restart the system call. But skip this if a debugger has chosen to
282276
* restart at a different PC.
283277
*/
284278
if (regs->REG_PC != restart_addr)
285279
restart = 0;
286-
if (signr > 0) {
280+
if (ksig.sig > 0) {
287281
if (unlikely(restart)) {
288282
if (retval == -ERESTARTNOHAND
289283
|| retval == -ERESTART_RESTARTBLOCK
290284
|| (retval == -ERESTARTSYS
291-
&& !(ka.sa.sa_flags & SA_RESTART))) {
285+
&& !(ksig.ka.sa.sa_flags & SA_RESTART))) {
292286
regs->REG_RETVAL = -EINTR;
293287
regs->REG_PC = continue_addr;
294288
}
295289
}
296290

297291
/* Whee! Actually deliver the signal. */
298-
handle_signal(signr, &info, &ka, regs);
292+
handle_signal(&ksig, regs);
299293
return 0;
300294
}
301295

0 commit comments

Comments
 (0)