linux-crypto.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Wang Jinchao <wangjinchao@xfusion.com>
To: Daniel Jordan <daniel.m.jordan@oracle.com>
Cc: Steffen Klassert <steffen.klassert@secunet.com>,
	<linux-crypto@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<stone.xulei@xfusion.com>
Subject: Re: [RFC/REFACT] Refactoring and significantly reducing code complexity
Date: Thu, 26 Oct 2023 09:45:18 +0800	[thread overview]
Message-ID: <ZTnEruSMS1ldSR4j@fedora> (raw)
In-Reply-To: <ZTm9FtrdLXekn5Rm@fedora>

On Thu, Oct 26, 2023 at 09:12:54AM +0800, Wang Jinchao wrote:
> On Wed, Oct 25, 2023 at 02:12:31PM -0400, Daniel Jordan wrote:
> > On Thu, Sep 28, 2023 at 04:53:38PM +0800, Wang Jinchao wrote:
> > > -/**
> > > - * struct parallel_data - Internal control structure, covers everything
> > > - * that depends on the cpumask in use.
> > > - *
> > > - * @ps: padata_shell object.
> > > - * @reorder_list: percpu reorder lists
> > > - * @squeue: percpu padata queues used for serialuzation.
> > > - * @refcnt: Number of objects holding a reference on this parallel_data.
> > > - * @seq_nr: Sequence number of the parallelized data object.
> > > - * @processed: Number of already processed objects.
> > > - * @cpu: Next CPU to be processed.
> > > - * @cpumask: The cpumasks in use for parallel and serial workers.
> > > - * @reorder_work: work struct for reordering.
> > > - * @lock: Reorder lock.
> > > - */
> > > -struct parallel_data {
> > > -	struct padata_shell		*ps;
> > > -	struct padata_list		__percpu *reorder_list;
> > > -	struct padata_serial_queue	__percpu *squeue;
> > > -	refcount_t			refcnt;
> > > -	unsigned int			seq_nr;
> > > -	unsigned int			processed;
> > > -	int				cpu;
> > > -	struct padata_cpumask		cpumask;
> > > -	struct work_struct		reorder_work;
> > > -	spinlock_t                      ____cacheline_aligned lock;
> > > -};
> > 
> > reorder_list used to serialize one sequence of objects per padata_shell,
> > but now serial_wq serializes all sequences of objects in one list of
> > work_structs.  That works in theory, since a total order can maintain
> > each sequence's order, but it's possible (not sure yet, need to think
> > more) that this could lead to deadlocks or other issues in odd cases
> > such as the one that padata_shell was introduced for in bbefa1dd6a6d
> > ("crypto: pcrypt - Avoid deadlock by using per-instance padata queues").
> > 
> Yes, you are correct. This version is not only ordered at the padata_shell
> level but at the instance level, which indeed doesn't align with the design.
> Apart from potential deadlocks, it may also cause a padata_shell_B that
> should have completed earlier to be blocked by an unrelated padata_shell_B.
> I will address this issue in subsequent patches.
Apart from potential deadlocks, it may also cause a padata_shell_B that
should have completed earlier to be blocked by an unrelated padata_shell_A.
I will address this issue in subsequent patches.

      reply	other threads:[~2023-10-26  1:45 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-28  8:53 [RFC/REFACT] Refactoring and significantly reducing code complexity Wang Jinchao
2023-09-29  5:47 ` Steffen Klassert
2023-10-07  1:17   ` Wang Jinchao
2023-10-16 10:28     ` Steffen Klassert
2023-10-25 18:13     ` Daniel Jordan
2023-10-26  1:15       ` Wang Jinchao
2023-10-08  7:58   ` Wang Jinchao
2023-10-16 10:47 ` Steffen Klassert
2023-10-25 18:07 ` Daniel Jordan
2023-10-26  1:07   ` Wang Jinchao
2023-10-25 18:12 ` Daniel Jordan
2023-10-26  1:12   ` Wang Jinchao
2023-10-26  1:45     ` Wang Jinchao [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZTnEruSMS1ldSR4j@fedora \
    --to=wangjinchao@xfusion.com \
    --cc=daniel.m.jordan@oracle.com \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=steffen.klassert@secunet.com \
    --cc=stone.xulei@xfusion.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).