Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp1419507pxa; Thu, 20 Aug 2020 10:46:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyAB9DCVG6rA5q3z1XCZijfJMTfx/Sa8gC+HF2G3vqH8br+NmAggWJT5nl2vOw48zJm73Pa X-Received: by 2002:a17:907:372:: with SMTP id rs18mr4286534ejb.146.1597945588879; Thu, 20 Aug 2020 10:46:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597945588; cv=none; d=google.com; s=arc-20160816; b=REmfL0VUvumkm56jPKNa1rqihZot8m7MGUdDXxU8HNampxDno1dten42YT/xqnUTwI HtIY8Fi/lA9JyuMbeKCI3uxq95WNiNEtEclA14IL1tbnkZTKIjJYhqr+EAke2qHRh5Q6 lnBaLV4KUJVA8b7soFwg03C0PRT8onh8+pouOHAZSb4pUnoMd2cYDco7njaxIrnlspiO 3lV0oScFe9nnG5mBIcbGIKno9Cvq4VoaJrYm8cLYXN5rmGWoWjOm2w1efEAii3fgpeCy 0KcV3jkqlMuOmrtoz6IBWlS/z0/gfbjz8tB0GjiSnS+p/f+g8baAnd1lRfO+YAmeNK6l H2rg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=AgLB407bKm54/IrZ6UCuTIQNo2tX1E4LKdmKF7McOxA=; b=D0m47dSC8N9nnUSaWD4P4pSQe7KQEuEI3z1m6wGGM+t+X9QVdyYvxns6M2LLfwY0QX DzSqF9T1XODRdFhQBYT60lBamQC6e5kQDGFXHZFX1JFonTyiAnid3y0QkuayPVwKxfgG TCYSzLA3lnDIah2WCfWGGIHBydP9jNG+Keh6Qc11P1s1Lw2xSHsvFjTr9GgW2Vk9+RdY xCVIPoDt4bzylHWR5KxYWZOwmw1sc6joprnOIniD7yGtHxJ26EXtbZW9WHSfCeydzz35 k+70EB4QztFxZuW6gIjaGH3mFd7tgswtX7t3L7wGh6x9sb+Xkq3IvhhYzw4b16L/F3Qu As8w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@posk.io header.s=google header.b=R84jP9dg; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id jo14si1718966ejb.639.2020.08.20.10.46.05; Thu, 20 Aug 2020 10:46:28 -0700 (PDT) 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=@posk.io header.s=google header.b=R84jP9dg; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728067AbgHTRmm (ORCPT + 99 others); Thu, 20 Aug 2020 13:42:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48524 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728009AbgHTRmU (ORCPT ); Thu, 20 Aug 2020 13:42:20 -0400 Received: from mail-ua1-x92e.google.com (mail-ua1-x92e.google.com [IPv6:2607:f8b0:4864:20::92e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6A5F2C061386 for ; Thu, 20 Aug 2020 10:42:19 -0700 (PDT) Received: by mail-ua1-x92e.google.com with SMTP id d20so812593ual.13 for ; Thu, 20 Aug 2020 10:42:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=posk.io; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=AgLB407bKm54/IrZ6UCuTIQNo2tX1E4LKdmKF7McOxA=; b=R84jP9dgvDeMoE2uEu+DF3AzBT5JNaKMCWQ4uCwEUKPxuNmwM7AXtxgRmH9vE+TQeE Oah0ew6Va5dDXIcJ0Sjl3icIyEVfYvHNPq8+dsWbA5eS34smi/yPvhdLGCumnolaqKui 1iy5tM5Uhau+Nia85uAx+l7BXvdZETkn6m3ZEH1nuhX3Tj0SqLsa/xSeSX0gHVdhqOiH KRH4n7yk+2B6HP3lvzpEoCHT43c6QW0Diq65ONkUD+NF8moo5oSe4bnh39RVq09Zxt3o gie0sMhFlgaUUUx4EWO/KhD2g5nwgrshfLBAmIYzxWT1sn90RWDl4ymlzJ9sUDtv3cT4 iLqA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=AgLB407bKm54/IrZ6UCuTIQNo2tX1E4LKdmKF7McOxA=; b=aVaj+XLEn/Chr+LDlWlh3X2dviu7E62F3DCotzhsarKMsjb/qZdQ1wSSaQZ4SKR1a9 PmIIelI22pV4yh2yXbNDm7FVXPXCvMi+EWftd4kEz7+pz9O90EmNztAEhxBLa2w4SE5J uGR2c+J5/q4n6ieoC2b2KKcBWuMS9+gC6RGFEjKia7ElKrWEufQ7YprP+SS57o5PQxGN Dy805NGv11sL8bfBxRimBHMVRRImb+D5Z2cWctHKkJpLpzeeyA0/+X3K86Y+36UunHaw r3TL2jmTfWgA585FZmdovmYf1kG2V/HZMdhMfzooAC5dx3Fuc5mcdxX1KX9ahcLaMBAr Qn6w== X-Gm-Message-State: AOAM531ImgEiBpZJk+K5KxLinZkTxScPsyTJUo249M/uoa8AXuTy70kw OXjXyngoURTGAte9eKYXEsDGSQFweEpjpb6BwP6pQg== X-Received: by 2002:ab0:7183:: with SMTP id l3mr2519103uao.139.1597945336910; Thu, 20 Aug 2020 10:42:16 -0700 (PDT) MIME-Version: 1.0 References: <20200811000959.2486636-1-posk@google.com> <20200811062733.GP3982@worktop.programming.kicks-ass.net> <1003774683.6088.1597257002027.JavaMail.zimbra@efficios.com> <1477195446.6156.1597261492255.JavaMail.zimbra@efficios.com> In-Reply-To: <1477195446.6156.1597261492255.JavaMail.zimbra@efficios.com> From: Peter Oskolkov Date: Thu, 20 Aug 2020 10:42:05 -0700 Message-ID: Subject: Re: [PATCH 1/2 v3] rseq/membarrier: add MEMBARRIER_CMD_PRIVATE_EXPEDITED_RSEQ To: Mathieu Desnoyers Cc: linux-arch , Peter Zijlstra , Peter Oskolkov , paulmck , Boqun Feng , linux-kernel , Paul Turner , Chris Kennelly Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Aug 12, 2020 at 12:44 PM Mathieu Desnoyers wrote: > [...] > > > One way of doing what you suggest is to allow some commands to be bitwise-ORed. > > > > So, for example, the user could call > > > > membarrier(CMD_PRIVATE_EXPEDITED_SYNC_CORE | CMD_PRIVATE_EXPEDITED_RSEQ, cpu_id) > > > > Is this what you have in mind? > > Not really. This would not take care of the fact that we would end up multiplying > the number of commands as we allow combinations. E.g. if we ever want to have RSEQ > work in private and global, and in non-expedited and expedited, we end up needing: > > - CMD_REGISTER_PRIVATE_EXPEDITED_RSEQ > - CMD_PRIVATE_EXPEDITED_RSEQ > - CMD_PRIVATE_RSEQ > - CMD_REGISTER_GLOBAL_EXPEDITED_RSEQ > - CMD_GLOBAL_EXPEDITED_RSEQ > - CMD_GLOBAL_RSEQ > > The only thing we would save by OR'ing it with the SYNC_CORE command is the additional > list: > > - CMD_REGISTER_PRIVATE_EXPEDITED_RSEQ_SYNC_CORE > - CMD_PRIVATE_EXPEDITED_RSEQ_SYNC_CORE > - CMD_PRIVATE_RSEQ_SYNC_CORE > - CMD_REGISTER_GLOBAL_EXPEDITED_RSEQ_SYNC_CORE > - CMD_GLOBAL_EXPEDITED_RSEQ_SYNC_CORE > - CMD_GLOBAL_RSEQ_SYNC_CORE > > But unless we receive feedback that doing a membarrier with RSEQ+sync_core all in > one go is a significant use-case, I am tempted to leave out that scenario for now. > If we go for new commands, this means we could add (for private-expedited-rseq): > > - MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED_RSEQ, > - MEMBARRIER_CMD_PRIVATE_EXPEDITED_RSEQ, > > I do however have use-cases for using RSEQ across shared memory (between > processes). Not currently for a rseq-fence, but for rseq acting as per-cpu > atomic operations. If I ever end up needing rseq-fence across shared memory, > that would result in the following new commands: > > - MEMBARRIER_CMD_REGISTER_GLOBAL_EXPEDITED_RSEQ, > - MEMBARRIER_CMD_GLOBAL_EXPEDITED_RSEQ, > > The remaining open question is whether it would be OK to define a new > membarrier flag=MEMBARRIER_FLAG_CPU, which would expect an additional > @cpu parameter. Hi Mathieu, I do not think there is any reason to wait for additional feedback, so I believe we should finalize the API/ABI. I see two issues to resolve: 1: how to combine commands: - you do not like adding new commands that are combinations of existing ones; - you do not like ORing. => I'm not sure what other options we have here? 2: should @flags be repurposed for cpu_id, or MEMBARRIER_FLAG_CPU added with a new syscall parameter. => I'm still not sure a new parameter can be cleanly added, but I can try it in the next patchset if you prefer it this way. Please let me know your thoughts. Thanks, Peter