Received: by 2002:ac0:98c7:0:0:0:0:0 with SMTP id g7-v6csp153056imd; Wed, 31 Oct 2018 16:22:57 -0700 (PDT) X-Google-Smtp-Source: AJdET5cufhb2EvJgWWR4kvhFdi7hs9NoFKu84AaUQNtIrCW1xVB3oFCyF82t2LciyUOVjlXL0dX/ X-Received: by 2002:a62:388b:: with SMTP id f133-v6mr5369874pfa.48.1541028177473; Wed, 31 Oct 2018 16:22:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1541028177; cv=none; d=google.com; s=arc-20160816; b=S6eKoJEQIv6xguoQI4qILcp6G5mxtqKilLYKooEOKwd6i6cfKs1QJ5oXMBNRWmtBT0 z8INDSQKc1pFfdNzMO80o8GlOscHCfrEmNSxuqJtlnsFZxry3/Cq3x3HcwTZuYu1waLa uz3HVMFMGLdvD1PisgF8YLLL2yJd1eGa4h3ufwcslnPBYg0l0LTpLTC4oI0uJmyHApfB NA8mXyQmiyKtUt12OH1FUFhB3A0udoI5VbRc9Q2WJ5Qe9y2Ermlmp0Ob+UcucI79G0Po rAUtEbdALG2oZ4kg/FVTI/myTNvaHv5IVioiAWCWSdwTN+mZeeYbNIKzKKNuY+zhJSlv gijQ== 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=TT21JLJWskt2g1msOdcsqE48Bpu2vFvvh1THgqTNaLk=; b=SE0cuq4zccVK5iXCgAc580srlqsK0RszrSt1G/8bu5SoIMX/a5pHfdRFouaA6A8RDk 3R9wnW1bBRD0MXZuFisDDsLhZLLbPqf3cNws4It7xULBQuQF9W1lDsbkFy8BBmT0g36h 6ojpQnDCwiTV4NYX63dHG6UPdKY/R8sKzNZ70LkuCKALi6KJmyHhgokF/tL7Jat87bUQ i+SuCwnNLiNPnMFOcXjHcdGrMgnTDSalPBbeeOUSckXB675+mjSu+kuQV+rJ14MItzVs s9PsJyXkSujnXuZRJueqyZvveWFKddvHs59CHiTP2TToEfObq+7DQUD5NGF981uryNpm VaLg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amacapital-net.20150623.gappssmtp.com header.s=20150623 header.b=Hm+tK84D; 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 h20-v6si1875310plr.343.2018.10.31.16.22.42; Wed, 31 Oct 2018 16:22:57 -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=@amacapital-net.20150623.gappssmtp.com header.s=20150623 header.b=Hm+tK84D; 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 S1731935AbeKAIU1 (ORCPT + 99 others); Thu, 1 Nov 2018 04:20:27 -0400 Received: from mail-wm1-f66.google.com ([209.85.128.66]:53692 "EHLO mail-wm1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731825AbeKAIU0 (ORCPT ); Thu, 1 Nov 2018 04:20:26 -0400 Received: by mail-wm1-f66.google.com with SMTP id v24-v6so6846762wmh.3 for ; Wed, 31 Oct 2018 16:20:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amacapital-net.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=TT21JLJWskt2g1msOdcsqE48Bpu2vFvvh1THgqTNaLk=; b=Hm+tK84DOjoWRGUYFyb4UbI1bKiMKShx86X1Bc9gs/pD7Ec+J2XR+/e1q+GmMuV3/Z a+6xynZcyRqAhRGJMQjW3HJ6oCYcahrGfh9Q5lid44xbmndLew8FOZpSG0mdw8g1EocS wLV0PTpcLVoGhojbV4jGo0YLaMFENEZQBSRSwHhmJ/aRxeljkqSAkPArlmHGXuE+Zj6n UmSCEWBroNAjImrJK8FGEAwTTGHHvj3BydZrs/Nyee8XP2xV4qCWt82JPPL8Z5LhBg4w VVnQ9rZlpeNO6iibcMfV6xTggedC8VNzvwoTRa9Rcwtx6rrGT2Q5iBfhdk0gj2SyoSQh Omjg== 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=TT21JLJWskt2g1msOdcsqE48Bpu2vFvvh1THgqTNaLk=; b=Naz0oTZ7AL9vPvpqIxT+0rdWPRN5oGTTKR3KMl2cBkAUFvbjvyDHTcWweXmmzMwTH2 8fBVv7OZRrjzT6vt5bVb6pfzRQGYnoebTcbC2COYyb/LrxRcuadrvz18pAPqaxCF4hNH NvC9bPwijpJbQJITkZx6VOC+xHg0mXdypV0jntrWin/Mc21ylu9ylYF3yjy+bYBvhQxU WoDqyx00Aua/C2SEe9Ap5hVH6X83oZCKZf3nbZJOydYMWBh0qnGmMt+431AUVBdjWQSR MGLLuMJYXfF/1e5KVPnMOHnAQBO4Oi9+aciaWWybQ5EafrtxTpi5RLUdtciQhkYesezo Ef2g== X-Gm-Message-State: AGRZ1gIQmvxW0y0qt/DAL1gEh3Pt4s0xlRPsKh9H4X/5nrGhoJoPS4cR f8BqwfCzNqXeVbUMauoUKOl6cR3wuv4lP46O9LtaRA== X-Received: by 2002:a1c:4b1a:: with SMTP id y26-v6mr3933349wma.82.1541028010252; Wed, 31 Oct 2018 16:20:10 -0700 (PDT) MIME-Version: 1.0 References: <0A7AFB50-9ADE-4E12-B541-EC7839223B65@amacapital.net> <20181030175814.GB10491@bombadil.infradead.org> <20181030182841.GE7343@cisco> <20181030192021.GC10491@bombadil.infradead.org> <9edbdf8b-b5fb-5a82-43b4-b639f5ec8484@gmail.com> <20181030213557.GE10491@bombadil.infradead.org> <20181031100237.GN744@hirez.programming.kicks-ass.net> <659CFC78-22BF-492B-B2E4-B8E89AA08446@amacapital.net> <20181031210032.GA3159@hirez.programming.kicks-ass.net> <2E29C35B-3F98-473D-A874-0D9B9B15B399@amacapital.net> <4124995b-4363-9b37-19b1-1879bf04978b@gmail.com> In-Reply-To: <4124995b-4363-9b37-19b1-1879bf04978b@gmail.com> From: Andy Lutomirski Date: Wed, 31 Oct 2018 16:19:58 -0700 Message-ID: Subject: Re: [PATCH 10/17] prmem: documentation To: Igor Stoppa Cc: Peter Zijlstra , Matthew Wilcox , Tycho Andersen , Kees Cook , Mimi Zohar , Dave Chinner , James Morris , Michal Hocko , Kernel Hardening , linux-integrity , LSM List , Igor Stoppa , Dave Hansen , Jonathan Corbet , Laura Abbott , Randy Dunlap , Mike Rapoport , "open list:DOCUMENTATION" , LKML , Thomas Gleixner 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, Oct 31, 2018 at 4:10 PM Igor Stoppa wrote: > > > > On 01/11/2018 00:57, Andy Lutomirski wrote: > > > > > >> On Oct 31, 2018, at 2:00 PM, Peter Zijlstra wrote: > > > > >> I _think_ the use-case for atomics is updating the reference counts of > >> objects that are in this write-rare domain. But I'm not entirely clear > >> on that myself either. I just really want to avoid duplicating that > >> stuff. > > > > Sounds nuts. Doing a rare-write is many hundreds of cycles at best. Using that for a reference count sounds wacky. > > > > Can we see a *real* use case before we over complicate the API? > > > > > Does patch #14 of this set not qualify? ima_htable.len ? > > https://www.openwall.com/lists/kernel-hardening/2018/10/23/20 > Do you mean this (sorry for whitespace damage): + pratomic_long_inc(&ima_htable.len); - atomic_long_inc(&ima_htable.len); if (update_htable) { key = ima_hash_key(entry->digest); - hlist_add_head_rcu(&qe->hnext, &ima_htable.queue[key]); + prhlist_add_head_rcu(&qe->hnext, &ima_htable.queue[key]); } ISTM you don't need that atomic operation -- you could take a spinlock and then just add one directly to the variable. --Andy