Skip to content

Commit d07bd86

Browse files
arch/tile: clarify flush_buffer()/finv_buffer() function names
They are only applicable for locally-homecached memory ranges, so change their names to {flush,finv}_buffer_local(). Change inv_buffer() to just do an mf instead of any kind of fancier barrier, since you're obviously not going to be waiting for anything once the local homecache is invalidated. Fix tilepro.c network driver not to bother calling finv_buffer when stopping the EPP, but just mf after memset to ensure that it will not see any packet data after we finish stopping; use finv_buffer_remote() when doing exit-time cleanup. This also fixes a (not very interesting) generic Linux build failure where drivers/scsi/st.c declares its own flush_buffer(). Signed-off-by: Chris Metcalf <cmetcalf@tilera.com>
1 parent 5386e73 commit d07bd86

2 files changed

Lines changed: 15 additions & 11 deletions

File tree

‎arch/tile/include/asm/cacheflush.h‎

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -116,22 +116,28 @@ static inline void __finv_buffer(void *buffer, size_t size)
116116
}
117117

118118

119-
/* Invalidate a VA range, then memory fence. */
119+
/* Invalidate a VA range and wait for it to be complete. */
120120
static inline void inv_buffer(void *buffer, size_t size)
121121
{
122122
__inv_buffer(buffer, size);
123-
mb_incoherent();
123+
mb();
124124
}
125125

126-
/* Flush a VA range, then memory fence. */
127-
static inline void flush_buffer(void *buffer, size_t size)
126+
/*
127+
* Flush a locally-homecached VA range and wait for the evicted
128+
* cachelines to hit memory.
129+
*/
130+
static inline void flush_buffer_local(void *buffer, size_t size)
128131
{
129132
__flush_buffer(buffer, size);
130133
mb_incoherent();
131134
}
132135

133-
/* Flush & invalidate a VA range, then memory fence. */
134-
static inline void finv_buffer(void *buffer, size_t size)
136+
/*
137+
* Flush and invalidate a locally-homecached VA range and wait for the
138+
* evicted cachelines to hit memory.
139+
*/
140+
static inline void finv_buffer_local(void *buffer, size_t size)
135141
{
136142
__finv_buffer(buffer, size);
137143
mb_incoherent();

‎drivers/net/tile/tilepro.c‎

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1658,11 +1658,9 @@ static int tile_net_stop(struct net_device *dev)
16581658
while (tile_net_lepp_free_comps(dev, true))
16591659
/* loop */;
16601660

1661-
/* Wipe the EPP queue. */
1661+
/* Wipe the EPP queue, and wait till the stores hit the EPP. */
16621662
memset(priv->eq, 0, sizeof(lepp_queue_t));
1663-
1664-
/* Evict the EPP queue. */
1665-
finv_buffer(priv->eq, EQ_SIZE);
1663+
mb();
16661664

16671665
return 0;
16681666
}
@@ -2398,7 +2396,7 @@ static void tile_net_cleanup(void)
23982396
struct net_device *dev = tile_net_devs[i];
23992397
struct tile_net_priv *priv = netdev_priv(dev);
24002398
unregister_netdev(dev);
2401-
finv_buffer(priv->eq, EQ_SIZE);
2399+
finv_buffer_remote(priv->eq, EQ_SIZE, 0);
24022400
__free_pages(priv->eq_pages, EQ_ORDER);
24032401
free_netdev(dev);
24042402
}

0 commit comments

Comments
 (0)