Warren Buffett's Berkshire Hathaway (NYSE:BRK-A) (NYSE:BRK-B) made a nearly $11 billion bet on tech giant International Business Machines (NYSE:IBM) in 2011. The move seemed out of character for Buffett, who typically shuns tech stocks for being well outside his circle of competence. But IBM's entrenched status in many industries gave it competitive advantages Buffett couldn't resist.

Buffett began rolling back this decision earlier this year, dumping about one-third of his position prior to Berkshire's annual meeting. He cited tough competition, saying he had revalued the stock "somewhat downward" as a result. With revenue slumping for more than five years, those competitive advantages had clearly eroded.

Berkshire's latest regulatory filing shows that Buffett has trimmed this multi-billion-dollar stake even further. Berkshire owned 37 million shares of IBM as of Sept. 30, worth about $5.5 billion today. That's down from around 50 million shares earlier this year. IBM's turnaround effort has dragged on, and even Buffett's legendary patience has run thin.

Warren Buffett speaking to a group of people at a convention.

Image source: The Motley Fool.

Six years of pain

Shares of IBM moved higher for a while after Buffett made his initial investment, but that trend reversed in 2013. After reaching a high above $210 per share, IBM tumbled below $130 per share by early 2016. It's recovered a bit since, but it's been volatile, with the market unable to make up its mind.

IBM Chart

IBM data by YCharts

IBM has been working to transform itself, investing in cloud computing, artificial intelligence, and other growth areas. The majority of its revenue, though, is still tied to legacy businesses in decline. Add to this a U.S. dollar that strengthened considerably in 2014 and 2015 and the divestiture of major businesses like x86 servers, and the result has been a relentless decline in revenue.

A chart showing year-over-year changes in IBM's quarterly revenue and currency-adjusted revenue over the past five years.

Chart by author. Data source: IBM.

Adjusted for currency and divestitures, IBM's results haven't been as bad as they seem. But revenue declines are still bad no matter how you slice it. The bottom line hasn't fared any better. Per-share adjusted earnings peaked in 2014 at $16.53, falling to $13.59 in 2016. IBM expects to grow this number slightly this year, with the aid of share buybacks.

In his 2011 letter to shareholders, Buffett said he hoped IBM stock languished over the next five years, so that the company's share buybacks would be more effective. He got what he wanted, but it came with revenue and earnings declines that he didn't foresee.

But things are starting to look up

The big question for IBM shareholders over the past few years: When exactly will the company return to growth? IBM expects to return to earnings growth this year, but revenue will still decline compared to 2016.

The answer to that question now looks like the fourth quarter. Thanks to the launch of a new mainframe system, IBM expects the fourth quarter of 2017 to be stronger than the fourth quarter of last year. This works out to year-over-year revenue growth -- the first growth in 22 quarters.

The new mainframe will be the catalyst for this growth, but IBM's various growth businesses are close to reaching an inflection point. IBM's strategic imperatives, which include cloud computing, security, and analytics, generated 45% of total revenue over the past 12 months, growing by 10% year over year. The rest of the company is shrinking, but these growth businesses should soon be able to offset those declines.

Buffett is selling off his stake when it looks like IBM is finally turning the corner. There are plenty of reasons to be less optimistic about IBM today compared to 2011, when earnings were still powering higher year after year, and when cloud computing had yet to go mainstream. But I think giving up on the company is a mistake.