Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp595851ybi; Wed, 17 Jul 2019 01:51:11 -0700 (PDT) X-Google-Smtp-Source: APXvYqxNw1rlnhctxt6mks2/9GfumAU0/XgEoYXHNmqg4Xtw1B1hfPeMaawcFZYJWoGPdAgSfJni X-Received: by 2002:a17:90a:8b98:: with SMTP id z24mr43097755pjn.77.1563353471544; Wed, 17 Jul 2019 01:51:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563353471; cv=none; d=google.com; s=arc-20160816; b=F60FbtlxzeJ3fh+MZe2DUN7+49PI6peEqcTRrB2X/bw5E62mstFyhdSsjlVFshXN70 A1sA407fSeSYvYMNVBZ6QX/RNGrvBKHQhNnXvUzpGB2ZVUJyQj7MLEL1CtkCddZ1KNVY ptkqllmQf0e3HD3WNcehZCRDTT2LdeFut9lau4+zbdMAuNkmJP/ZqS2E9YCGpHEceuoR jZ06dCtvOOb6L87RJRI4hMEgHS3B/f+AYENnhtZ6sA6cfUpHuDbnqSD6+JrC/RvkaA/B XGtmdfMpGoPr/yQC41yRIOjPEwGlqEOAZp/9OJcJIUQy6s12snelAZKEww1vLbUeoXd5 scRg== 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; bh=7R4ZggptvjunmICZ1TYMx5Y9HEHido25pZDDNR5I9sQ=; b=w03ddJg3Y6uVpnz8UHc3OEOk9sv2BTtSXQ7nBAoKkVKqOR1iCc1JkcKLpgURW6yN5k ClCfyRuxQrcbNoCt8HG6DoCyCPQSBo2j8JNxRmYBc1SHybo5m78LpWU5CTL+eIAH+k08 l/2IDzXtgUTTYs63sjRMOqJvheb2B69i/gU6AiG6bjoDcX4PMddy1eNtzec7VIBkll2f ZlyVIPTaflB9eVf5Mkdgv9M8iMgqSHiQ0DLIaWTLER7cFCxK3a1xe4b8GGt/c1W3/xUJ CGDC48ZAYi9gX4E3/ttjRZ23MYRsoFKrUiaMHXbwdhf8E4DIQzY2pR0QHW63emoTtk6F ltNA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-crypto-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 c4si23081092pfn.71.2019.07.17.01.50.57; Wed, 17 Jul 2019 01:51:11 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-crypto-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-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726610AbfGQIu2 (ORCPT + 99 others); Wed, 17 Jul 2019 04:50:28 -0400 Received: from helcar.hmeau.com ([216.24.177.18]:55338 "EHLO deadmen.hmeau.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726186AbfGQIu2 (ORCPT ); Wed, 17 Jul 2019 04:50:28 -0400 Received: from gondobar.mordor.me.apana.org.au ([192.168.128.4] helo=gondobar) by deadmen.hmeau.com with esmtps (Exim 4.89 #2 (Debian)) id 1hnfdc-00018b-0A; Wed, 17 Jul 2019 16:50:12 +0800 Received: from herbert by gondobar with local (Exim 4.89) (envelope-from ) id 1hnfdb-0002f9-S4; Wed, 17 Jul 2019 16:50:11 +0800 Date: Wed, 17 Jul 2019 16:50:11 +0800 From: Herbert Xu To: Steffen Klassert Cc: Daniel Jordan , andrea.parri@amarulasolutions.com, boqun.feng@gmail.com, paulmck@linux.ibm.com, peterz@infradead.org, linux-arch@vger.kernel.org, linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [v2 PATCH] padata: Use RCU when fetching pd from do_serial Message-ID: <20190717085011.hpihksnhrqt2vilo@gondor.apana.org.au> References: <20190712101012.GW14601@gauss3.secunet.de> <20190712160737.iniaaxlsnhs6azg5@ca-dmjordan1.us.oracle.com> <20190713050321.c5wq7a7jrb6q2pxn@gondor.apana.org.au> <20190715161045.zqwgsp62uqjnvx3l@ca-dmjordan1.us.oracle.com> <20190716100447.pdongriwwfxsuajf@gondor.apana.org.au> <20190716111410.GN17989@gauss3.secunet.de> <20190716125704.l2jolyyd3bue6hhn@gondor.apana.org.au> <20190716130928.ga4acvxipsdzyzlp@gondor.apana.org.au> <20190716132345.ujj2v3kqra2lbi75@gondor.apana.org.au> <20190717083641.GQ17989@gauss3.secunet.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190717083641.GQ17989@gauss3.secunet.de> User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org On Wed, Jul 17, 2019 at 10:36:41AM +0200, Steffen Klassert wrote: > > > This patch fixes it by using RCU just as we do in padata_do_parallel. > > RCU alone won't help because if some object is queued for async > crypto, we left the RCU protected aera. I think padata_do_serial > needs to do RCU and should free 'parallel_data' if the flag > PADATA_RESET is set and the refcount goes to zero. padata_replace > should do the same then. Yes this patch doesn't work because you can't just switch over to the new pd as the old pd will then get stuck due to the missing entry. > > index 5d13d25da2c8..ce51555cb86c 100644 > > @@ -367,7 +367,7 @@ void padata_do_serial(struct padata_priv *padata) > > struct parallel_data *pd; > > int reorder_via_wq = 0; > > > > - pd = padata->pd; > > + pd = rcu_dereference_bh(padata->inst->pd); > > Why not just > > pd = rcu_dereference_bh(padata->pd); I was trying to get the new pd which could only come from the inst. In any case the whole RCU idea doesn't work so we'll probably do the refcount idea that you suggested. Cheers, -- Email: Herbert Xu Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt