Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp1821392ybb; Thu, 26 Mar 2020 07:58:08 -0700 (PDT) X-Google-Smtp-Source: ADFU+vsu+BybdB6f5uhe4UxMmoeGYWBpMNVmPATy+g0tUR0K4eQKCHs1R9lIbaBpNRUFxE5N6CYm X-Received: by 2002:a9d:6ac6:: with SMTP id m6mr6642072otq.198.1585234688246; Thu, 26 Mar 2020 07:58:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585234688; cv=none; d=google.com; s=arc-20160816; b=sUuMVEi4RoC/0lX/hO8aIZMErHNk0d0QB64n+qSowgQqA/7Rzn55ib7JJM30Cd9vRu O30GOOpYoAB+gePhJQEUjoAXjkktukMoH+cLWdUrdxBr9Z4RZiFqVoIWMbLHe7lA72HT ovdZdOgXxq70+zacjBPE2AR87UrdviPkLk6TdM+X+py+IAK40sO5bfMRapQe1iQUiAzZ LPmICSumDYs7G6v1QRbGoi2s3l2r0h8rlU1fYZy0TxU/wWPlwYcQs7oHtlxpGvzGn+lJ MawprbYw7WesV//COSX62Ab3EwLhKt1CP6/CXhBLS1ZpuQw78NZlqfE6hPfaG9vlsDzA eoKw== 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-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=I5bzym9yUMWO0jgjlADgMWnILk9HKqW39Q1cend1Znw=; b=LOjAUeCwwfQt46aP+2vKPk7VcigbHHlffFS+zZhHuF3nXyX97nqw4urfRKZ0pHyvyt nBfLAtLw6chxy/TbKmf+/yuvzRLWnXRmvJcqxpagPGO7aPqSdRti/o1glPGLt3F7jwHK JsrGQ5Xo6LWImeBKDTi44246jX6nPmpNJbEAJ7DPBTes21mWVnmNxmJOTlGgaVEo8Ev7 QCw6rmZT6EXI0HpE86uwzlgrBnsTCu/BQRoNSD9lcV+sm4n5/Nhm9Vt4rgwPImr/YMRS j9Z68x6sRrUe/FvSyL6kCBn88QGN9g97/TTZwuXJ3lAh3/lrCmdlX7QaoLNwwQWB1Yoe ciyw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b=hamAasPB; 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=pass (p=NONE sp=NONE dis=NONE) header.from=alien8.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q7si1060337otk.77.2020.03.26.07.57.54; Thu, 26 Mar 2020 07:58:08 -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; dkim=pass header.i=@alien8.de header.s=dkim header.b=hamAasPB; 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=pass (p=NONE sp=NONE dis=NONE) header.from=alien8.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728014AbgCZO5T (ORCPT + 99 others); Thu, 26 Mar 2020 10:57:19 -0400 Received: from mail.skyhub.de ([5.9.137.197]:58556 "EHLO mail.skyhub.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727885AbgCZO5T (ORCPT ); Thu, 26 Mar 2020 10:57:19 -0400 Received: from zn.tnic (p200300EC2F0A4900341618FA2426449A.dip0.t-ipconnect.de [IPv6:2003:ec:2f0a:4900:3416:18fa:2426:449a]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.skyhub.de (SuperMail on ZX Spectrum 128k) with ESMTPSA id 1CFD91EC0469; Thu, 26 Mar 2020 15:57:17 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1585234637; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:in-reply-to:in-reply-to: references:references; bh=I5bzym9yUMWO0jgjlADgMWnILk9HKqW39Q1cend1Znw=; b=hamAasPB1uuxLYTMK2DmIuXoiIH0eaaT7MmvTTfPeL7YCT7znmmD3Of4d+f1fopvTpU5CO 77nhM0XgmB7QeKrE6nBKC7HoxE3mn92XDzLQAOr30wAOcYh9jxsVpw7V8LnueGBSe4BQr8 bxprFNFKyWN3iOZL9APdhJcyooAeul0= Date: Thu, 26 Mar 2020 15:57:09 +0100 From: Borislav Petkov To: Peter Zijlstra Cc: x86@kernel.org, linux-kernel@vger.kernel.org, rostedt@goodmis.org, mhiramat@kernel.org, bristot@redhat.com, jbaron@akamai.com, torvalds@linux-foundation.org, tglx@linutronix.de, mingo@kernel.org, namit@vmware.com, hpa@zytor.com, luto@kernel.org, ard.biesheuvel@linaro.org, jpoimboe@redhat.com Subject: Re: [RESEND][PATCH v3 09/17] x86/static_call: Add out-of-line static call implementation Message-ID: <20200326145709.GB11398@zn.tnic> References: <20200324135603.483964896@infradead.org> <20200324142245.819003994@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20200324142245.819003994@infradead.org> 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 On Tue, Mar 24, 2020 at 02:56:12PM +0100, Peter Zijlstra wrote: > +static void __static_call_transform(void *insn, u8 opcode, void *func) > +{ > + const void *code = text_gen_insn(opcode, (long)insn, (long)func); > + > + if (WARN_ONCE(*(u8 *)insn != opcode, > + "unexpected static call insn opcode 0x%x at %pS\n", > + opcode, insn)) > + return; > + > + if (memcmp(insn, code, CALL_INSN_SIZE) == 0) > + return; > + > + text_poke_bp(insn, code, CALL_INSN_SIZE, NULL); Right, this is working with CALL_INSN_SIZE but ... > +} > + > +void arch_static_call_transform(void *site, void *tramp, void *func) > +{ > + mutex_lock(&text_mutex); > + > + if (tramp) > + __static_call_transform(tramp, JMP32_INSN_OPCODE, func); ... it gets called with JMP32_INSN_OPCODE too. I mean, both lengths are equal and all - it is just a bit confusing at a first glance. Maybe slap a small comment that it is ok. Thx. -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette