From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 63E0DC433FE for ; Sat, 9 Oct 2021 11:58:50 +0000 (UTC) Received: from smtp4.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 1E4A160F6F for ; Sat, 9 Oct 2021 11:58:50 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 1E4A160F6F Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linuxfoundation.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.linux-foundation.org Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id DE81440354; Sat, 9 Oct 2021 11:58:49 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id HLY2sZg3dW9x; Sat, 9 Oct 2021 11:58:49 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp4.osuosl.org (Postfix) with ESMTPS id 76F7F402E9; Sat, 9 Oct 2021 11:58:48 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 4952FC000F; Sat, 9 Oct 2021 11:58:48 +0000 (UTC) Received: from smtp2.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by lists.linuxfoundation.org (Postfix) with ESMTP id 3BAA1C000D for ; Sat, 9 Oct 2021 11:58:47 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id 1CB7840502 for ; Sat, 9 Oct 2021 11:58:47 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Authentication-Results: smtp2.osuosl.org (amavisd-new); dkim=pass (1024-bit key) header.d=linuxfoundation.org Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id lWoQNrHHYjIr for ; Sat, 9 Oct 2021 11:58:46 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.8.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp2.osuosl.org (Postfix) with ESMTPS id 721C9403BA for ; Sat, 9 Oct 2021 11:58:46 +0000 (UTC) Received: by mail.kernel.org (Postfix) with ESMTPSA id 7C90860EE9; Sat, 9 Oct 2021 11:58:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1633780726; bh=+OEjWjipj45LByfaax3IC8mrbba3ydp9JA4U4ynR9rI=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=mkCpX97DtP87MbbFXKOvS+YAu0qSRrD74iQqaPGxGyRJsrY10jekAwJKiGtJtApBB 8UsomooHdrFybbbw4FL03YwBS2WRVf5XZ8pKF6VT2/S7LswA8yWPInqdbx6WgjcrhD ANdNm19s2lwdoEvrbjE/5Ldyv7GuJviBkfcNo8mg= Date: Sat, 9 Oct 2021 13:58:43 +0200 From: Greg KH To: Xianting Tian Subject: Re: [PATCH v10 2/3] tty: hvc: pass DMA capable memory to put_chars() Message-ID: References: <20211009114829.1071021-1-xianting.tian@linux.alibaba.com> <20211009114829.1071021-3-xianting.tian@linux.alibaba.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20211009114829.1071021-3-xianting.tian@linux.alibaba.com> Cc: arnd@arndb.de, amit@kernel.org, jirislaby@kernel.org, shile.zhang@linux.alibaba.com, linux-kernel@vger.kernel.org, virtualization@lists.linux-foundation.org, linuxppc-dev@lists.ozlabs.org, osandov@fb.com X-BeenThere: virtualization@lists.linux-foundation.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Linux virtualization List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: virtualization-bounces@lists.linux-foundation.org Sender: "Virtualization" On Sat, Oct 09, 2021 at 07:48:28PM +0800, Xianting Tian wrote: > --- a/drivers/tty/hvc/hvc_console.h > +++ b/drivers/tty/hvc/hvc_console.h > @@ -32,13 +32,21 @@ > */ > #define HVC_ALLOC_TTY_ADAPTERS 8 > > +/* > + * These sizes are most efficient for vio, because they are the > + * native transfer size. We could make them selectable in the > + * future to better deal with backends that want other buffer sizes. > + */ > +#define N_OUTBUF 16 > +#define N_INBUF 16 > + > +#define __ALIGNED__ __attribute__((__aligned__(sizeof(long)))) Does this conflict with what is in hvcs.c? > + > struct hvc_struct { > struct tty_port port; > spinlock_t lock; > int index; > int do_wakeup; > - char *outbuf; > - int outbuf_size; > int n_outbuf; > uint32_t vtermno; > const struct hv_ops *ops; > @@ -48,6 +56,18 @@ struct hvc_struct { > struct work_struct tty_resize; > struct list_head next; > unsigned long flags; > + > + /* the buf is used in hvc console api for putting chars */ > + char cons_outbuf[N_OUTBUF] __ALIGNED__; > + spinlock_t cons_outbuf_lock; Did you look at the placement using pahole as to how this structure now looks? > + > + /* the buf is for putting single char to tty */ > + char outchar; > + spinlock_t outchar_lock; So you have a lock for a character and a different one for a longer string? Why can they not just use the same lock? Why are 2 needed at all, can't you just use the first character of cons_outbuf[] instead? Surely you do not have 2 sends happening at the same time, right? > + > + /* the buf is for putting chars to tty */ > + int outbuf_size; > + char outbuf[0] __ALIGNED__; I thought we were not allowing [0] anymore in kernel structures? thanks, greg k-h _______________________________________________ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization