Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp2696874pxu; Mon, 7 Dec 2020 13:08:18 -0800 (PST) X-Google-Smtp-Source: ABdhPJwOacCWktgJohlIqjJDJQpkZr9YWB3Z+KyGtTCf4iarTzOmYXtwysMrZH7Boouf9BSNTypo X-Received: by 2002:aa7:c98d:: with SMTP id c13mr22717702edt.188.1607375297885; Mon, 07 Dec 2020 13:08:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607375297; cv=none; d=google.com; s=arc-20160816; b=PULOE9Xj+n2bQj24R29NiLdxQ1VEFpycURHd+0OxfKfOwRbXH11EgH50hd4PNyu8Yl OMlO8KL/d8xwnH+0+H3h16vlZMJtzsEQcl3uQRmGTPDDeT5mXw9kdx8lr+ZdTRHf2e+L xhq47NLMz9S1LU1AclvkAx1J6zG/dJY9d8hHv7EmwphtYYnR5MKfHup2DKPxUbZEGCKz JeMgvL6maCjkQT1nEJ2W6nW7wkDi+7qwD33JExP82UjL3unrS2VygaFVVZdzEC95fmWY DuZ05YrBePw0SMmPrRzstX7OhriT2yXuQpLOxeIzAiLEHAi/BeSZzFGPKc9fTGu8smNn y86A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version:subject :references:in-reply-to:message-id:cc:to:from:date:dkim-signature; bh=cJ62JFUhP5zgABSp3fn8pdS4RMxFYvfg32dIjTX9vaU=; b=BZ6AUoFRk9TxIeeHahHR4IqMXGdP/3LgepBKYlcFl7YXPA0W34Q5zYDzk1ln3N3DNC J+JRtNQZlXbDtvCHRCLlR8tUG+Bf3nVtsXM+9VOuErbUVmyxivh8rgIQcFE4uRq087UV X93pbWqPOCwnk6OcoPl+0owFJk4kxzoToj+9KNCM0qa3VHH+fOOwTFzRyeHTJCT/FSqf oohi8Ctb3UQoMJm/B0MdNdaQpV+9UPeYLnty4DhLhZJyHqhuYMreyTzj679uI3DeFAnd x5HOIK26uVhv4qRJlmoHICz3ospiSUi6tBPVQcwPS/80i3pkrromL1ivfsbvD7nXXANP oy2w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="ZDpsg3E/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d7si7189660ejk.78.2020.12.07.13.07.54; Mon, 07 Dec 2020 13:08:17 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="ZDpsg3E/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726208AbgLGVFM (ORCPT + 99 others); Mon, 7 Dec 2020 16:05:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45558 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725774AbgLGVFM (ORCPT ); Mon, 7 Dec 2020 16:05:12 -0500 Received: from mail-oi1-x229.google.com (mail-oi1-x229.google.com [IPv6:2607:f8b0:4864:20::229]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6E3D2C061749; Mon, 7 Dec 2020 13:04:32 -0800 (PST) Received: by mail-oi1-x229.google.com with SMTP id k2so16993454oic.13; Mon, 07 Dec 2020 13:04:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:message-id:in-reply-to:references:subject :mime-version:content-transfer-encoding; bh=cJ62JFUhP5zgABSp3fn8pdS4RMxFYvfg32dIjTX9vaU=; b=ZDpsg3E/+Nq7MJ/v7Uxff8IAu/Hm7yxgeE0QUaPWzpJamhxR8d3UiJIUYMzQDlnlY3 6x9ncuBw8n1j7tD/FpB18qfl2biiQ7Yzwi2FRl/2bp+s4LinLo8AZux7MBYXpPN6HoH+ VgFv92tfCkjIlJXei+R50b5AM/SnEBpMOgZ1JtAITWZCLQzUrePD+UVRkUk5HNShzy2n SU5w/ZqzPyjn6tiEsZz0UpN8mSek9Gt9R+CotzhikWs1MAwkSEaehgusu4tQ2zkNu15k uhOGReyOdW8s/QXUQqOfrRxrfIIhfVLUpvNkGanrjukdtRMH4foAFcxK38uPhopRN+Fh S2Wg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:message-id:in-reply-to :references:subject:mime-version:content-transfer-encoding; bh=cJ62JFUhP5zgABSp3fn8pdS4RMxFYvfg32dIjTX9vaU=; b=fdn4yusY1HzyRsVdSFPcpnm5oN9riFjLuV5Soi1uV2JNPyZk8XM0QVEHRfI/acTPCL XYOh72UIXf0s4bfpRVmXwJmkp5V4P7S7PfaDROG1u8dszujn1oeHdngbyMuEgTVK31fF fQUlFhJvo7kOP6etJK37DiprqJzaMdimbIWc95ERctbxbJRjm+NgxSGwyoDK7BDo9Zy/ yx60IyLDAJ89HgXqZkAQnAXO95hAGP3eOwRNzWRskFARyVGb0A+yRzG6zGVKkY8heVlx 97l/g2M5f6iCjCdKEEaNoqsthnvGxxW6ZXHKkq0AyYvcYNIpgZP6IFyGxAPoEOmgeCpX wllw== X-Gm-Message-State: AOAM532eIERWsV7vSdGfKS6dA+NS/uAwkCrlTWWuyXu7G/QFuX5UICrp TsE8BCiJMi7HTqJfNUysw1w= X-Received: by 2002:aca:5e03:: with SMTP id s3mr493601oib.125.1607375071747; Mon, 07 Dec 2020 13:04:31 -0800 (PST) Received: from localhost ([184.21.204.5]) by smtp.gmail.com with ESMTPSA id o21sm1579819otj.1.2020.12.07.13.04.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Dec 2020 13:04:31 -0800 (PST) Date: Mon, 07 Dec 2020 13:04:23 -0800 From: John Fastabend To: Brendan Jackman , bpf@vger.kernel.org Cc: Alexei Starovoitov , Yonghong Song , Daniel Borkmann , KP Singh , Florent Revest , linux-kernel@vger.kernel.org, Jann Horn , Brendan Jackman Message-ID: <5fce98d7d860e_5a9620833@john-XPS-13-9370.notmuch> In-Reply-To: <20201207160734.2345502-2-jackmanb@google.com> References: <20201207160734.2345502-1-jackmanb@google.com> <20201207160734.2345502-2-jackmanb@google.com> Subject: RE: [PATCH bpf-next v4 01/11] bpf: x86: Factor out emission of ModR/M for *(reg + off) Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Brendan Jackman wrote: > The case for JITing atomics is about to get more complicated. Let's > factor out some common code to make the review and result more > readable. > > NB the atomics code doesn't yet use the new helper - a subsequent > patch will add its use as a side-effect of other changes. > > Signed-off-by: Brendan Jackman > --- Small nit on style preference below. Acked-by: John Fastabend [...] > > @@ -1240,11 +1250,7 @@ st: if (is_imm8(insn->off)) > goto xadd; > case BPF_STX | BPF_XADD | BPF_DW: > EMIT3(0xF0, add_2mod(0x48, dst_reg, src_reg), 0x01); > -xadd: if (is_imm8(insn->off)) > - EMIT2(add_2reg(0x40, dst_reg, src_reg), insn->off); > - else > - EMIT1_off32(add_2reg(0x80, dst_reg, src_reg), > - insn->off); > +xadd: emit_modrm_dstoff(&prog, dst_reg, src_reg, insn->off); I at least prefer the xadd on its own line above the emit_*(). That seems more consistent with the rest of the code in this file. The only other example like this is st:.