LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Xianting Tian <xianting.tian@linux.alibaba.com>
To: Greg KH <gregkh@linuxfoundation.org>
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
Subject: Re: [PATCH v10 2/3] tty: hvc: pass DMA capable memory to put_chars()
Date: Thu, 14 Oct 2021 16:56:05 +0800	[thread overview]
Message-ID: <8225536f-8ecb-0678-f630-265652793a42@linux.alibaba.com> (raw)
In-Reply-To: <YWftKQ3fTb8QlM6/@kroah.com>


在 2021/10/14 下午4:41, Greg KH 写道:
> On Thu, Oct 14, 2021 at 04:34:59PM +0800, Xianting Tian wrote:
>> 在 2021/10/10 下午1:33, Greg KH 写道:
>>> On Sat, Oct 09, 2021 at 11:45:23PM +0800, Xianting Tian wrote:
>>>> 在 2021/10/9 下午7:58, Greg KH 写道:
>>>>> Did you look at the placement using pahole as to how this structure now
>>>>> looks?
>>>> thanks for all your commnts. for this one, do you mean I need to remove the
>>>> blank line?  thanks
>>>>
>>> No, I mean to use the tool 'pahole' to see the structure layout that you
>>> just created and determine if it really is the best way to add these new
>>> fields, especially as you are adding huge buffers with odd alignment.
>> thanks,
>>
>> Based on your comments, I removed 'char outchar',  remian the position of
>> 'int outbuf_size' unchanged to keep outbuf_size and lock in the same cache
>> line.  Now hvc_struct change as below,
>>
>>   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;
>> @@ -48,6 +57,16 @@ 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,
>> +        * and also used in hvc_poll_put_char() for putting single char.
>> +        */
>> +       char cons_outbuf[N_OUTBUF] __ALIGNED__;
>> +       spinlock_t cons_outbuf_lock;
>> +
>> +       /* the buf is used for putting chars to tty */
>> +       char outbuf[] __ALIGNED__;
>>   };
>>
>> pahole for above hvc_struct as below,  is it ok for you?  do we need to pack
>> the hole? thanks
>>
>> struct hvc_struct {
>>      struct tty_port            port;                 /*     0 352 */
>>      /* --- cacheline 5 boundary (320 bytes) was 32 bytes ago --- */
>>      spinlock_t                 lock;                 /*   352 4 */
>>      int                        index;                /*   356 4 */
>>      int                        do_wakeup;            /*   360 4 */
>>      int                        outbuf_size;          /*   364 4 */
>>      int                        n_outbuf;             /*   368 4 */
>>      uint32_t                   vtermno;              /*   372 4 */
>>      const struct hv_ops  *     ops;                  /*   376 8 */
>>      /* --- cacheline 6 boundary (384 bytes) --- */
>>      int                        irq_requested;        /*   384 4 */
>>      int                        data;                 /*   388 4 */
>>      struct winsize             ws;                   /*   392 8 */
>>      struct work_struct         tty_resize;           /*   400 32 */
>>      struct list_head           next;                 /*   432 16 */
>>      /* --- cacheline 7 boundary (448 bytes) --- */
>>      long unsigned int          flags;                /*   448 8 */
>>
>>      /* XXX 56 bytes hole, try to pack */
>>
>>      /* --- cacheline 8 boundary (512 bytes) --- */
>>      char                       cons_outbuf[16];      /*   512 16 */
>>      spinlock_t                 cons_outbuf_lock;     /*   528 4 */
>>
>>      /* XXX 44 bytes hole, try to pack */
> Why not move the spinlock up above the cons_outbuf?  Will that not be a
> bit better?
thanks, I will move it avove cons_outbuf, and send v11 patches soon.
>
> Anyway, this is all fine, and much better than before, thanks.
>
> greg k-h

  reply	other threads:[~2021-10-14  8:56 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-09 11:48 [PATCH v10 0/3] make hvc pass dma capable memory to its backend Xianting Tian
2021-10-09 11:48 ` [PATCH v10 1/3] tty: hvc: use correct dma alignment size Xianting Tian
2021-10-09 11:48 ` [PATCH v10 2/3] tty: hvc: pass DMA capable memory to put_chars() Xianting Tian
2021-10-09 11:55   ` Greg KH
2021-10-09 11:58   ` Greg KH
2021-10-09 15:45     ` Xianting Tian
2021-10-10  5:33       ` Greg KH
2021-10-14  8:34         ` Xianting Tian
2021-10-14  8:41           ` Greg KH
2021-10-14  8:56             ` Xianting Tian [this message]
2021-10-09 11:48 ` [PATCH v10 3/3] virtio-console: remove unnecessary kmemdup() Xianting Tian

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=8225536f-8ecb-0678-f630-265652793a42@linux.alibaba.com \
    --to=xianting.tian@linux.alibaba.com \
    --cc=amit@kernel.org \
    --cc=arnd@arndb.de \
    --cc=gregkh@linuxfoundation.org \
    --cc=jirislaby@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=osandov@fb.com \
    --cc=shile.zhang@linux.alibaba.com \
    --cc=virtualization@lists.linux-foundation.org \
    /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