Received: by 2002:a05:6a10:d5a5:0:0:0:0 with SMTP id gn37csp3213352pxb; Sat, 9 Oct 2021 04:59:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzY8VzPy6gqXuH7JREk9+h/g7BtXczBDD2vrwIvjDx653CKIS1PcEpnrwInGB82ohHLp5/z X-Received: by 2002:a63:1656:: with SMTP id 22mr9386381pgw.20.1633780782491; Sat, 09 Oct 2021 04:59:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633780782; cv=none; d=google.com; s=arc-20160816; b=gLOkMsJaRwJy/VXsJ7VDX3Mca/6pgU/4s8xGHhTorefSxjdPkUNcy5ODiqiZSLA0Ik 6hIWUIX8jbnPrsCoikdlbO04yyy7SGhGk+jiCQfBNt5MVxVrufPHgVQZkmGeWc7fP7QG x3rPm+6UFP37lA54UOrsCAfJhlBGwrzxw4MlRWjOgFqFoLY0ecHsK0x0sVMtI2qVZCDV 8NqfLxntmYucyrvt9bHeP+2FhsSx3hH26il7xeZYJv8rOY32CVmYWleShL1VWsqN0iCT YummBcGjh+pOYsrW59p+RCHTDCCVc2bTEpwSyYTm0GIZacGLoceB9G1e1SqfFuAl1IU9 Y8Zw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=jp0VWtbBQ+KmzOQIt0V6PqYIDrOXZdS509Pj+7grsuk=; b=Vw5HVR42laP+Ebi+2TdWQv1ewZAtKXADn9RDLnVz81DyswMVJFBXbg8YT8zegIT+zQ S2oxQ29KshMqeuekeHOcqy7Xbt/Ptkm3st/tHsN9WIqYuOhqb5PlS4c0vF9F3oXTaJHV YxUvrCs8HFvTlp1ob0iYu/fj1WyNQ3lqwyt76ziI6u4DsmHtBFiS4JEiBkOMsA2Px2Ru dIQRFoPFWsntA45N2lUqTzCmCF5HpPXNwmbStCuY8hghddniCjufSpZCSUBBkBuvWT1x zcWkBdgLwuA0V7INWoPyKjzI4DezNUnbboJPKyn1z/gk3aoA1JKGlGX8WIzO1B6i1nvE fqGQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=mkCpX97D; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y188si3163505pfc.251.2021.10.09.04.59.29; Sat, 09 Oct 2021 04:59:42 -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=@linuxfoundation.org header.s=korg header.b=mkCpX97D; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244765AbhJIMAn (ORCPT + 99 others); Sat, 9 Oct 2021 08:00:43 -0400 Received: from mail.kernel.org ([198.145.29.99]:44642 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232865AbhJIMAm (ORCPT ); Sat, 9 Oct 2021 08:00:42 -0400 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 Cc: jirislaby@kernel.org, amit@kernel.org, arnd@arndb.de, osandov@fb.com, shile.zhang@linux.alibaba.com, linuxppc-dev@lists.ozlabs.org, virtualization@lists.linux-foundation.org, linux-kernel@vger.kernel.org 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-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20211009114829.1071021-3-xianting.tian@linux.alibaba.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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