From: Andrew Jones Subject: Re: [PATCH kvm-unit-tests 0/3] arm/arm64: smp: prepare for on_cpu Date: Tue, 30 May 2017 16:37:45 +0200 Message-ID: <20170530143745.d3spr66evguqmche@kamzik.brq.redhat.com> References: <20170529135804.22891-1-drjones@redhat.com> <20170530133938.75zlzc2qm7dhsdsw@kamzik.brq.redhat.com> <4e31a9bf-4c8f-ce45-9542-4f3dd35fe7f1@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: kvm@vger.kernel.org, rkrcmar@redhat.com To: Paolo Bonzini Return-path: Received: from mx1.redhat.com ([209.132.183.28]:47416 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751028AbdE3Ohv (ORCPT ); Tue, 30 May 2017 10:37:51 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A5CF5C056791 for ; Tue, 30 May 2017 14:37:50 +0000 (UTC) Content-Disposition: inline In-Reply-To: <4e31a9bf-4c8f-ce45-9542-4f3dd35fe7f1@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: On Tue, May 30, 2017 at 04:26:34PM +0200, Paolo Bonzini wrote: > > > On 30/05/2017 15:39, Andrew Jones wrote: > > On Tue, May 30, 2017 at 02:13:34PM +0200, Paolo Bonzini wrote: > > Yes, I know, I even wrote something similar to that already and it > > works fine, *if* the calling cpu can always expect the target cpu > > to eventually (for some value of eventually) run its code (the "other > > side" code above). When I implemented it I decided that that code > > implements an idle loop, i.e. > > > > void secondary_halt(void) <-- maybe rename to do_idle() > > { > > cpu = smp_processor_id(); > > set_cpu_idle(cpu, true); > > for (;;) { > > while (cpu_idle(cpu)) > > wfe(); > > ... > > cb(opaque); > > set_cpu_idle(cpu, true); > > } > > } > > > > This implies on_cpu*() must wait for a target cpu's currently running > > task to finish, i.e., as I said above, no arbitrary preemption. > > Yes, that's okay. > > > So it's not as nice as an IPI solution that doesn't block an asynchronise > > caller (possibly indefinitely), which would mean it doesn't actually > > implement the semantics of on_cpu_async anyway. > > It's probably a bug anyway to have on_cpu_async while a previous > on_cpu_async is running. If you look at x86 tests, on_cpu_async usually > is followed by a busy wait for all CPUs to complete. OK, I'll clean up my idle-loop wfe/sev series and post soon then. Thanks, drew