Re: [PATCH v6 12/21] KVM: s390: pci: enable host forwarding of Adapter Event Notifications

Christian Borntraeger
2022-05-05T12:38:24Z

Am 26.04.22 um 22:08 schrieb Matthew Rosato:
[...]

Reviewed-by: Christian Borntraeger <borntraeger@linux.ibm.com>

one comment below.

> +static void aen_process_gait(u8 isc)
> +{
> + bool found = false, first = true;
> + union zpci_sic_iib iib = {{0}};
> + unsigned long si, flags;
> +
> + spin_lock_irqsave(&aift->gait_lock, flags);

I think we can live with this for now, but if it turns out to create too long periods of disabled interrupts or lock hold times we might want to consider moving gaite access to an rcu-like approach.

> +
> + if (!aift->gait) {
> + spin_unlock_irqrestore(&aift->gait_lock, flags);
> + return;
> + }
> +
> + for (si = 0;;) {
> + /* Scan adapter summary indicator bit vector */
> + si = airq_iv_scan(aift->sbv, si, airq_iv_end(aift->sbv));
> + if (si == -1UL) {
> + if (first || found) {
> + /* Re-enable interrupts. */
> + zpci_set_irq_ctrl(SIC_IRQ_MODE_SINGLE, isc,
> + &iib);
> + first = found = false;
> + } else {
> + /* Interrupts on and all bits processed */
> + break;
> + }
> + found = false;
> + si = 0;
> + /* Scan again after re-enabling interrupts */
> + continue;
> + }
> + found = true;
> + aen_host_forward(si);
> + }
> +
> + spin_unlock_irqrestore(&aift->gait_lock, flags);
> +}
> +