Skip to content

Commit bbeee4b

Browse files
arch/tile: warn and retry if an IPI is not accepted by the target cpu
Previously we assumed this was impossible, but in fact it can happen. Handle it gracefully by retrying after issuing a warning. Signed-off-by: Chris Metcalf <cmetcalf@tilera.com>
1 parent b2ce2bd commit bbeee4b

1 file changed

Lines changed: 19 additions & 14 deletions

File tree

‎arch/tile/kernel/smp.c‎

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -36,21 +36,36 @@ static unsigned long __iomem *ipi_mappings[NR_CPUS];
3636
/* Set by smp_send_stop() to avoid recursive panics. */
3737
static int stopping_cpus;
3838

39+
static void __send_IPI_many(HV_Recipient *recip, int nrecip, int tag)
40+
{
41+
int sent = 0;
42+
while (sent < nrecip) {
43+
int rc = hv_send_message(recip, nrecip,
44+
(HV_VirtAddr)&tag, sizeof(tag));
45+
if (rc < 0) {
46+
if (!stopping_cpus) /* avoid recursive panic */
47+
panic("hv_send_message returned %d", rc);
48+
break;
49+
}
50+
WARN_ONCE(rc == 0, "hv_send_message() returned zero\n");
51+
sent += rc;
52+
}
53+
}
54+
3955
void send_IPI_single(int cpu, int tag)
4056
{
4157
HV_Recipient recip = {
4258
.y = cpu / smp_width,
4359
.x = cpu % smp_width,
4460
.state = HV_TO_BE_SENT
4561
};
46-
int rc = hv_send_message(&recip, 1, (HV_VirtAddr)&tag, sizeof(tag));
47-
BUG_ON(rc <= 0);
62+
__send_IPI_many(&recip, 1, tag);
4863
}
4964

5065
void send_IPI_many(const struct cpumask *mask, int tag)
5166
{
5267
HV_Recipient recip[NR_CPUS];
53-
int cpu, sent;
68+
int cpu;
5469
int nrecip = 0;
5570
int my_cpu = smp_processor_id();
5671
for_each_cpu(cpu, mask) {
@@ -61,17 +76,7 @@ void send_IPI_many(const struct cpumask *mask, int tag)
6176
r->x = cpu % smp_width;
6277
r->state = HV_TO_BE_SENT;
6378
}
64-
sent = 0;
65-
while (sent < nrecip) {
66-
int rc = hv_send_message(recip, nrecip,
67-
(HV_VirtAddr)&tag, sizeof(tag));
68-
if (rc <= 0) {
69-
if (!stopping_cpus) /* avoid recursive panic */
70-
panic("hv_send_message returned %d", rc);
71-
break;
72-
}
73-
sent += rc;
74-
}
79+
__send_IPI_many(recip, nrecip, tag);
7580
}
7681

7782
void send_IPI_allbutself(int tag)

0 commit comments

Comments
 (0)