Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
f8469e97
Commit
f8469e97
authored
May 17, 2002
by
Anton Blanchard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ppc64: Add Ingo's irq affinity stuff, from x86
parent
cd112674
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
75 additions
and
1 deletion
+75
-1
arch/ppc64/kernel/idle.c
arch/ppc64/kernel/idle.c
+3
-0
arch/ppc64/kernel/irq.c
arch/ppc64/kernel/irq.c
+71
-0
include/asm-ppc64/hardirq.h
include/asm-ppc64/hardirq.h
+1
-1
No files found.
arch/ppc64/kernel/idle.c
View file @
f8469e97
...
...
@@ -84,6 +84,8 @@ int cpu_idle(void)
lpaca
=
get_paca
();
while
(
1
)
{
irq_stat
[
smp_processor_id
()].
idle_timestamp
=
jiffies
;
if
(
lpaca
->
xLpPaca
.
xSharedProc
)
{
if
(
ItLpQueue_isLpIntPending
(
lpaca
->
lpQueuePtr
))
process_iSeries_events
();
...
...
@@ -123,6 +125,7 @@ int cpu_idle(void)
long
oldval
;
while
(
1
)
{
irq_stat
[
smp_processor_id
()].
idle_timestamp
=
jiffies
;
oldval
=
test_and_clear_thread_flag
(
TIF_NEED_RESCHED
);
if
(
!
oldval
)
{
...
...
arch/ppc64/kernel/irq.c
View file @
f8469e97
...
...
@@ -410,6 +410,75 @@ handle_irq_event(int irq, struct pt_regs *regs, struct irqaction *action)
__cli
();
}
#ifdef CONFIG_SMP
extern
unsigned
int
irq_affinity
[
NR_IRQS
];
typedef
struct
{
unsigned
long
cpu
;
unsigned
long
timestamp
;
}
____cacheline_aligned
irq_balance_t
;
static
irq_balance_t
irq_balance
[
NR_IRQS
]
__cacheline_aligned
=
{
[
0
...
NR_IRQS
-
1
]
=
{
1
,
0
}
};
#define IDLE_ENOUGH(cpu,now) \
(idle_cpu(cpu) && ((now) - irq_stat[(cpu)].idle_timestamp > ((HZ/100)+1)))
#define IRQ_ALLOWED(cpu,allowed_mask) \
((1 << cpu) & (allowed_mask))
static
unsigned
long
move
(
unsigned
long
curr_cpu
,
unsigned
long
allowed_mask
,
unsigned
long
now
,
int
direction
)
{
int
search_idle
=
1
;
int
cpu
=
curr_cpu
;
goto
inside
;
do
{
if
(
unlikely
(
cpu
==
curr_cpu
))
search_idle
=
0
;
inside:
if
(
direction
==
1
)
{
cpu
++
;
if
(
cpu
>=
smp_num_cpus
)
cpu
=
0
;
}
else
{
cpu
--
;
if
(
cpu
==
-
1
)
cpu
=
smp_num_cpus
-
1
;
}
}
while
(
!
IRQ_ALLOWED
(
cpu
,
allowed_mask
)
||
(
search_idle
&&
!
IDLE_ENOUGH
(
cpu
,
now
)));
return
cpu
;
}
static
inline
void
balance_irq
(
int
irq
)
{
irq_balance_t
*
entry
=
irq_balance
+
irq
;
unsigned
long
now
=
jiffies
;
if
(
unlikely
(
entry
->
timestamp
!=
now
))
{
unsigned
long
allowed_mask
;
unsigned
long
random_number
;
if
(
!
irq_desc
[
irq
].
handler
->
set_affinity
)
return
;
random_number
=
mftb
();
random_number
&=
1
;
allowed_mask
=
cpu_online_map
&
irq_affinity
[
irq
];
entry
->
timestamp
=
now
;
entry
->
cpu
=
move
(
entry
->
cpu
,
allowed_mask
,
now
,
random_number
);
irq_desc
[
irq
].
handler
->
set_affinity
(
irq
,
1
<<
entry
->
cpu
);
}
}
#else
#define balance_irq(irq) do { } while (0)
#endif
/*
* Eventually, this should take an array of interrupts and an array size
* so it can dispatch multiple interrupts.
...
...
@@ -421,6 +490,8 @@ void ppc_irq_dispatch_handler(struct pt_regs *regs, int irq)
int
cpu
=
smp_processor_id
();
irq_desc_t
*
desc
=
irq_desc
+
irq
;
balance_irq
(
irq
);
kstat
.
irqs
[
cpu
][
irq
]
++
;
spin_lock
(
&
desc
->
lock
);
ack_irq
(
irq
);
...
...
include/asm-ppc64/hardirq.h
View file @
f8469e97
...
...
@@ -26,7 +26,7 @@ typedef struct {
#endif
unsigned
int
__local_bh_count
;
unsigned
int
__syscall_count
;
unsigned
long
__unused
;
unsigned
long
idle_timestamp
;
struct
task_struct
*
__ksoftirqd_task
;
}
____cacheline_aligned
irq_cpustat_t
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment