Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp628383ybb; Wed, 8 Apr 2020 06:52:36 -0700 (PDT) X-Google-Smtp-Source: APiQypLE5CkoWRjWGHzd0nUjEPSXyM8xf7z5UEENwzQ1XBsXy/WWMYGne5WDLEkmmv/LramWAF8D X-Received: by 2002:a9d:6ad2:: with SMTP id m18mr6008387otq.28.1586353956832; Wed, 08 Apr 2020 06:52:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586353956; cv=none; d=google.com; s=arc-20160816; b=sc1ejLglkRD0OUWuXfaTWZWIbvwPMNQ49WBzjGGW0tsrDv4xElJILUxm84AjldEeiG e9HsA9IZrL9valt/+jwHV+UEcSfJe+AvHjmwInn/NVXH6pFZT39MiznMpHp/85CDSqGp c3b/0l4Z5y7KTiD6CN6MveCFBGBmnop3agF8rOS5HdTb9n+1fGLnyYvGmrnpOcV7DcP9 4qYuWlSoVFANP1T1s/lo3KMiDm9nZXWfJnWhXBB9B6454EHxZJFw0q1dG3xSKEewFzUF Kk3tNOwl/wG6qTsnaBwhh5WOylKsrL5+ubrsb/7ucRXZUPgVx6SfOnz0zK2mpf321G1q NZRA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=Kjfiw3TGbe9xChSTcpvZskO8Yuf8mqPmHQwR2FheXZ0=; b=vreLzdh2NpUgz5PPs6dP3A8ENzPGTmwuBW9JncErIhC+B3UMj5w8ULsnAXyZML8FwV ZIiznNoJgWI2s1Px1HxrsUzjbbOA7ev/RdNFebdAodf21iavdF6OHn7ZlGveF0vuainY M+lTafgFLHWDmi2qobdUIZ2T6olYh4KJAwLysbF1Hxvdxqf5F13OnYd3tQIeXhg86vhh wYr9DO72UDo7LgcgtxPNq2jWtFlyKf1b1rz3vwe7ykPqiHnxbf+2XxrAeOVySs4fdE/O kd9O7aycJunbgiymG0wwVbs5R1uY3kyA9WTr6WZlVgzB1DXlZgST7d3DP537eYYXRjng tV0g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c10si2181179oif.81.2020.04.08.06.52.23; Wed, 08 Apr 2020 06:52:36 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729195AbgDHNd4 (ORCPT + 99 others); Wed, 8 Apr 2020 09:33:56 -0400 Received: from mx2.suse.de ([195.135.220.15]:57164 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728594AbgDHNd4 (ORCPT ); Wed, 8 Apr 2020 09:33:56 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 2B99FAE59; Wed, 8 Apr 2020 13:33:53 +0000 (UTC) Subject: Re: [RFC PATCH 00/26] Runtime paravirt patching To: Peter Zijlstra , Ankur Arora Cc: linux-kernel@vger.kernel.org, x86@kernel.org, hpa@zytor.com, jpoimboe@redhat.com, namit@vmware.com, mhiramat@kernel.org, bp@alien8.de, vkuznets@redhat.com, pbonzini@redhat.com, boris.ostrovsky@oracle.com, mihai.carabas@oracle.com, kvm@vger.kernel.org, xen-devel@lists.xenproject.org, virtualization@lists.linux-foundation.org References: <20200408050323.4237-1-ankur.a.arora@oracle.com> <20200408120856.GY20713@hirez.programming.kicks-ass.net> From: =?UTF-8?B?SsO8cmdlbiBHcm/Dnw==?= Message-ID: Date: Wed, 8 Apr 2020 15:33:52 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.6.0 MIME-Version: 1.0 In-Reply-To: <20200408120856.GY20713@hirez.programming.kicks-ass.net> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 08.04.20 14:08, Peter Zijlstra wrote: > On Tue, Apr 07, 2020 at 10:02:57PM -0700, Ankur Arora wrote: >> Mechanism: the patching itself is done using stop_machine(). That is >> not ideal -- text_poke_stop_machine() was replaced with INT3+emulation >> via text_poke_bp(), but I'm using this to address two issues: >> 1) emulation in text_poke() can only easily handle a small set >> of instructions and this is problematic for inlined pv-ops (and see >> a possible alternatives use-case below.) >> 2) paravirt patching might have inter-dependendent ops (ex. >> lock.queued_lock_slowpath, lock.queued_lock_unlock are paired and >> need to be updated atomically.) > > And then you hope that the spinlock state transfers.. That is that both > implementations agree what an unlocked spinlock looks like. > > Suppose the native one was a ticket spinlock, where unlocked means 'head > == tail' while the paravirt one is a test-and-set spinlock, where > unlocked means 'val == 0'. > > That just happens to not be the case now, but it was for a fair while. Sure? This would mean that before spinlock-pvops are being set no lock is allowed to be used in the kernel, because this would block the boot time transition of the lock variant to use. Another problem I'm seeing is that runtime pvops patching would rely on the fact that stop_machine() isn't guarded by a spinlock. Juergen