From: Juergen Gross <jgross@suse.com>
To: jeffy.chen@rock-chips.com,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Cc: xen-devel <xen-devel@lists.xenproject.org>,
Thomas Gleixner <tglx@linutronix.de>,
Boris Ostrovsky <boris.ostrovsky@oracle.com>,
Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Subject: Problem with commit bf22ff45bed664aefb5c4e43029057a199b7070c
Date: Fri, 7 Jul 2017 16:51:10 +0200 [thread overview]
Message-ID: <dc3e7811-e3f8-1cf9-d556-1ac57288daa5@suse.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 831 bytes --]
Commit bf22ff45bed664aefb5c4e43029057a199b7070c ("genirq: Avoid
unnecessary low level irq function calls") breaks Xen guest
save/restore handling.
The main problem are the PV devices using Xen event channels as
interrupt sources which are represented as an "irq chip" in the kernel.
When saving the guest the event channels are masked internally. At
restore time event channels are re-established and unmasked via
irq_startup(). Unfortunately above commit will let the unmask operation
be a nop as the irq handling doesn't know about the masking done before.
I have a patch repairing the issue, but I'm not sure if this way to do
it would be accepted. I have exported mask_irq() and I'm doing the
masking now through this function. Would the attached patch be
acceptable? Or is there a better way to solve the problem?
Juergen
[-- Attachment #2: mask.patch --]
[-- Type: text/x-patch, Size: 2129 bytes --]
diff --git a/drivers/xen/events/events_base.c b/drivers/xen/events/events_base.c
index 2e567d8433b3..79e82534a3c3 100644
--- a/drivers/xen/events/events_base.c
+++ b/drivers/xen/events/events_base.c
@@ -346,9 +346,17 @@ static void bind_evtchn_to_cpu(unsigned int chn, unsigned int cpu)
static void xen_evtchn_mask_all(void)
{
unsigned int evtchn;
+ int irq;
+ struct irq_desc *desc;
- for (evtchn = 0; evtchn < xen_evtchn_nr_channels(); evtchn++)
- mask_evtchn(evtchn);
+ for (evtchn = 0; evtchn < xen_evtchn_nr_channels(); evtchn++) {
+ irq = get_evtchn_to_irq(evtchn);
+ desc = irq_to_desc(irq);
+ if (desc)
+ mask_irq(desc);
+ else
+ mask_evtchn(evtchn);
+ }
}
/**
diff --git a/include/linux/irq.h b/include/linux/irq.h
index 00db35b61e9e..4b6ab670639a 100644
--- a/include/linux/irq.h
+++ b/include/linux/irq.h
@@ -509,6 +509,7 @@ extern int setup_irq(unsigned int irq, struct irqaction *new);
extern void remove_irq(unsigned int irq, struct irqaction *act);
extern int setup_percpu_irq(unsigned int irq, struct irqaction *new);
extern void remove_percpu_irq(unsigned int irq, struct irqaction *act);
+extern void mask_irq(struct irq_desc *desc);
extern void irq_cpu_online(void);
extern void irq_cpu_offline(void);
diff --git a/kernel/irq/chip.c b/kernel/irq/chip.c
index 2e30d925a40d..7e25a1ad2857 100644
--- a/kernel/irq/chip.c
+++ b/kernel/irq/chip.c
@@ -408,6 +408,7 @@ void mask_irq(struct irq_desc *desc)
irq_state_set_masked(desc);
}
}
+EXPORT_SYMBOL_GPL(mask_irq);
void unmask_irq(struct irq_desc *desc)
{
diff --git a/kernel/irq/internals.h b/kernel/irq/internals.h
index 9da14d125df4..5e2bc4d799af 100644
--- a/kernel/irq/internals.h
+++ b/kernel/irq/internals.h
@@ -81,7 +81,6 @@ extern void irq_enable(struct irq_desc *desc);
extern void irq_disable(struct irq_desc *desc);
extern void irq_percpu_enable(struct irq_desc *desc, unsigned int cpu);
extern void irq_percpu_disable(struct irq_desc *desc, unsigned int cpu);
-extern void mask_irq(struct irq_desc *desc);
extern void unmask_irq(struct irq_desc *desc);
extern void unmask_threaded_irq(struct irq_desc *desc);
next reply other threads:[~2017-07-07 14:51 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-07 14:51 Juergen Gross [this message]
2017-07-07 16:41 ` Thomas Gleixner
2017-07-07 17:08 ` Juergen Gross
2017-07-07 17:11 ` Thomas Gleixner
2017-07-10 7:23 ` Juergen Gross
2017-07-12 15:30 ` Thomas Gleixner
2017-07-12 20:21 ` Thomas Gleixner
2017-07-07 17:09 ` Marc Zyngier
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=dc3e7811-e3f8-1cf9-d556-1ac57288daa5@suse.com \
--to=jgross@suse.com \
--cc=boris.ostrovsky@oracle.com \
--cc=jeffy.chen@rock-chips.com \
--cc=konrad.wilk@oracle.com \
--cc=linux-kernel@vger.kernel.org \
--cc=tglx@linutronix.de \
--cc=xen-devel@lists.xenproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®