netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Lunn <andrew@lunn.ch>
To: Sergei Antonov <saproj@gmail.com>
Cc: netdev@vger.kernel.org, Jakub Kicinski <kuba@kernel.org>,
	Vladimir Oltean <olteanv@gmail.com>
Subject: Re: [PATCH 2/2] net: moxa: prevent double-mapping of DMA areas
Date: Thu, 18 Aug 2022 21:27:05 +0200	[thread overview]
Message-ID: <Yv6SiQgzKSRL1Zy6@lunn.ch> (raw)
In-Reply-To: <20220818182948.931712-2-saproj@gmail.com>

On Thu, Aug 18, 2022 at 09:29:48PM +0300, Sergei Antonov wrote:
> Fix the warning poping up after bringing the link down, then up:
>  ip link set dev eth0 down
>  ip link set dev eth0 up
> 
> WARNING: CPU: 0 PID: 55 at kernel/dma/debug.c:570 add_dma_entry+0x204/0x2ec
> DMA-API: moxart-ethernet 92000000.mac: cacheline tracking EEXIST, overlapping mappings aren't supported
> CPU: 0 PID: 55 Comm: ip Not tainted 5.19.0+ #57
> Hardware name: Generic DT based system
>  unwind_backtrace from show_stack+0x10/0x14
>  show_stack from dump_stack_lvl+0x34/0x44
>  dump_stack_lvl from __warn+0xbc/0x1f0
>  __warn from warn_slowpath_fmt+0x94/0xc8
>  warn_slowpath_fmt from add_dma_entry+0x204/0x2ec
>  add_dma_entry from dma_map_page_attrs+0x110/0x328
>  dma_map_page_attrs from moxart_mac_open+0x134/0x320
>  moxart_mac_open from __dev_open+0x11c/0x1ec
>  __dev_open from __dev_change_flags+0x194/0x22c
>  __dev_change_flags from dev_change_flags+0x14/0x44
>  dev_change_flags from devinet_ioctl+0x6d4/0x93c
>  devinet_ioctl from inet_ioctl+0x1ac/0x25c
> 
> Unmap RX memory areas in moxart_mac_stop(), so that moxart_mac_open()
> will map them anew instead of double-mapping. To avoid code duplication,
> create a new function moxart_mac_unmap_rx(). Nullify unmapped pointers to
> prevent double-unmapping (ex: moxart_mac_stop(), then moxart_remove()).

This makes the code symmetric, which is good.

However, moxart_mac_free_memory() will also free the descriptors,
which is not required. moxart_remove() should undo what the probe did,
nothing more.

	Andrew

  reply	other threads:[~2022-08-18 19:27 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-18 18:29 [PATCH 1/2] net: moxa: do not call dma_unmap_single() with null Sergei Antonov
2022-08-18 18:29 ` [PATCH 2/2] net: moxa: prevent double-mapping of DMA areas Sergei Antonov
2022-08-18 19:27   ` Andrew Lunn [this message]
2022-08-19  8:12     ` Sergei Antonov
2022-08-19 11:00       ` Vladimir Oltean
2022-08-18 19:18 ` [PATCH 1/2] net: moxa: do not call dma_unmap_single() with null Andrew Lunn
2022-08-19  7:27   ` Sergei Antonov

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=Yv6SiQgzKSRL1Zy6@lunn.ch \
    --to=andrew@lunn.ch \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=olteanv@gmail.com \
    --cc=saproj@gmail.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).