Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp282331imu; Thu, 3 Jan 2019 19:48:28 -0800 (PST) X-Google-Smtp-Source: AFSGD/XqcrWqtUlCTHEYgQgeMuxnrr0Ha2BW7IYeJPz5gaRmOUbkZ2CTT+PWZ8x+8rY+5JZ0ntVJ X-Received: by 2002:a62:1542:: with SMTP id 63mr51153359pfv.230.1546573708484; Thu, 03 Jan 2019 19:48:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1546573708; cv=none; d=google.com; s=arc-20160816; b=cf4po0Lb4SXYRHIKo/yfMDEHAokaENCuMNGK8o80Ij7jrzMMdG2nHcpcBV+vjagSd7 ZZwBqyzLXYXy8R918w76cOygn6epOYSbVtXEgDJnulMthsK5WjMsVUvcqb/IKJbT6f7Z TfH8ZjCSShDkyx2J4Yc5Ar/m/d8ybzYfpzI10fpdyDixz3oXLLX3J78OETPny/26Tr3V wqjxbjskH6cKQAxoBCumkGWf8xEe9cKt0FlMImbPQZ0reD7UFPm4RGX+Htp1Z/epyhS2 TxdWbwL6rP9BtTaAaKrQOldXHZubIDny1K0jTGDfFBQGARmSiiCNx4qIjwN7/aA6+SEE KncA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=bRRW1qK2oUe1h5E4zoSobnVvCGpot8rP29n/ZJEn9YI=; b=rOeOj0mziC2UGUnZZLGFSeouA25zXF2YCXZebSPs8dM4Vxb83PqWzxMoNo13HsEqst XaeYTTwCEezhYLUK+ScBdRpPpQiVNFcxjDgI3IeU7FNyNNBw5CpkMLIJiy/LeElItUlO jKBLbT8sOLk7gHZIBx8dtpJkcWpa+RpyG8+oDIQYRxevO6Qng2Q826htJw8x5Yqhp5xY 7Uk2QGli2m6M4eM+sbmvMLHunUc5EyKJzaHnyNPQu6EiFdoihkXE6XVcvu6pBZqLDzS7 jnIe/yBm5haZUnBmf4itZYdiWbTg4/OYIk7rM8xM8GkgrVlZ/mFmRn3rCniuDLPhJJu3 TnAA== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d38si14841298pla.207.2019.01.03.19.48.13; Thu, 03 Jan 2019 19:48:28 -0800 (PST) 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728655AbfACWsg (ORCPT + 99 others); Thu, 3 Jan 2019 17:48:36 -0500 Received: from mga11.intel.com ([192.55.52.93]:37535 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728572AbfACWsg (ORCPT ); Thu, 3 Jan 2019 17:48:36 -0500 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 03 Jan 2019 14:48:35 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,436,1539673200"; d="scan'208";a="132770756" Received: from tassilo.jf.intel.com (HELO tassilo.localdomain) ([10.7.201.137]) by fmsmga004.fm.intel.com with ESMTP; 03 Jan 2019 14:48:35 -0800 Received: by tassilo.localdomain (Postfix, from userid 1000) id 7E422301B2E; Thu, 3 Jan 2019 14:48:35 -0800 (PST) Date: Thu, 3 Jan 2019 14:48:35 -0800 From: Andi Kleen To: Nadav Amit Cc: Ingo Molnar , Andy Lutomirski , Peter Zijlstra , Josh Poimboeuf , Edward Cree , "H . Peter Anvin" , Thomas Gleixner , LKML , X86 ML , Paolo Abeni , Borislav Petkov , David Woodhouse Subject: Re: [RFC v2 1/6] x86: introduce kernel restartable sequence Message-ID: <20190103224835.GG6118@tassilo.jf.intel.com> References: <20181231072112.21051-1-namit@vmware.com> <20181231072112.21051-2-namit@vmware.com> <87va35e61a.fsf@linux.intel.com> <263A441C-F062-491F-9E95-F00FA2092A99@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <263A441C-F062-491F-9E95-F00FA2092A99@gmail.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > Ok… I’ll try to think about another solution. Just note that this is just > used as a hint to avoid unnecessary lookups. (IOW, nothing will break if the > prefix is used.) Are you sure actually? The empty prefix could mean 8bit register accesses. > > You're doing the equivalent of patching a private system call > > into your own kernel without working with upstream, don't do that. > > I don’t understand this comment though. Can you please explain? Instruction encoding = system call ABI Upstream = CPU vendors Early in Linux's history, naive Linux distribution vendors patched in their own private system calls without waiting for upstream to define an ABI, which caused endless compatibility problems. These days this is very frowned upon. > > Better to find some other solution to do the restart. > > How about simply using a per cpu variable? That should be cheaper > > anyways. > > The problem is that the per-cpu variable needs to be updated after the call > is executed, when we are already not in the context of the “injected” code. > I can increase it before the call, and decrease it after return - but this > can create (in theory) long periods in which the code is “unpatchable”, > increase the code size and slow performance. > > Anyhow, I’ll give more thought. Ideas are welcomed. Write the address of the instruction into the per cpu variable. -Andi